Skip to content

Python package

Python package #167

Workflow file for this run

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@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
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 . --select=E9,F63,F7,F82 --show-source
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
pipenv run ruff . --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@v3
with:
token: ${{secrets.CODECOV_TOKEN}}
file: ./output/coverage.xml
- name: Archive code coverage results
uses: actions/upload-artifact@v3
with:
name: output
path: output