forked from scikit-bio/scikit-bio
-
Notifications
You must be signed in to change notification settings - Fork 0
236 lines (226 loc) · 7.66 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
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
name: CI
on:
push:
branches: [ main ]
paths-ignore: ["web/**", "**.md", "README.rst"]
pull_request:
branches: [ main ]
paths-ignore: ["web/**", "**.md", "README.rst"]
env:
latest_python: "3.12"
supported_pythons: '["3.8", "3.9", "3.10", "3.11", "3.12"]'
miniforge_version: "23.11.0-0"
miniforge_variant: "Mambaforge"
jobs:
conf:
# This job is needed to route the global environment variables into
# a context that's available for matrix (and name, but that's unimportant)
name: Prepare Test Plan
runs-on: ubuntu-latest
outputs:
latest_python: ${{ steps.set-vars.outputs.latest_python }}
supported_pythons: ${{ steps.set-vars.outputs.supported_pythons }}
steps:
- name: Report Plan
id: set-vars
run: |
echo "latest_python=$latest_python" >> $GITHUB_OUTPUT
echo "supported_pythons=$supported_pythons" >> $GITHUB_OUTPUT
lint:
name: Lint code (${{ needs.conf.outputs.latest_python }}, ubuntu-latest)
needs: conf
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: ${{ env.latest_python }}
miniforge-version: ${{ env.miniforge_version }}
miniforge-variant: ${{ env.miniforge_variant }}
environment-file: ci/conda_host_env.yml
- name: Install dependencies
run: |
pip install -r ci/requirements.lint.txt
conda list
- name: Run Ruff
run: |
ruff check --output-format=github .
doc:
name: Build Documentation (${{ needs.conf.outputs.latest_python }}, ubuntu-latest)
needs: ["conf", "lint"]
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: ${{ env.latest_python }}
miniforge-version: ${{ env.miniforge_version }}
miniforge-variant: ${{ env.miniforge_variant }}
environment-file: ci/conda_host_env.yml
- name: Install dependencies
run: |
pip install -r ci/requirements.doc.txt
pip install .
conda list
- name: Make documentation
run: make doc
# save built documentation (HTML) for deployment
- name: Substitute URLs
if: github.event_name == 'push'
run: python doc/suburl.py
- name: Save documentation
if: github.event_name == 'push'
uses: actions/upload-artifact@v4
with:
name: docpack
path: doc/build/html/
# full-scale test (including Cython) with latest Python
test-cython:
name: Test Cython (${{ needs.conf.outputs.latest_python }}, ${{ matrix.os }})
needs: conf
runs-on: ${{ matrix.os }}
env:
USE_CYTHON: TRUE
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: true
matrix:
os: ["ubuntu-latest", "macos-latest"]
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: ${{ env.latest_python }}
miniforge-version: ${{ env.miniforge_version }}
miniforge-variant: ${{ env.miniforge_variant }}
environment-file: ci/conda_host_env.yml
- name: Install dependencies
run: |
pip install .
conda list
- name: Run unit tests
env:
WITH_COVERAGE: "TRUE"
run: make test
# upload coverage reports to Codecov (only under Linux)
- name: Generate coverage reports
if: runner.os == 'Linux'
run: |
cd ci && coverage lcov --rcfile ../.coveragerc
- name: Upload coverage reports to Codecov
if: runner.os == 'Linux'
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: scikit-bio/scikit-bio
# test under AArch64 (ARM64) architecture
test-cython-aarch64:
name: Test Cython (${{ needs.conf.outputs.latest_python }}, qemu::aarch64-centos)
needs: conf
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# setup-buildx-action uses the git context directly
# but checklist wants the .git directory
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and test for linux-aarch64
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
# ^ to use the local checkout, not the git context
file: aarch64.Dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
PYTHON_VERSION=${{ env.latest_python }}
# test under all combinations of environments (Python versions, operating systems, PyPI vs Conda)
test-all:
name: Test (${{ matrix.python_version }}, ${{ matrix.os }}, ${{ fromJSON('["pypi", "conda"]')[matrix.use_conda] }})
runs-on: ${{ matrix.os }}
needs: ["conf", "test-cython", "lint"]
# not testing Cython here, whether the Cython compiles to C is tested above
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest"]
python_version: ${{ fromJSON(needs.conf.outputs.supported_pythons) }}
use_conda: [true, false]
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: ${{ env.latest_python }}
miniforge-version: ${{ env.miniforge_version }}
miniforge-variant: ${{ env.miniforge_variant }}
environment-file: ci/conda_host_env.yml
- name: Install dependencies (conda)
if: ${{ matrix.use_conda }}
run: |
conda install -q --yes -c conda-forge --file ci/conda_requirements.txt
pip install . --no-deps
conda list
- name: Install dependencies
if: ${{ !matrix.use_conda }}
run: |
pip install .
conda list
- name: Run unit tests
env:
WITH_COVERAGE: "TRUE"
run: make test
# deploy the current development documentation to the website
# only when event is push and all tests have passed
deploy-doc:
name: Deploy documentation
if: github.event_name == 'push'
needs: ["doc", "test-all", "test-cython-aarch64"]
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
# load documentation built by job "doc"
- name: Load documentation
uses: actions/download-artifact@v4
with:
name: docpack
path: docpack
# checkout website repo
- name: Check out website
uses: actions/checkout@v4
with:
repository: scikit-bio/scikit-bio.github.io
path: website
ssh-key: ${{ secrets.SSH_DEPLOY_KEY }}
# synchronize documentation to website's docs/dev directory
- name: Update documentation
run: rsync -av --delete docpack/ website/docs/dev
# push website back to repo
- name: Push website
run: |
cd website
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
git add -A
git commit -m "Update from ${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}"
git push