-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (93 loc) · 2.65 KB
/
ci.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: ci
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# manual
workflow_dispatch:
env:
PRE_COMMIT_CACHE: ~/.cache/pre-commit
UV_VERSION: 0.4.25
jobs:
tox-precommit:
strategy:
fail-fast: false
matrix:
python-version:
- "3.11"
os: [ubuntu-latest]
env:
- TOXENV: "pre-commit"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Configure Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: ${{ env.UV_VERSION }}
enable-cache: true
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox==4.18.1 tox-gh
- name: Cache pre-commit
uses: actions/cache@v4
with:
path: ${{ env.PRE_COMMIT_CACHE }}
key: ${{ matrix.os }}-${{ matrix.python-version }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Run tox
run: |
tox
shell: bash
env: ${{ matrix.env }}
tox-tests:
strategy:
fail-fast: false
matrix:
python-version:
- "3.10"
- "3.11"
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Configure Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: ${{ env.UV_VERSION }}
enable-cache: true
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox==4.18.1 tox-gh
- name: Cache tox env
uses: actions/cache@v4
with:
path: .tox
key: ${{ matrix.os }}-${{ matrix.python-version }}-tox-${{ hashFiles('pyproject.toml', 'uv.lock') }}
- name: Set tox env (for tox + codecov)
run: |
MATRIX_PYTHON_VERSION=${{matrix.python-version}}
echo "TOXENV=py${MATRIX_PYTHON_VERSION/./}" >> $GITHUB_ENV
- name: Run tox
run: |
tox -p
env:
TOXENV: ${{ env.TOXENV }}
- name: Upload to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./.tox/.coverage.${{ env.TOXENV }}.xml
verbose: true
fail_ci_if_error: true
flags: "${{ env.TOXENV }}"