2021-04-16 15:27:31 +08:00
|
|
|
name: Main testing workflow
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
pull_request:
|
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
jobs:
|
2023-01-03 18:29:42 +08:00
|
|
|
test-run:
|
2021-04-16 15:27:31 +08:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2023-01-03 18:29:42 +08:00
|
|
|
include:
|
|
|
|
- python-version: "3.8"
|
2023-07-23 19:15:40 +08:00
|
|
|
toxfactor: py3.8
|
2023-01-03 18:29:42 +08:00
|
|
|
ignore-typecheck-outcome: true
|
|
|
|
ignore-test-outcome: false
|
|
|
|
- python-version: "3.9"
|
2023-07-23 19:15:40 +08:00
|
|
|
toxfactor: py3.9
|
2023-01-03 18:29:42 +08:00
|
|
|
ignore-typecheck-outcome: true
|
|
|
|
ignore-test-outcome: false
|
|
|
|
- python-version: "3.10"
|
2023-07-23 19:15:40 +08:00
|
|
|
toxfactor: py3.10
|
2023-01-03 18:29:42 +08:00
|
|
|
ignore-typecheck-outcome: true
|
|
|
|
ignore-test-outcome: false
|
|
|
|
- python-version: "3.11"
|
2023-07-23 19:15:40 +08:00
|
|
|
toxfactor: py3.11
|
2023-01-03 18:29:42 +08:00
|
|
|
ignore-typecheck-outcome: true
|
|
|
|
ignore-test-outcome: false
|
2023-07-23 18:46:49 +08:00
|
|
|
- python-version: "3.12-dev"
|
2023-07-23 19:15:40 +08:00
|
|
|
toxfactor: py3.12
|
2023-01-03 18:29:42 +08:00
|
|
|
ignore-typecheck-outcome: true
|
2023-07-23 19:22:10 +08:00
|
|
|
ignore-test-outcome: false
|
2021-04-16 15:27:31 +08:00
|
|
|
|
|
|
|
steps:
|
2022-11-05 17:24:30 +08:00
|
|
|
- uses: actions/checkout@v3
|
2023-01-03 18:29:42 +08:00
|
|
|
|
2021-04-16 15:27:31 +08:00
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
2022-11-05 17:24:30 +08:00
|
|
|
uses: actions/setup-python@v4
|
2023-01-03 18:29:42 +08:00
|
|
|
id: setup-python
|
2021-04-16 15:27:31 +08:00
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
2023-01-03 18:29:42 +08:00
|
|
|
|
|
|
|
- name: Install poetry
|
|
|
|
run: |
|
2023-10-11 03:29:48 +08:00
|
|
|
python -m pip install poetry==1.6.1
|
2023-01-03 18:29:42 +08:00
|
|
|
|
|
|
|
- name: Configure poetry
|
|
|
|
run: |
|
|
|
|
python -m poetry config virtualenvs.in-project true
|
|
|
|
|
|
|
|
- name: Cache the virtualenv
|
|
|
|
id: poetry-dependencies-cache
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: ./.venv
|
|
|
|
key: ${{ runner.os }}-venv-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
|
|
|
|
|
|
|
|
- name: Install dev dependencies
|
|
|
|
if: steps.poetry-dependencies-cache.outputs.cache-hit != 'true'
|
2021-04-16 15:27:31 +08:00
|
|
|
run: |
|
2023-01-03 18:29:42 +08:00
|
|
|
python -m poetry install --only=dev
|
|
|
|
|
2022-02-24 23:52:23 +08:00
|
|
|
- name: Type checking
|
2023-01-03 18:29:42 +08:00
|
|
|
# Ignore errors for older pythons
|
|
|
|
continue-on-error: ${{ matrix.ignore-typecheck-outcome }}
|
2022-02-24 23:52:23 +08:00
|
|
|
run: |
|
2023-01-03 18:29:42 +08:00
|
|
|
source .venv/bin/activate
|
2022-02-24 23:52:23 +08:00
|
|
|
tox -e mypy
|
2023-01-03 18:29:42 +08:00
|
|
|
|
2021-04-16 15:27:31 +08:00
|
|
|
- name: Test with tox
|
2023-01-03 18:29:42 +08:00
|
|
|
continue-on-error: ${{ matrix.ignore-test-outcome }}
|
2022-11-05 17:42:30 +08:00
|
|
|
run: |
|
2023-01-03 18:29:42 +08:00
|
|
|
source .venv/bin/activate
|
2022-11-05 20:35:03 +08:00
|
|
|
coverage erase
|
2023-01-03 18:29:42 +08:00
|
|
|
tox run-parallel -f ${{ matrix.toxfactor }} --parallel-no-spinner --parallel-live
|
2022-11-05 20:35:03 +08:00
|
|
|
coverage combine
|
2022-11-05 17:42:30 +08:00
|
|
|
coverage xml
|
2023-01-03 18:29:42 +08:00
|
|
|
|
2022-11-05 17:21:20 +08:00
|
|
|
- uses: codecov/codecov-action@v3
|
|
|
|
with:
|
2023-02-28 03:02:46 +08:00
|
|
|
# Explicitly using the token in order to avoid Codecov rate limit errors
|
|
|
|
# See https://community.codecov.com/t/upload-issues-unable-to-locate-build-via-github-actions-api/3954
|
|
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
2022-11-05 17:21:20 +08:00
|
|
|
fail_ci_if_error: true
|
|
|
|
verbose: true # optional (default = false)
|