|
12 | 12 | - "**.py"
|
13 | 13 |
|
14 | 14 | jobs:
|
15 |
| - check: |
16 |
| - name: Run pre-commit checks |
17 |
| - runs-on: ubuntu-latest |
18 |
| - steps: |
19 |
| - - uses: actions/cache@v2 |
20 |
| - with: |
21 |
| - path: ~/.cache/pip |
22 |
| - key: pip |
23 |
| - - uses: actions/checkout@v2 |
24 |
| - - uses: actions/setup-python@v2 |
25 |
| - - name: Install pre-commit |
26 |
| - run: | |
27 |
| - python -m pip install --upgrade pip |
28 |
| - pip install pre-commit |
29 |
| - - name: Run pre-commit |
30 |
| - run: pre-commit run --all-files |
31 | 15 | test:
|
32 |
| - name: Test ${{ matrix.python-version }}${{ matrix.compile && ' compiled' || '' }} |
| 16 | + name: Test ${{ matrix.python-version }} |
33 | 17 | runs-on: ubuntu-latest
|
34 |
| - needs: [check] |
35 | 18 | strategy:
|
36 | 19 | fail-fast: false
|
37 | 20 | matrix:
|
38 |
| - python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', 'pypy3'] |
39 |
| - compile: [true, false] |
40 |
| - exclude: |
41 |
| - - python-version: pypy3 |
42 |
| - compile: true |
| 21 | + python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', 'pypy-3.7'] |
| 22 | + include: |
| 23 | + - python-version: "3.6" |
| 24 | + pytest-args: --ignore=tests/__generated__/test_recursive_postponned.py |
| 25 | + - python-version: "3.10" |
| 26 | + pytest-args: --cov=apischema --cov-branch --cov-report=xml --cov-report=html |
43 | 27 | steps:
|
44 | 28 | - uses: actions/cache@v2
|
45 | 29 | with:
|
46 | 30 | path: ~/.cache/pip
|
47 |
| - key: pip |
| 31 | + key: ${{ runner.os }}-pip-${{ hashFiles('tests/requirements.txt') }} |
| 32 | + restore-keys: | |
| 33 | + ${{ runner.os }}-pip- |
48 | 34 | - uses: actions/checkout@v2
|
49 | 35 | - name: Set up Python ${{ matrix.python-version }}
|
50 | 36 | uses: actions/setup-python@v2
|
51 | 37 | with:
|
52 | 38 | python-version: ${{ matrix.python-version }}
|
53 |
| - - name: cythonize |
54 |
| - if: matrix.compile |
55 |
| - run: | |
56 |
| - python -m pip install cython ${{ (matrix.python-version == '3.6' || matrix.python-version == 'pypy3') && 'dataclasses' || '' }} |
57 |
| - python scripts/cythonize.py |
58 |
| - python setup.py build_ext --inplace |
59 |
| - - name: Install tox |
60 |
| - run: | |
61 |
| - python -m pip install --upgrade pip |
62 |
| - pip install tox tox-gh-actions |
63 |
| - - name: Run tox |
64 |
| - run: tox |
| 39 | + - name: Install requirements |
| 40 | + run: pip install -r tests/requirements.txt |
| 41 | + - name: Generate tests from documentation example |
| 42 | + run: scripts/generate_tests_from_examples.py |
| 43 | + - name: Run tests |
| 44 | + run: pytest tests ${{ matrix.pytest-args }} |
| 45 | + - uses: codecov/codecov-action@v2 |
| 46 | + # https://github.saobby.my.eu.orgmunity/t/run-step-if-file-exists/16445/3 |
| 47 | + if: hashFiles('coverage.xml') != '' |
| 48 | + - uses: actions/upload-artifact@v2 |
| 49 | + if: hashFiles('coverage.xml') != '' |
| 50 | + with: |
| 51 | + name: coverage |
| 52 | + path: | |
| 53 | + coverage.xml |
| 54 | + htmlcov |
| 55 | + - name: Cythonize |
| 56 | + run: scripts/cythonize.sh |
| 57 | + if: matrix.python-version != 'pypy3' |
| 58 | + - name: Compile |
| 59 | + run: python setup.py build_ext --inplace |
| 60 | + if: matrix.python-version != 'pypy3' |
| 61 | + - name: Run tests (compiled) |
| 62 | + run: pytest tests ${{ matrix.pytest-args }} |
| 63 | + if: matrix.python-version != 'pypy3' |
65 | 64 |
|
| 65 | +concurrency: |
| 66 | + group: ci-${{ github.head_ref }} |
| 67 | + cancel-in-progress: true |
0 commit comments