-
Notifications
You must be signed in to change notification settings - Fork 5
72 lines (67 loc) · 2.18 KB
/
Copy pathtests.yml
File metadata and controls
72 lines (67 loc) · 2.18 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
name: tests
on:
push:
# Branches only: on a v* tag this workflow runs via release.yml's
# `checks` job instead, so it is not run twice for one push.
branches: ["**"]
pull_request:
# Called by release.yml as the tests gate on a v* tag.
workflow_call:
concurrency:
group: check-${{ github.ref }}
cancel-in-progress: true
jobs:
linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: uv sync --all-extras
- name: Run linters
run: |
uv run ruff check .
uv run ruff format --check .
test:
needs: linting
strategy:
fail-fast: false
matrix:
os: [ "ubuntu-latest" ]
python-version: [ "3.10", "3.11", "3.12", "3.13", "3.14" ]
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --all-extras
- name: Configure git
run: |
git config --global user.email "ci@20c.com"
git config --global user.name "CI Runner"
- name: Run tests
run: |
uv run pytest --cov=src --cov-report=xml --cov-report=term-missing
# upload coverage stats — strict on branch and PR runs, but NOT on the
# release path: this workflow is also release.yml's `checks` gate on a
# v* tag, and a Codecov outage or an expired token must not strand a
# publish for a tag that is already public. (`github.event_name` is the
# caller's event inside a called workflow, so the ref type is the test.)
- name: Upload coverage
if: github.ref_type != 'tag'
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true