-
Notifications
You must be signed in to change notification settings - Fork 13
95 lines (85 loc) · 2.56 KB
/
unit_tests.yml
File metadata and controls
95 lines (85 loc) · 2.56 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
name: unit tests
on:
push:
branches:
- main
- develop
paths:
- .pre-commit-config.yaml
- .github/workflows/code_checks.yml
- .github/workflows/docs_build.yml
- .github/workflows/docs_deploy.yml
- .github/workflows/unit_tests.yml
- .github/workflows/integration_tests.yml
- '**.py'
- '**.ipynb'
- uv.lock
- pyproject.toml
- '**.rst'
- '**.md'
pull_request:
branches:
- main
- develop
paths:
- .pre-commit-config.yaml
- .github/workflows/code_checks.yml
- .github/workflows/docs_build.yml
- .github/workflows/docs_deploy.yml
- .github/workflows/unit_tests.yml
- .github/workflows/integration_tests.yml
- '**.py'
- '**.ipynb'
- uv.lock
- pyproject.toml
- '**.rst'
- '**.md'
jobs:
unit-tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v6.0.2
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
# Install a specific version of uv.
version: "0.5.21"
enable-cache: true
- name: "Set up Python ${{ matrix.python-version }}"
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install the project
env:
# Ensure uv uses the matrix interpreter instead of `.python-version` (3.10),
# otherwise the "3.11"/"3.12" jobs silently run on 3.10.
UV_PYTHON: ${{ matrix.python-version }}
run: uv sync --dev --prerelease=allow
- name: Install dependencies and check code
env:
UV_PYTHON: ${{ matrix.python-version }}
run: |
uv run --frozen pytest -m "not integration_test" --cov vec_inf --cov-report=xml tests
- name: Install the core package only
env:
UV_PYTHON: ${{ matrix.python-version }}
run: uv sync --no-dev
- name: Run package import tests
env:
UV_PYTHON: ${{ matrix.python-version }}
run: |
uv run --frozen pytest tests/test_imports.py
- name: Import Codecov GPG public key
run: |
gpg --keyserver keyserver.ubuntu.com --recv-keys 806BB28AED779869
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v6.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
name: codecov-umbrella
fail_ci_if_error: true
verbose: true