-
Notifications
You must be signed in to change notification settings - Fork 0
167 lines (140 loc) · 4.41 KB
/
rhiza_ci.yml
File metadata and controls
167 lines (140 loc) · 4.41 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
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# This file is part of the jebel-quant/rhiza repository
# (https://github.com/jebel-quant/rhiza).
#
# Workflow: Continuous Integration
#
# Purpose: Run tests on multiple Python versions to ensure compatibility.
#
# Trigger: On push and pull requests to main/master branches.
name: (RHIZA) CI
permissions:
contents: read
actions: read
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
jobs:
generate-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.versions.outputs.list }}
steps:
- uses: actions/checkout@v6.0.2
with:
lfs: true
- name: Install uv
uses: astral-sh/setup-uv@v7.6.0
with:
version: "0.10.11"
- name: Configure git auth for private packages
uses: ./.github/actions/configure-git-auth
with:
token: ${{ secrets.GH_PAT }}
- id: versions
env:
UV_EXTRA_INDEX_URL: ${{ secrets.UV_EXTRA_INDEX_URL }}
run: |
# Generate Python versions JSON from the script
JSON=$(make -f .rhiza/rhiza.mk -s version-matrix)
echo "list=$JSON" >> "$GITHUB_OUTPUT"
- name: Debug matrix
run: |
echo "Python versions: ${{ steps.versions.outputs.list }}"
test:
needs: generate-matrix
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v6.0.2
with:
lfs: true
- name: Install uv
uses: astral-sh/setup-uv@v7.6.0
with:
version: "0.10.11"
python-version: ${{ matrix.python-version }}
- name: Configure git auth for private packages
uses: ./.github/actions/configure-git-auth
with:
token: ${{ secrets.GH_PAT }}
- name: Run tests
env:
UV_EXTRA_INDEX_URL: ${{ secrets.UV_EXTRA_INDEX_URL }}
run: |
make test
- name: Upload coverage report
if: matrix.python-version == '3.12'
uses: actions/upload-artifact@v7
with:
name: coverage-report
path: _tests/coverage.xml
if-no-files-found: ignore
docs-coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6.0.2
- name: Install uv
uses: astral-sh/setup-uv@v7.6.0
with:
version: "0.10.11"
- name: Configure git auth for private packages
uses: ./.github/actions/configure-git-auth
with:
token: ${{ secrets.GH_PAT }}
- name: Check docs coverage
env:
UV_EXTRA_INDEX_URL: ${{ secrets.UV_EXTRA_INDEX_URL }}
run: |
make docs-coverage
coverage-badge:
needs: test
runs-on: ubuntu-latest
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v6.0.2
with:
token: ${{ secrets.GH_PAT || github.token }}
- name: Install uv
uses: astral-sh/setup-uv@v7.6.0
with:
version: "0.10.11"
- name: Download coverage report
id: download-coverage
continue-on-error: true
uses: actions/download-artifact@v8
with:
name: coverage-report
path: _tests/
- name: Generate coverage badge
if: steps.download-coverage.outcome == 'success'
run: |
uvx "genbadge[coverage]" coverage -i _tests/coverage.xml -o /tmp/coverage-badge.svg
- name: Push badge to gh-pages
if: steps.download-coverage.outcome == 'success'
run: |
git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
if git fetch origin gh-pages 2>/dev/null; then
git checkout gh-pages
else
git checkout --orphan gh-pages
git rm -rf .
fi
cp /tmp/coverage-badge.svg coverage-badge.svg
git add coverage-badge.svg
if ! git diff --staged --quiet; then
git commit -m "chore: update coverage badge [skip ci]"
git push origin gh-pages
else
echo "Coverage badge unchanged, skipping push"
fi