Skip to content

Commit

Permalink
CI: add self-hosted CUDA runners
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Mar 28, 2024
1 parent fa47153 commit fc127dd
Showing 1 changed file with 47 additions and 1 deletion.
48 changes: 47 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,52 @@ on:
pull_request:
branches: [master]
jobs:
test-cuda:
defaults: {run: {shell: 'bash -el {0}'}}
runs-on: [self-hosted, python, cuda]
strategy:
matrix:
python-version: [3.9]
numpy-version: [1.22]
steps:
- uses: actions/checkout@v4
with: {fetch-depth: 0, submodules: recursive}
- id: reqs
name: set requirements
run: |
envname="${GITHUB_REPOSITORY##*/}-${GITHUB_RUN_ID}.${GITHUB_RUN_NUMBER}"
echo "envname=$envname" >> $GITHUB_OUTPUT
envfile="/tmp/$envname.yml"
cat << EOF > "$envfile"
name: '$envname'
channels: [conda-forge, defaults]
dependencies: [python]
EOF
echo "envfile=$envfile" >> $GITHUB_OUTPUT
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python-version }}
environment-file: ${{ steps.reqs.outputs.envfile }}
activate-environment: ${{ steps.reqs.outputs.envname }}
run-post: false
- id: build
name: build
run: |
conda activate "${{ steps.reqs.outputs.envname }}"
cmake -S . -B ./build_proj -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_MATLAB_WRAPPER=OFF -DBUILD_PYTHON_WRAPPER=ON -DBUILD_CUDA=ON -DCMAKE_INSTALL_PREFIX=./install
cmake --build ./build_proj --target install
pip install ./src/Python
- name: test
run: |
conda activate "${{ steps.reqs.outputs.envname }}"
PYTHONPATH=./src/Python python -m unittest discover ./test
- if: always()
name: Post Run conda-incubator/setup-miniconda@v3
run: |
conda deactivate
rm "$envfile"
conda env remove -n "${{ steps.reqs.outputs.envname }}"
sed -i '/${{ steps.reqs.outputs.envname }}/d' ~/.profile
test:
defaults: {run: {shell: 'bash -el {0}'}}
runs-on: ubuntu-latest
Expand Down Expand Up @@ -57,6 +103,6 @@ jobs:
name: ccpi-regulariser-package
path: recipe/linux-64/ccpi-regulariser*
pass:
needs: [test, conda]
needs: [test-cuda, test, conda]
runs-on: ubuntu-latest
steps: [{run: echo success}]

0 comments on commit fc127dd

Please sign in to comment.