|
1 |
| -name: Unit Tests |
| 1 | +name: CI |
2 | 2 |
|
3 | 3 | on:
|
4 |
| - push: |
5 |
| - branches: [ "master", "dev" ] |
6 |
| - pull_request: |
7 |
| - branches: [ "master", "dev" ] |
| 4 | + push: { branches: [master, dev] } |
| 5 | + pull_request: { branches: [master, dev] } |
8 | 6 |
|
9 | 7 | jobs:
|
10 | 8 | build:
|
11 |
| - env: |
12 |
| - DEFAULT_PYTHON: 3.12 |
13 | 9 | runs-on: ubuntu-latest
|
| 10 | + env: |
| 11 | + DEFAULT_PYTHON: '3.12' |
14 | 12 | strategy:
|
15 | 13 | matrix:
|
16 |
| - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] |
17 |
| - architecture: ["x64"] |
| 14 | + python-version: ['3.9','3.10','3.11','3.12','3.13'] |
| 15 | + architecture: ['x64'] |
| 16 | + |
18 | 17 | steps:
|
19 |
| - - uses: actions/checkout@v2 |
20 |
| - - name: Setup Python ${{ matrix.python-version }} on ${{ matrix.architecture }} |
21 |
| - uses: actions/setup-python@v2 |
22 |
| - with: |
23 |
| - python-version: ${{ matrix.python-version }} |
24 |
| - architecture: ${{ matrix.architecture }} |
25 |
| - - name: Cache pip |
26 |
| - env: |
27 |
| - PYO3_USE_ABI3_FORWARD_COMPATIBILITY: "1" |
28 |
| - uses: actions/cache@v4 |
29 |
| - with: |
30 |
| - restore-keys: | |
31 |
| - ${{ runner.os }}- |
32 |
| - - name: Upgrade setuptools |
33 |
| - if: matrix.python-version >= 3.12 |
34 |
| - run: | |
35 |
| - # workaround for 3.12, SEE: https://github.com/pypa/setuptools/issues/3661#issuecomment-1813845177 |
36 |
| - pip install --upgrade setuptools |
37 |
| - - name: Lint with flake8 |
38 |
| - if: matrix.python-version == ${{ env.DEFAULT_PYTHON }} |
39 |
| - run: | |
40 |
| - # stop the build if there are Python syntax errors or undefined names |
41 |
| - nox -e flake8 -- deepdiff --count --select=E9,F63,F7,F82 --show-source --statistics |
42 |
| - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide |
43 |
| - nox -e flake8 -- deepdiff --count --exit-zero --max-complexity=26 --max-line-length=250 --statistics |
44 |
| - - name: Test with pytest and get the coverage |
45 |
| - if: matrix.python-version == ${{ env.DEFAULT_PYTHON }} |
46 |
| - run: | |
47 |
| - nox -e pytest -s -- --benchmark-disable --cov-report=xml --cov=deepdiff tests/ --runslow |
48 |
| - - name: Test with pytest and no coverage report |
49 |
| - if: matrix.python-version != ${{ env.DEFAULT_PYTHON }} |
50 |
| - run: | |
51 |
| - nox -e pytest -s -- --benchmark-disable tests/ |
52 |
| - - name: Upload coverage to Codecov |
53 |
| - uses: codecov/codecov-action@v4 |
54 |
| - if: matrix.python-version == ${{ env.DEFAULT_PYTHON }} |
55 |
| - env: |
56 |
| - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
57 |
| - with: |
58 |
| - file: ./coverage.xml |
59 |
| - token: ${{ secrets.CODECOV_TOKEN }} |
60 |
| - env_vars: OS,PYTHON |
61 |
| - fail_ci_if_error: true |
| 18 | + - uses: actions/checkout@v3 |
| 19 | + |
| 20 | + - name: Setup Python |
| 21 | + uses: actions/setup-python@v4 |
| 22 | + with: |
| 23 | + python-version: ${{ matrix.python-version }} |
| 24 | + architecture: ${{ matrix.architecture }} |
| 25 | + cache: pip |
| 26 | + cache-dependency-path: pyproject.toml |
| 27 | + |
| 28 | + - name: Install nox |
| 29 | + run: pip install nox |
| 30 | + - name: Upgrade setuptools & wheel (for all venvs) |
| 31 | + run: pip install --upgrade setuptools wheel |
| 32 | + |
| 33 | + - name: Lint with flake8 |
| 34 | + if: ${{ matrix.python-version == env.DEFAULT_PYTHON }} |
| 35 | + run: | |
| 36 | + nox -e flake8 -- \ |
| 37 | + deepdiff \ |
| 38 | + --count --select=E9,F63,F7,F82 \ |
| 39 | + --show-source --statistics |
| 40 | + nox -e flake8 -- \ |
| 41 | + deepdiff \ |
| 42 | + --count --exit-zero \ |
| 43 | + --max-complexity=26 --max-line-length=250 \ |
| 44 | + --statistics |
| 45 | +
|
| 46 | + - name: Test with pytest (coverage) |
| 47 | + if: ${{ matrix.python-version == env.DEFAULT_PYTHON }} |
| 48 | + run: | |
| 49 | + nox -e pytest -- \ |
| 50 | + --benchmark-disable \ |
| 51 | + --cov-report=xml \ |
| 52 | + --cov=deepdiff \ |
| 53 | + tests/ --runslow |
| 54 | +
|
| 55 | + - name: Test with pytest (no coverage) |
| 56 | + if: ${{ matrix.python-version != env.DEFAULT_PYTHON }} |
| 57 | + run: nox -e pytest -- --benchmark-disable tests/ |
| 58 | + |
| 59 | + - name: Upload coverage |
| 60 | + if: ${{ matrix.python-version == env.DEFAULT_PYTHON }} |
| 61 | + uses: codecov/codecov-action@v4 |
| 62 | + with: |
| 63 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 64 | + file: coverage.xml |
| 65 | + env_vars: OS,PYTHON |
| 66 | + fail_ci_if_error: true |
0 commit comments