22
22
- ' NOTICE.txt'
23
23
- ' README.md'
24
24
jobs :
25
- test-cuda :
26
- defaults : {run: {shell: 'bash -el {0}'}}
27
- runs-on : [self-hosted, python, cuda]
28
- strategy :
29
- matrix :
30
- python-version : [3.11]
31
- numpy-version : [1.25]
32
- steps :
33
- - uses : actions/checkout@v4
34
- with : {fetch-depth: 0, submodules: recursive}
35
- - id : reqs
36
- name : set requirements
37
- run : |
38
- envname="${GITHUB_REPOSITORY##*/}-${GITHUB_RUN_ID}.${GITHUB_RUN_NUMBER}"
39
- echo "envname=$envname" >> $GITHUB_OUTPUT
40
- sed -ri -e 's/^(name: ).*/\1$envname/' -e '/ python /d' -e 's/(.* numpy) .*/\1=${{ matrix.numpy-version }}/' scripts/requirements-test.yml
41
- - uses : conda-incubator/setup-miniconda@v3
42
- with :
43
- python-version : ${{ matrix.python-version }}
44
- environment-file : scripts/requirements-test.yml
45
- activate-environment : ${{ steps.reqs.outputs.envname }}
46
- run-post : false
47
- - id : build
48
- name : build
49
- run : |
50
- conda activate "${{ steps.reqs.outputs.envname }}"
51
- cmake -S . -B ./build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCONDA_BUILD=ON -DCMAKE_INSTALL_PREFIX="$CONDA_PREFIX"
52
- cmake --build ./build --target install
53
- - name : test
54
- run : |
55
- conda activate "${{ steps.reqs.outputs.envname }}"
56
- TESTS_FORCE_GPU=1 python -m unittest discover -v -k tigre -k TIGRE -k astra -k ASTRA -k gpu -k GPU ./Wrappers/Python/test
57
- - if : always()
58
- name : Post Run conda-incubator/setup-miniconda@v3
59
- shell : bash
60
- run : |
61
- sed -i '/${{ steps.reqs.outputs.envname }}/d' ~/.profile
62
- source ~/.profile
63
- conda env remove -n "${{ steps.reqs.outputs.envname }}"
64
25
test :
65
26
defaults : {run: {shell: 'bash -el {0}'}}
66
27
runs-on : ${{ matrix.os }}-latest
67
28
strategy :
68
29
matrix :
69
30
include :
70
- - python-version : ' 3.10'
71
- numpy-version : 1.23
72
- os : ubuntu
73
- - python-version : 3.12
74
- numpy-version : 1.26
75
- os : ubuntu
76
31
- python-version : 3.12
77
32
numpy-version : 1.26
78
33
os : macos
@@ -99,182 +54,3 @@ jobs:
99
54
cmake --build ./build --target install
100
55
- name : test
101
56
run : python -m unittest discover -v ./Wrappers/Python/test
102
- conda-matrix :
103
- runs-on : ubuntu-latest
104
- outputs :
105
- python-version : ${{ steps.matrix.outputs.python-version }}
106
- numpy-version : ${{ steps.matrix.outputs.numpy-version }}
107
- steps :
108
- - id : matrix
109
- run : |
110
- if ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags') }}; then
111
- echo "python-version=['3.10', 3.11]" >> $GITHUB_OUTPUT
112
- echo "numpy-version=[1.23, 1.24, 1.25, 1.26]" >> $GITHUB_OUTPUT
113
- else
114
- echo "python-version=['3.10']" >> $GITHUB_OUTPUT
115
- echo "numpy-version=[1.23]" >> $GITHUB_OUTPUT
116
- fi
117
- conda :
118
- defaults : {run: {shell: 'bash -el {0}'}}
119
- runs-on : ubuntu-latest
120
- needs : conda-matrix
121
- strategy :
122
- matrix :
123
- python-version : ${{ fromJson(needs.conda-matrix.outputs.python-version) }}
124
- numpy-version : ${{ fromJson(needs.conda-matrix.outputs.numpy-version) }}
125
- include :
126
- - python-version : 3.12
127
- numpy-version : 1.26
128
- steps :
129
- - uses : actions/checkout@v4
130
- with :
131
- fetch-depth : 0
132
- submodules : recursive
133
- ref : ${{ github.event.pull_request.head.sha || github.ref }} # fix SHA
134
- - uses : conda-incubator/setup-miniconda@v3
135
- with :
136
- python-version : ${{ matrix.python-version }}
137
- mamba-version : " 1.5"
138
- channels : conda-forge
139
- - name : conda build & test
140
- working-directory : recipe
141
- run : |
142
- conda install boa
143
- conda mambabuild . -c conda-forge -c https://tomography.stfc.ac.uk/conda --override-channels --python=${{ matrix.python-version }} --numpy=${{ matrix.numpy-version }} --output-folder .
144
- - uses : actions/upload-artifact@v4
145
- with :
146
- name : cil-package-py${{ matrix.python-version }}-np${{ matrix.numpy-version }}
147
- path : recipe/linux-64/cil*
148
- - name : anaconda upload -c ccpi
149
- if : github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags')
150
- run : |
151
- conda install anaconda-client
152
- anaconda -v -t ${{ secrets.CCPI_CONDA_TOKEN }} upload --force --label ${{ startsWith(github.ref, 'refs/tags') && 'main' || 'dev' }} recipe/linux-64/cil*
153
- - name : conda upload -c tomography.stfc.ac.uk/conda
154
- if : startsWith(github.ref, 'refs/tags')
155
- run : |
156
- echo '${{ secrets.STFC_SSH_KEY }}' > ./key
157
- chmod 600 ./key
158
- rsync -e 'ssh -o StrictHostKeyChecking=no -i ./key' -P recipe/linux-64/cil* \
159
- '${{ secrets.STFC_SSH_HOST }}:${{ secrets.STFC_SSH_CONDA_DIR }}/linux-64/'
160
- conda-reindex :
161
- if : startsWith(github.ref, 'refs/tags')
162
- needs : conda
163
- runs-on : ubuntu-latest
164
- steps :
165
- - name : conda index tomography.stfc.ac.uk/conda
166
- run : |
167
- echo '${{ secrets.STFC_SSH_KEY }}' > ./key
168
- chmod 600 ./key
169
- ssh -o StrictHostKeyChecking=no -i ./key ${{ secrets.STFC_SSH_HOST }} \
170
- 'bash -lic "conda index --bz2 --zst --run-exports --channeldata --rss -n ccpi ${{ secrets.STFC_SSH_CONDA_DIR }}"'
171
- docs :
172
- defaults : {run: {shell: 'bash -el {0}', working-directory: docs}}
173
- runs-on : ubuntu-latest
174
- steps :
175
- - uses : actions/checkout@v4
176
- with :
177
- fetch-depth : 0
178
- submodules : recursive
179
- ref : ${{ github.event.pull_request.head.sha || github.ref }} # fix SHA
180
- - uses : conda-incubator/setup-miniconda@v3
181
- with : {python-version: 3.11}
182
- - uses : ruby/setup-ruby@v1
183
- with :
184
- ruby-version : ' 3.2'
185
- bundler-cache : true
186
- cache-version : 0
187
- - name : install dependencies
188
- run : |
189
- conda install -c conda-forge -yq conda-merge
190
- conda-merge ../scripts/requirements-test.yml docs_environment.yml > environment.yml
191
- conda env update -n test
192
- conda list
193
- - name : build cil
194
- working-directory : .
195
- run : |
196
- cmake -S . -B ./build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCONDA_BUILD=ON -DCMAKE_INSTALL_PREFIX="$CONDA_PREFIX"
197
- cmake --build ./build --target install
198
- - name : checkout docs
199
- uses : actions/checkout@v4
200
- with :
201
- path : docs/build
202
- ref : gh-pages
203
- - id : pages
204
- uses : actions/configure-pages@v5
205
- - name : update web pages (jekyll)
206
- run : make JEKYLLOPTS="--baseurl ${{ steps.pages.outputs.base_path }}" web-deps web
207
- env : {JEKYLL_ENV: production}
208
- - name : update docs pages (sphinx)
209
- run : |
210
- docs_dir="${{ github.ref_name }}"
211
- docs_dir="${docs_dir//\//_}"
212
- if test "$docs_dir" = master; then docs_dir=nightly; fi
213
- make BUILDSUBDIR="$docs_dir" dirhtml
214
- - uses : actions/upload-artifact@v4
215
- with :
216
- name : DocumentationHTML
217
- path : docs/build
218
- - name : Push changes
219
- if : github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags')
220
- uses : casperdcl/push-dir@v1
221
- with :
222
- message : Update documentation
223
- branch : gh-pages
224
- dir : docs/build
225
- nojekyll : true
226
- docker :
227
- runs-on : ubuntu-latest
228
- permissions :
229
- contents : read
230
- packages : write
231
- steps :
232
- - uses : actions/checkout@v4
233
- with :
234
- fetch-depth : 0
235
- submodules : recursive
236
- ref : ${{ github.event.pull_request.head.sha || github.ref }} # fix SHA
237
- - uses : jlumbroso/free-disk-space@v1.3.1
238
- with :
239
- docker-images : false
240
- large-packages : false
241
- - uses : docker/setup-buildx-action@v3
242
- - uses : docker/metadata-action@v5
243
- id : meta
244
- with :
245
- images : ghcr.io/${{ github.repository }}
246
- tags : |
247
- type=ref,event=branch
248
- type=semver,pattern={{version}}
249
- type=semver,pattern={{major}}.{{minor}}
250
- labels : |
251
- org.opencontainers.image.licenses=Apache-2.0 AND BSD-3-Clause AND GPL-3.0
252
- - uses : docker/login-action@v3
253
- if : github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags')
254
- with :
255
- registry : ghcr.io
256
- username : ${{ github.actor }}
257
- password : ${{ secrets.GITHUB_TOKEN }}
258
- - uses : docker/build-push-action@v6
259
- with :
260
- cache-from : type=gha
261
- cache-to : type=gha,mode=max
262
- context : .
263
- load : true
264
- tags : tomographicimaging/cil:test
265
- - name : test
266
- run : >
267
- docker run --rm -v .:/CIL tomographicimaging/cil:test /bin/bash -c
268
- 'python -m unittest discover -v /CIL/Wrappers/Python/test'
269
- - uses : docker/build-push-action@v6
270
- with :
271
- cache-from : type=gha
272
- cache-to : type=gha,mode=max
273
- context : .
274
- push : ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags') }}
275
- tags : ${{ steps.meta.outputs.tags }}
276
- labels : ${{ steps.meta.outputs.labels }}
277
- pass :
278
- needs : [test-cuda, test, conda, docs, docker]
279
- runs-on : ubuntu-latest
280
- steps : [{run: echo success}]
0 commit comments