| 1 |
--- |
| 2 |
name: Tests |
| 3 |
|
| 4 |
on: # yamllint disable-line rule:truthy |
| 5 |
push: |
| 6 |
branches: |
| 7 |
- main |
| 8 |
pull_request: |
| 9 |
types: [opened, synchronize] |
| 10 |
workflow_dispatch: |
| 11 |
jobs: |
| 12 |
Tests: |
| 13 |
runs-on: ubuntu-latest |
| 14 |
strategy: |
| 15 |
max-parallel: 4 |
| 16 |
matrix: |
| 17 |
python-version: [3.8, 3.9, '3.10', '3.11'] |
| 18 |
steps: |
| 19 |
- uses: actions/checkout@v1 |
| 20 |
- name: Set up Python ${{ matrix.python-version }} |
| 21 |
uses: actions/setup-python@v1 |
| 22 |
with: |
| 23 |
python-version: ${{ matrix.python-version }} |
| 24 |
- name: Install dependencies |
| 25 |
run: | |
| 26 |
# All these steps are required so that mypy behaves equally than the |
| 27 |
# local environment, once mypy supports __pypackages__ try to use the |
| 28 |
# github action |
| 29 |
pip install virtualenv pdm |
| 30 |
virtualenv .venv |
| 31 |
source .venv/bin/activate |
| 32 |
pdm config python.use_venv True |
| 33 |
make install |
| 34 |
- name: Test linters |
| 35 |
run: make lint |
| 36 |
- name: Test type checkers |
| 37 |
run: make mypy |
| 38 |
- name: Test security |
| 39 |
run: make security |
| 40 |
- name: Test with pytest |
| 41 |
run: make test |
| 42 |
- name: Upload Coverage |
| 43 |
run: | |
| 44 |
pip3 install 'coveralls[toml]' |
| 45 |
coveralls --service=github |
| 46 |
env: |
| 47 |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 48 |
COVERALLS_FLAG_NAME: ${{ matrix.test-name }} |
| 49 |
COVERALLS_PARALLEL: true |
| 50 |
- name: Test documentation |
| 51 |
run: make build-docs |
| 52 |
- name: Build the package |
| 53 |
run: make build-package |
| 54 |
Coveralls: |
| 55 |
name: Finish Coveralls |
| 56 |
needs: Tests |
| 57 |
runs-on: ubuntu-latest |
| 58 |
container: python:3-slim |
| 59 |
steps: |
| 60 |
- name: Finished |
| 61 |
run: | |
| 62 |
pip3 install coveralls |
| 63 |
coveralls --service=github --finish |
| 64 |
env: |
| 65 |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |