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