Skip to content

Commit e987eab

Browse files
authored
Merge pull request #196 from TomographicImaging/gha-ci-cuda
CI: add self-hosted CUDA runners
2 parents fa47153 + 620c9b8 commit e987eab

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

.github/workflows/build.yml

+39-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,44 @@ on:
88
pull_request:
99
branches: [master]
1010
jobs:
11+
test-cuda:
12+
defaults: {run: {shell: 'bash -el {0}'}}
13+
runs-on: [self-hosted, python, cuda]
14+
strategy:
15+
matrix:
16+
python-version: [3.9]
17+
numpy-version: [1.22]
18+
steps:
19+
- uses: actions/checkout@v4
20+
with: {fetch-depth: 0, submodules: recursive}
21+
- id: reqs
22+
name: set requirements
23+
run: |
24+
envname="${GITHUB_REPOSITORY##*/}-${GITHUB_RUN_ID}.${GITHUB_RUN_NUMBER}"
25+
echo "envname=$envname" >> $GITHUB_OUTPUT
26+
- uses: conda-incubator/setup-miniconda@v3
27+
with:
28+
python-version: ${{ matrix.python-version }}
29+
activate-environment: ${{ steps.reqs.outputs.envname }}
30+
run-post: false
31+
- id: build
32+
name: build
33+
run: |
34+
conda activate "${{ steps.reqs.outputs.envname }}"
35+
which cmake || conda install -yq cmake
36+
cmake -S . -B ./build_proj -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_MATLAB_WRAPPER=OFF -DBUILD_PYTHON_WRAPPER=ON -DBUILD_CUDA=ON -DCMAKE_INSTALL_PREFIX=./install
37+
cmake --build ./build_proj --target install
38+
pip install ./src/Python
39+
- name: test
40+
run: |
41+
conda activate "${{ steps.reqs.outputs.envname }}"
42+
PYTHONPATH=./src/Python python -m unittest discover ./test
43+
- if: always()
44+
name: Post Run conda-incubator/setup-miniconda@v3
45+
run: |
46+
conda deactivate
47+
sed -i '/${{ steps.reqs.outputs.envname }}/d' ~/.profile
48+
conda env remove -n "${{ steps.reqs.outputs.envname }}"
1149
test:
1250
defaults: {run: {shell: 'bash -el {0}'}}
1351
runs-on: ubuntu-latest
@@ -57,6 +95,6 @@ jobs:
5795
name: ccpi-regulariser-package
5896
path: recipe/linux-64/ccpi-regulariser*
5997
pass:
60-
needs: [test, conda]
98+
needs: [test-cuda, test, conda]
6199
runs-on: ubuntu-latest
62100
steps: [{run: echo success}]

0 commit comments

Comments
 (0)