|
| 1 | +# This workflow will install Python dependencies, run tests and lint with a single version of Python |
| 2 | +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions |
| 3 | + |
| 4 | +name: Python application |
| 5 | + |
| 6 | +on: [ push, pull_request ] |
| 7 | + |
| 8 | +jobs: |
| 9 | + test: |
| 10 | + runs-on: ${{ matrix.os }} |
| 11 | + strategy: |
| 12 | + matrix: |
| 13 | + os: [ ubuntu-latest, macos-latest, windows-latest ] |
| 14 | + python-version: [ 3.8, 3.9, "3.10" ] |
| 15 | + env: |
| 16 | + OS: ${{ matrix.os }} |
| 17 | + PYTHON: ${{ matrix.python-version }} |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v2 |
| 20 | + - name: Set up Python 3.10 |
| 21 | + uses: actions/setup-python@v2 |
| 22 | + with: |
| 23 | + python-version: ${{ matrix.python-version }} |
| 24 | + - name: Install dependencies |
| 25 | + run: | |
| 26 | + python -m pip install --upgrade pip |
| 27 | + pip install flake8 |
| 28 | + pip install -r requirements-dev.txt |
| 29 | + - name: Lint with flake8 |
| 30 | + run: | |
| 31 | + # stop the build if there are Python syntax errors or undefined names |
| 32 | + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
| 33 | + # exit-zero treats all errors as warnings. |
| 34 | + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=120 --statistics |
| 35 | + - name: Run code coverage with pytest |
| 36 | + run: | |
| 37 | + coverage run -m pytest |
| 38 | + coverage xml |
| 39 | + - name: Upload code coverage to codecov.io |
| 40 | + uses: codecov/codecov-action@v2 |
| 41 | + with: |
| 42 | + # token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos |
| 43 | + env_vars: OS,PYTHON |
| 44 | + files: ./coverage.xml |
| 45 | + flags: pytest # optional |
| 46 | + name: codecov-umbrella # optional |
| 47 | + fail_ci_if_error: false # Enable once we have good coverage |
| 48 | + verbose: true # optional (default = false) |
0 commit comments