Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add running pytest to GitHub action #2146

Merged
merged 8 commits into from
Dec 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/**'
AlvinSchiller marked this conversation as resolved.
Show resolved Hide resolved
paths:
- '**.py'
- '**.py.*'
AlvinSchiller marked this conversation as resolved.
Show resolved Hide resolved

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