-
Notifications
You must be signed in to change notification settings - Fork 3
60 lines (60 loc) · 1.87 KB
/
Copy pathunit_tests.yml
File metadata and controls
60 lines (60 loc) · 1.87 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
name: unit tests
permissions:
contents: read
id-token: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- "**"
paths:
- "src/undate/**"
- "tests/**"
- "pyproject.toml"
- "uv.lock"
pull_request:
branches:
- "**"
env:
# python version used to calculate and submit code coverage
COV_PYTHON_VERSION: "3.12"
# Prevent uv from including develop dependencies by default
UV_NO_DEV: 1
# Prevent uv run from syncing by default
UV_NO_SYNC: 1
jobs:
python-unit:
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
defaults:
run:
working-directory: .
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python }}
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
with:
python-version: ${{ matrix.python }}
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Install package with check dependencies
run: uv sync --group test
# for all versions but the one we use for code coverage, run normally
- name: Run unit tests without code coverage
run: uv run pytest
if: ${{ matrix.python != env.COV_PYTHON_VERSION }}
# run code coverage in one version only
- name: Run unit tests with code coverage reporting
run: uv run pytest --cov=.
if: ${{ matrix.python == env.COV_PYTHON_VERSION }}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@0fb7174895f61a3b6b78fc075e0cd60383518dac # v5.5.5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
if: ${{ matrix.python == env.COV_PYTHON_VERSION }}