-
Notifications
You must be signed in to change notification settings - Fork 8
87 lines (69 loc) · 2.04 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
# This file invokes Nox sessions to run tests, build documentation, and
# perform other continuous integration (CI) checks. The Nox sessions are
# defined in noxfile.py.
name: CI
on:
push:
branches:
- main
- stable
- v*.*.*
tags:
- v*
pull_request:
workflow_dispatch:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
tests:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
- name: Tests, Python 3.12, Ubuntu
os: ubuntu-latest
python: '3.12'
nox_session: tests
- name: Documentation, Python 3.12, Ubuntu
os: ubuntu-latest
python: '3.12'
nox_session: docs
- name: Packaging, Python 3.12, Ubuntu
os: ubuntu-latest
python: '3.12'
nox_session: build
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: pip
- name: Install graphviz and pandoc for documentation builds
if: startsWith(matrix.name, 'Documentation')
run: sudo apt-get install graphviz pandoc
- name: Install Nox and uv
run: python -m pip install --progress-bar off --upgrade nox uv
- name: Cache .nox to shorten virtual environment creation time
uses: actions/cache@v4
with:
path: |
.nox
# Changing pyproject.toml or requirements invalidates the cache
key: ${{ matrix.nox_session }}-${{ matrix.python }}-${{ runner.os }}-${{ hashFiles('pyproject.toml') }}
- name: Run Nox session
run: nox -s '${{ matrix.nox_session }}'
- name: Upload coverage reports to Codecov
if: ${{ contains(matrix.nox_session, 'cov') }}
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}