Skip to content

Commit

Permalink
Add running pytest to GitHub action (#2146)
Browse files Browse the repository at this point in the history
* Add running pytest

* Trigger running the action

* Remove Python 3.7 to check

* support only bullseye and bookworm python versions

* Add coverage check with coveralls

* use coverage for ci

* add coverage package

* consider review comments
  • Loading branch information
s-martin authored Dec 10, 2023
1 parent 02c63ed commit dd7f6e9
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ per-file-ignores =
count = True
max-complexity = 12
statistics = True
filename = *.py,*.py.*
filename = *.py
extend-exclude =
# Ignore all scratch development directories
scratch*,
Expand Down
23 changes: 20 additions & 3 deletions .github/workflows/pythonpackage_future3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ on:
- 'future3/**'
paths:
- '**.py'
- '**.py.*'
pull_request:
branches:
- 'future3/**'
paths:
- '**.py'
- '**.py.*'

jobs:
build:
Expand All @@ -21,7 +19,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
python-version: ['3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v3
Expand All @@ -41,8 +39,27 @@ jobs:
pip3 install -r src/jukebox/components/rfid/hardware/pn532_i2c_py532/requirements.txt
pip3 install -r src/jukebox/components/rfid/hardware/rdm6300_serial/requirements.txt
pip3 install -r src/jukebox/components/rfid/hardware/rc522_spi/requirements.txt
- name: Run pytest
run: |
./run_pytest.sh --cov --cov-report xml
- name: Report to Coveralls (parallel)
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: coverage.xml
format: cobertura
parallel: true
- name: Lint with flake8
run: |
pip3 install flake8
# Stop the build if linting fails
./run_flake8.sh
finish:
needs: build
runs-on: ubuntu-latest
steps:
- name: Close parallel build
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ gpiozero
# Code quality
flake8>=4.0.0
pytest
pytest-cov
mock
2 changes: 1 addition & 1 deletion run_pytest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ SCRIPT_DIR="$(dirname "$SOURCE")"
cd "$SCRIPT_DIR" || (echo "Could not change to top-level project directory" && exit 1)

# Run pytest
pytest -c pytest.ini
pytest -c pytest.ini $@
1 change: 1 addition & 0 deletions src/jukebox/misc/loggingext.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
##############
Logger
##############
We use a hierarchical Logger structure based on pythons logging module. It can be finely configured with a yaml file.
Expand Down

0 comments on commit dd7f6e9

Please sign in to comment.