|
1 | 1 | name: Pre-Commit Checks |
2 | | -permissions: {} # No permissions by default on workflow level |
3 | 2 |
|
4 | 3 | on: |
5 | | - push: |
| 4 | + pull_request: |
| 5 | + merge_group: |
6 | 6 | branches: |
7 | 7 | - master |
8 | | - pull_request: |
9 | | - types: |
10 | | - - opened |
11 | | - - reopened |
12 | | - - synchronize |
13 | | - - ready_for_review |
14 | 8 | workflow_dispatch: # run on request (no need for PR) |
15 | 9 |
|
| 10 | +permissions: {} # No permissions by default on workflow level |
| 11 | + |
| 12 | +concurrency: |
| 13 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 14 | + cancel-in-progress: true |
| 15 | + |
16 | 16 | jobs: |
17 | | - Code-Quality-Checks: |
18 | | - runs-on: ubuntu-24.04 |
| 17 | + code_quality_checks: |
| 18 | + runs-on: ubuntu-latest |
19 | 19 | steps: |
20 | | - - name: CHECKOUT REPOSITORY |
| 20 | + - &checkout |
| 21 | + name: Checkout code |
21 | 22 | uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 |
22 | 23 | with: |
23 | 24 | persist-credentials: false |
| 25 | + |
24 | 26 | - name: Set up Python |
25 | 27 | uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 |
26 | 28 | with: |
27 | 29 | python-version-file: ".python-version" |
| 30 | + |
28 | 31 | - name: Install uv |
29 | 32 | uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6 |
| 33 | + with: |
| 34 | + enable-cache: false |
| 35 | + version: "0.9.27" |
| 36 | + |
30 | 37 | - name: Install dependencies |
31 | | - run: | |
32 | | - uv sync --locked --all-extras |
| 38 | + run: uv sync --locked --all-extras |
| 39 | + |
33 | 40 | - name: Run pre-commit checks |
34 | | - run: | |
35 | | - uvx pre-commit run --all-files |
36 | | - Unit-Tests: |
37 | | - runs-on: ubuntu-24.04 |
| 41 | + run: uvx pre-commit run --all-files |
| 42 | + |
| 43 | + accuracy-tests: |
| 44 | + strategy: |
| 45 | + fail-fast: false |
| 46 | + matrix: |
| 47 | + os: |
| 48 | + - "ubuntu-latest" |
| 49 | + - "windows-latest" |
| 50 | + python-version: |
| 51 | + - "3.10" |
| 52 | + - "3.11" |
| 53 | + - "3.12" |
| 54 | + - "3.13" |
| 55 | + runs-on: ${{ matrix.os }} |
38 | 56 | steps: |
39 | | - - name: CHECKOUT REPOSITORY |
40 | | - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 |
41 | | - with: |
42 | | - persist-credentials: false |
43 | | - - name: Set up Python |
44 | | - uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 |
45 | | - with: |
46 | | - python-version-file: ".python-version" |
47 | | - - name: Install uv |
| 57 | + - *checkout |
| 58 | + |
| 59 | + - &matrix-setup-uv |
| 60 | + name: Install uv |
48 | 61 | uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6 |
49 | | - - name: Install dependencies |
50 | | - run: | |
51 | | - uv sync --locked --extra tests |
| 62 | + with: |
| 63 | + enable-cache: false |
| 64 | + python-version: ${{ matrix.python-version }} |
| 65 | + version: "0.9.27" |
| 66 | + |
| 67 | + - &install-dependencies |
| 68 | + name: Install dependencies |
| 69 | + run: uv sync --locked --extra tests --extra-index-url https://download.pytorch.org/whl/cpu |
| 70 | + |
| 71 | + - name: Prepare test data |
| 72 | + run: uv run python tests/accuracy/download_models.py -d data -j tests/accuracy/public_scope.json -l |
| 73 | + |
| 74 | + - name: Run Python Test |
| 75 | + run: uv run pytest --data=./data tests/accuracy/test_accuracy.py |
| 76 | + |
| 77 | + unit-functional-tests: |
| 78 | + strategy: |
| 79 | + fail-fast: false |
| 80 | + matrix: |
| 81 | + os: |
| 82 | + - "ubuntu-24.04" |
| 83 | + - "windows-2022" |
| 84 | + python-version: |
| 85 | + - "3.10" |
| 86 | + - "3.11" |
| 87 | + - "3.12" |
| 88 | + - "3.13" |
| 89 | + name: unit & functional tests (${{ matrix.os }}, Python ${{ matrix.python-version }}) |
| 90 | + runs-on: ${{ matrix.os }} |
| 91 | + steps: |
| 92 | + - *checkout |
| 93 | + |
| 94 | + - *matrix-setup-uv |
| 95 | + |
| 96 | + - *install-dependencies |
| 97 | + |
52 | 98 | - name: Run python unit tests |
| 99 | + run: uv run pytest tests/unit --cov |
| 100 | + |
| 101 | + - name: Prepare test data |
53 | 102 | run: | |
54 | | - uv run pytest tests/unit --cov |
| 103 | + uv run python tests/accuracy/download_models.py -d data -j tests/precommit/public_scope.json -l |
| 104 | +
|
| 105 | + - name: Run test |
| 106 | + run: | |
| 107 | + uv run pytest --data=./data tests/functional |
| 108 | +
|
| 109 | + pre-commit-result: |
| 110 | + runs-on: ubuntu-latest |
| 111 | + needs: |
| 112 | + - accuracy-tests |
| 113 | + - code_quality_checks |
| 114 | + - unit-functional-tests |
| 115 | + if: always() |
| 116 | + steps: |
| 117 | + - name: All tests ok |
| 118 | + if: ${{ !(contains(needs.*.result, 'failure')) }} |
| 119 | + run: exit 0 |
| 120 | + |
| 121 | + - name: Some tests failed |
| 122 | + if: ${{ contains(needs.*.result, 'failure') }} |
| 123 | + run: exit 1 |
0 commit comments