-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (78 loc) · 2.3 KB
/
unit_test.yml
File metadata and controls
93 lines (78 loc) · 2.3 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
name: Unit Test CI
permissions:
contents: read
packages: read
actions: read
pull-requests: write
on:
pull_request:
branches:
- main
- v*
types:
- opened
- synchronize
- reopened
- review_requested
- assigned
push:
branches:
- main
- v*
paths:
- "src/**"
- "tests/**"
- ".github/workflows/unit_test.yml"
- "pyproject.toml"
- "uv.lock"
workflow_dispatch:
jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout commit
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version-file: ".python-version"
- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
- name: Install dependencies
run: uv sync --dev
- name: Run ruff check
run: uv run ruff check .
- name: Run ruff format check
run: uv run ruff format --check .
pytest:
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
python-version: ["3.13"]
steps:
- name: Checkout commit
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0 # sonarcloud needs full git histories
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
- name: Install dependencies
run: uv sync --dev
- name: Run pytest with coverage
run: |
mkdir -p test_result
uv run coverage run -m pytest --junit-xml=test_result/pytest.xml
uv run coverage xml -o test_result/coverage.xml
- name: Generate coverage report
run: uv run coverage report -m
- name: SonarCloud Scan
uses: SonarSource/sonarqube-scan-action@299e4b793aaa83bf2aba7c9c14bedbb485688ec4 # v7.1.0
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}