-
Notifications
You must be signed in to change notification settings - Fork 7
83 lines (69 loc) · 2.14 KB
/
test.yml
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
name: Test
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
test:
env:
UV_CACHE_DIR: /tmp/.uv-cache
strategy:
fail-fast: false
matrix:
python-version:
- "3.12"
os:
- ubuntu-latest
- windows-latest
- macos-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up uv
if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' }}
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Set up uv
if: ${{ matrix.os == 'windows-latest' }}
run: irm https://astral.sh/uv/install.ps1 | iex
shell: powershell
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Restore uv cache
uses: actions/cache@v4
if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' }}
with:
path: /tmp/.uv-cache
key: uv-${{ runner.os }}-${{ hashFiles('back/uv.lock') }}
restore-keys: |
uv-${{ runner.os }}-${{ hashFiles('back/uv.lock') }}
uv-${{ runner.os }}
- name: Install the project dependencies
run: |
cd back
uv sync --all-extras --dev
- name: Lint
run: |
cd back
uv run ruff check src tests
- name: "Create cache key for documentation"
if: ${{ matrix.os == 'ubuntu-latest' }}
run: echo "$PWD/back/.venv/bin" >> $GITHUB_PATH
- name: Check types
uses: jakebailey/pyright-action@v2
with:
working-directory: back/
extra-args: src
- name: Run tests
run: |
cd back
uv run pytest --cov=src/whombat --cov-report=xml -n auto
- name: Upload coverage reports to Codecov
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: codecov/codecov-action@v4
env:
files: back/coverage.xml
fail_ci_if_error: true
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Minimize uv cache
run: uv cache prune --ci