Skip to content

Commit ffc30b6

Browse files
committed
Switches to conda for cuda requirements
1 parent 9472b94 commit ffc30b6

File tree

3 files changed

+45
-8
lines changed

3 files changed

+45
-8
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ jobs:
4141
run: |
4242
envname="${GITHUB_REPOSITORY##*/}-${GITHUB_RUN_ID}.${GITHUB_RUN_NUMBER}"
4343
echo "envname=$envname" >> $GITHUB_OUTPUT
44-
sed -ri -e 's/^(name: ).*/\1$envname/' -e '/ python /d' -e 's/(.* numpy) .*/\1=${{ matrix.numpy-version }}/' scripts/requirements-test.yml
4544
- uses: conda-incubator/setup-miniconda@v3
4645
with:
4746
python-version: ${{ matrix.python-version }}

.github/workflows/build_uv.yml

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ on:
2222
- 'NOTICE.txt'
2323
- 'README.md'
2424
jobs:
25-
test-cuda:
25+
uv-test-cuda:
2626
defaults: {run: {shell: 'bash -el {0}'}}
2727
runs-on: [self-hosted, python, cuda]
2828
strategy:
@@ -32,22 +32,40 @@ jobs:
3232
steps:
3333
- uses: actions/checkout@v4
3434
with: {fetch-depth: 0, submodules: recursive}
35-
- name: Set up CUDA
36-
uses: Jimver/cuda-toolkit@master
37-
id: cuda-toolkit
3835
- name: Install uv
3936
uses: astral-sh/setup-uv@v5
4037
with:
4138
version: "0.6.5"
39+
- id: reqs
40+
name: set requirements
41+
run: |
42+
envname="${GITHUB_REPOSITORY##*/}-${GITHUB_RUN_ID}.${GITHUB_RUN_NUMBER}"
43+
echo "envname=$envname" >> $GITHUB_OUTPUT
44+
- uses: conda-incubator/setup-miniconda@v3
45+
with:
46+
python-version: ${{ matrix.python-version }}
47+
environment-file: scripts/requirements-cuda.yml
48+
activate-environment: ${{ steps.reqs.outputs.envname }}
49+
run-post: false
4250
- name: "Set up Python"
4351
uses: actions/setup-python@v5
4452
with:
4553
python-version: ${{ matrix.python-version }}
4654
- name: "Install Project"
47-
run: uv sync --dev --all-extras
55+
run: |
56+
conda activate "${{ steps.reqs.outputs.envname }}"
57+
conda install conda-forge::cudatoolkit-dev=11.7.0
58+
uv sync --dev --all-extras
4859
- name: test
4960
run: CIL_DATA_DIR=./Wrappers/Python/data uv run --dev python -m unittest discover -v -k tigre -k TIGRE -k astra -k ASTRA -k gpu -k GPU ./Wrappers/Python/test
50-
test:
61+
- if: always()
62+
name: Post Run conda-incubator/setup-miniconda@v3
63+
shell: bash
64+
run: |
65+
sed -i '/${{ steps.reqs.outputs.envname }}/d' ~/.profile
66+
source ~/.profile
67+
conda env remove -n "${{ steps.reqs.outputs.envname }}"
68+
uv-test:
5169
defaults: {run: {shell: 'bash -el {0}'}}
5270
runs-on: ubuntu-22.04
5371
strategy:
@@ -72,6 +90,6 @@ jobs:
7290
- name: test
7391
run: CIL_DATA_DIR=./Wrappers/Python/data uv run --dev python -m unittest discover -v ./Wrappers/Python/test
7492
pass:
75-
needs: [test-cuda, test]
93+
needs: [uv-test-cuda, uv-test]
7694
runs-on: ubuntu-22.04
7795
steps: [{run: echo success}]

scripts/requirements-cuda.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright 2023 United Kingdom Research and Innovation
2+
# Copyright 2023 The University of Manchester
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS,
9+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
# See the License for the specific language governing permissions and
11+
# limitations under the License.
12+
# Authors:
13+
# CIL Developers, listed at: https://github.com/TomographicImaging/CIL/blob/master/NOTICE.txt
14+
name: cuda_dev
15+
channels:
16+
- conda-forge
17+
#- nvidia
18+
dependencies:
19+
# base (vis. recipe/conda_build_config.yaml)
20+
- python >=3.10

0 commit comments

Comments
 (0)