Avoids unnecessary calls when pytest API fixture fails #332
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Python package | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
# The branches below must be a subset of the branches above | |
branches: [ main ] | |
schedule: | |
- cron: '31 13 * * 2' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
environment: test | |
strategy: | |
max-parallel: 1 | |
matrix: | |
python-version: [3.7] | |
env: | |
MYGEOTAB_DATABASE: ${{ secrets.MYGEOTAB_DATABASE }} | |
MYGEOTAB_USERNAME: ${{ secrets.MYGEOTAB_USERNAME }} | |
MYGEOTAB_PASSWORD: ${{ secrets.MYGEOTAB_PASSWORD }} | |
MYGEOTAB_SERVER: ${{ secrets.MYGEOTAB_SERVER }} | |
MYGEOTAB_USERNAME_ASYNC: ${{ secrets.MYGEOTAB_USERNAME_ASYNC }} | |
MYGEOTAB_PASSWORD_ASYNC: ${{ secrets.MYGEOTAB_PASSWORD_ASYNC }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade setuptools pip pipenv | |
pipenv install --skip-lock --dev -e . | |
- name: Lint with ruff | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
pipenv run ruff check . --select=E9,F63,F7,F82 --output-format=full | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
pipenv run ruff check . --exit-zero | |
- name: Test with pytest | |
run: | | |
pipenv run py.test --cov-config .coveragerc --cov-report xml:output/coverage.xml --cov mygeotab --junitxml output/python${{ matrix.python-version }}-test-results.xml --benchmark-min-rounds=3 --benchmark-storage=file://output/ --benchmark-autosave tests/ | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{secrets.CODECOV_TOKEN}} | |
file: ./output/coverage.xml | |
- name: Archive code coverage results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: output | |
path: output |