Skip to content

refactor: remove unused state machine tracking and related attributes… #74

refactor: remove unused state machine tracking and related attributes…

refactor: remove unused state machine tracking and related attributes… #74

Workflow file for this run

name: CI Pipeline
on: [push, pull_request]
jobs:
markdownlint:
name: Markdown-Lint
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- uses: DavidAnson/markdownlint-cli2-action@v22
with:
globs: |
README.md
CHANGELOG.md
docs/*.md
pylint:
name: Pylint
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
matrix:
python-version: ["3.10", "3.12", "3.13"]
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint
pip install gpiozero
pip install python-periphery
pip install RPi.GPIO
pip install Mock.GPIO
pip install mock
pip install pyserial
pip install spidev
pip install pyftdi
- name: Analysing the code with pylint
run: |
pylint $(find -wholename './src/*.py')
unittest_cpython:
name: Unittests CPython
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
matrix:
python-version: ["3.10", "3.12", "3.13"]
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install gpiozero
pip install python-periphery
pip install RPi.GPIO
pip install Mock.GPIO
pip install pyserial
pip install spidev
pip install pyftdi
- name: Run unittests
run: |
python -m unittest discover -s tests/cpython -p "test_*.py"
unittest_micropython:
name: Unittests MicroPython
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- name: Install MicroPython
uses: BrianPugh/install-micropython@v2
- name: Install dependencies
run: |
micropython -m mip install unittest
micropython -m mip install unittest-discover
- name: Test MicroPython
run: |
micropython -m unittest discover -s tests/micropython -p "test_*.py"
code-coverage:
name: Code Coverage
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v6
- name: Set up Python
with:
python-version: "3.13"
uses: actions/setup-python@v6
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install coverage
pip install gpiozero
pip install python-periphery
pip install RPi.GPIO
pip install Mock.GPIO
pip install pyserial
pip install spidev
pip install pyftdi
- name: Run unittests
run: |
python -m coverage run -m unittest discover -s tests/cpython -p "test_*.py"
- name: Coverage comment
id: coverage_comment
uses: py-cov-action/python-coverage-comment-action@v3
with:
GITHUB_TOKEN: ${{ github.token }}
MINIMUM_ORANGE: 60
MINIMUM_GREEN: 80
- name: Store Pull Request comment to be posted
uses: actions/upload-artifact@v4
if: steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true'
with:
# If you use a different name, update COMMENT_ARTIFACT_NAME accordingly
name: python-coverage-comment-action
# If you use a different name, update COMMENT_FILENAME accordingly
path: python-coverage-comment-action.txt
codeql:
name: Analyze (${{ matrix.language }})
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
permissions:
security-events: write
packages: read
actions: read
contents: read
strategy:
fail-fast: false
matrix:
include:
- language: python
build-mode: none
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
with:
category: "/language:${{matrix.language}}"
grype-scan:
name: Grype Vulnerability Scan
permissions:
contents: write # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v6
- name: Create SBOM
run: |
npm install -g @cyclonedx/cdxgen
cdxgen -r . -o bom.json
- name: Upload SBOM Artifact
uses: actions/upload-artifact@v6
with:
name: sbom
path: bom.json
- name: Scan project
uses: anchore/scan-action@v7
id: scan
with:
sbom: "bom.json"
fail-build: true
severity-cutoff: critical
add-cpes-if-none: true
- name: Upload vulnerability report
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: ${{ steps.scan.outputs.sarif }}
release:
name: Release and Publish Package
runs-on: ubuntu-latest
needs:
- unittest_cpython
- unittest_micropython
if: github.ref == 'refs/heads/main'
permissions:
contents: write
issues: write
pull-requests: write
id-token: write
actions: write
packages: write
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Python Semantic Release
id: release
uses: python-semantic-release/python-semantic-release@v10.5.3
with:
github_token: ${{ github.token }}
changelog: true
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: steps.release.outputs.released == 'true'
with:
packages-dir: dist
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Publish package to GitHub
uses: python-semantic-release/publish-action@v10.5.3
if: steps.release.outputs.released == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.release.outputs.tag }}