Skip to content

Commit b4cf2d2

Browse files
committed
feat(ci): Split Linux CI workflow and add container images pipeline
Added a new workflow, container_images.yml, to automate building and pushing CI container images to GitHub Container Registry, ensuring consistent environments for CI runs across Linux distributions. Added a dedicated CI workflow for Linux to streamline testing across multiple CUDA and OS configurations. It reuses the images built from container_images.yml workflow to avoid installing CUDA toolkits every time to save time. Key changes: - Matrix configurations for Ubuntu 22/24, RockyLinux 9 with CUDA 12.8.1 - Dockerfiles updated with required dependencies (clang, CUDA toolchains, etc.) to support bindgen and build examples. - Removed redundant CI steps from `rust.yml` now handled in `ci_linux.yml`
1 parent b85d9ca commit b4cf2d2

File tree

9 files changed

+183
-59
lines changed

9 files changed

+183
-59
lines changed

.github/workflows/ci_linux.yml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: CI on Linux
2+
3+
on:
4+
pull_request:
5+
paths-ignore:
6+
- "**.md"
7+
push:
8+
paths-ignore:
9+
- "**.md"
10+
env:
11+
RUST_LOG: info
12+
RUST_BACKTRACE: 1
13+
jobs:
14+
build:
15+
name: ${{ matrix.variance.name }}
16+
runs-on: ubuntu-latest
17+
container:
18+
image: ${{ matrix.variance.image }}
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
variance:
23+
# - name: Ubuntu-22.04/CUDA-11.8.0
24+
# image: "ghcr.io/rust-gpu/rust-cuda-ubuntu22-cuda11:latest"
25+
- name: Ubuntu-22.04/CUDA-12.8.1
26+
image: "ghcr.io/rust-gpu/rust-cuda-ubuntu22-cuda12:latest"
27+
- name: Ubuntu-24.04/CUDA-12.8.1
28+
image: "ghcr.io/rust-gpu/rust-cuda-ubuntu24-cuda12:latest"
29+
- name: RockyLinux-9/CUDA-12.8.1
30+
image: "ghcr.io/rust-gpu/rust-cuda-rockylinux9-cuda12:latest"
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@v4
34+
- name: Verify CUDA, Rust installation
35+
run: |
36+
nvcc --version
37+
rustup show
38+
- name: Load Rust cache
39+
uses: Swatinem/rust-cache@v2
40+
with:
41+
key: ${{ matrix.variance.name }}
42+
- name: Rustfmt
43+
run: cargo fmt --all -- --check
44+
- name: Clippy
45+
env:
46+
RUSTFLAGS: -Dwarnings
47+
run: cargo clippy --workspace --exclude "optix*" --exclude "path_tracer" --exclude "denoiser" --exclude "add" --exclude "ex*" --exclude "cudnn*"
48+
- name: Build
49+
run: cargo build --workspace --exclude "optix*" --exclude "path_tracer" --exclude "denoiser" --exclude "add" --exclude "ex*" --exclude "cudnn*"
50+
- name: Check documentation
51+
env:
52+
RUSTDOCFLAGS: -Dwarnings
53+
run: cargo doc --workspace --all-features --document-private-items --no-deps --exclude "optix*" --exclude "path_tracer" --exclude "denoiser" --exclude "add" --exclude "ex*" --exclude "cudnn*" --exclude "cust_raw"
+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Build CI Container Images
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
paths:
7+
- ".github/workflows/container_images.yml"
8+
- "container/**"
9+
push:
10+
paths:
11+
- ".github/workflows/container_images.yml"
12+
- "container/**"
13+
env:
14+
REGISTRY: ghcr.io
15+
jobs:
16+
build-images:
17+
name: ${{ matrix.variance.name }}
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: read
21+
packages: write
22+
attestations: write
23+
id-token: write
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
variance:
28+
- name: Ubuntu-22.04/CUDA-11.8.0
29+
image: "${{ github.repository }}-ubuntu22-cuda11"
30+
dockerfile: ./container/ubuntu22-cuda11/Dockerfile
31+
- name: Ubuntu-22.04/CUDA-12.8.1
32+
image: "${{ github.repository }}-ubuntu22-cuda12"
33+
dockerfile: ./container/ubuntu22-cuda12/Dockerfile
34+
- name: Ubuntu-24.04/CUDA-12.8.1
35+
image: "${{ github.repository }}-ubuntu24-cuda12"
36+
dockerfile: ./container/ubuntu24-cuda12/Dockerfile
37+
- name: RockyLinux-9/CUDA-12.8.1
38+
image: "${{ github.repository }}-rockylinux9-cuda12"
39+
dockerfile: ./container/rockylinux9-cuda12/Dockerfile
40+
steps:
41+
- name: Checkout repository
42+
uses: actions/checkout@v4
43+
- name: Log in to the Container registry
44+
uses: docker/login-action@v3
45+
with:
46+
registry: ${{ env.REGISTRY }}
47+
username: ${{ github.actor }}
48+
password: ${{ secrets.GITHUB_TOKEN }}
49+
- name: Extract metadata (tags, labels) for containers
50+
id: meta
51+
uses: docker/metadata-action@v5
52+
with:
53+
images: ${{ env.REGISTRY }}/${{ matrix.variance.image }}
54+
tags: |
55+
type=ref,event=branch
56+
type=sha,format=short
57+
type=raw,value=latest
58+
- name: Set up Docker Buildx
59+
uses: docker/setup-buildx-action@v3
60+
- name: Build and push container images
61+
id: push
62+
uses: docker/build-push-action@v6
63+
with:
64+
context: .
65+
file: ${{ matrix.variance.dockerfile }}
66+
tags: ${{ steps.meta.outputs.tags }}
67+
labels: ${{ steps.meta.outputs.labels }}
68+
push: ${{ github.event_name != 'pull_request' }}
69+
- name: Generate artifact attestation
70+
uses: actions/attest-build-provenance@v2
71+
with:
72+
subject-name: ${{ env.REGISTRY }}/${{ matrix.variance.image }}
73+
subject-digest: ${{ steps.push.outputs.digest }}
74+
push-to-registry: true

.github/workflows/rust.yml

-44
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,6 @@ jobs:
2222
fail-fast: false
2323
matrix:
2424
include:
25-
- os: ubuntu-20.04
26-
target: x86_64-unknown-linux-gnu
27-
cuda: "11.2.2"
28-
linux-local-args: ["--toolkit"]
29-
- os: ubuntu-24.04
30-
target: x86_64-unknown-linux-gnu
31-
cuda: "12.8.1"
32-
linux-local-args: ["--toolkit"]
33-
- os: windows-latest
34-
target: x86_64-pc-windows-msvc
35-
cuda: "11.2.2"
36-
linux-local-args: []
3725
- os: windows-latest
3826
target: x86_64-pc-windows-msvc
3927
cuda: "12.8.1"
@@ -70,50 +58,18 @@ jobs:
7058
- name: Add rustup components
7159
run: rustup component add rustfmt clippy
7260

73-
- name: Install dependencies for LLVM 7
74-
if: matrix.os == 'ubuntu-24.04'
75-
run: |
76-
wget -O libffi7.deb http://security.ubuntu.com/ubuntu/pool/universe/libf/libffi7/libffi7_3.3-5ubuntu1_amd64.deb
77-
sudo apt-get update
78-
sudo apt-get install -y ./*.deb
79-
sudo apt-get install -y liblzma-dev
80-
sudo apt-get install -y libssl-dev
81-
sudo apt-get install -y libcurl4-openssl-dev
82-
83-
- name: Install LLVM 7
84-
if: contains(matrix.os, 'ubuntu')
85-
run: |
86-
mkdir -p ~/llvm7 && cd ~/llvm7
87-
wget http://mirrors.kernel.org/ubuntu/pool/universe/l/llvm-toolchain-7/llvm-7_7.0.1-12_amd64.deb \
88-
http://mirrors.kernel.org/ubuntu/pool/universe/l/llvm-toolchain-7/llvm-7-dev_7.0.1-12_amd64.deb \
89-
http://mirrors.kernel.org/ubuntu/pool/universe/l/llvm-toolchain-7/libllvm7_7.0.1-12_amd64.deb \
90-
http://mirrors.kernel.org/ubuntu/pool/universe/l/llvm-toolchain-7/llvm-7-runtime_7.0.1-12_amd64.deb
91-
sudo apt-get update
92-
sudo apt-get install -y ./*.deb
93-
sudo ln -s /usr/bin/llvm-config-7 /usr/local/bin/llvm-config
94-
9561
- name: Load Rust Cache
9662
uses: Swatinem/[email protected]
9763
with:
9864
key: ${{ matrix.os }}-${{ matrix.target }}-${{ matrix.cuda }}
9965

100-
- name: Rustfmt
101-
if: contains(matrix.os, 'ubuntu')
102-
run: cargo fmt --all -- --check
103-
10466
- name: Build
10567
run: cargo build --workspace --exclude "optix*" --exclude "path_tracer" --exclude "denoiser" --exclude "add" --exclude "ex*" --exclude "cudnn*"
10668

10769
# Don't currently test because many tests rely on the system having a CUDA GPU
10870
# - name: Test
10971
# run: cargo test --workspace
11072

111-
- name: Clippy
112-
if: contains(matrix.os, 'ubuntu')
113-
env:
114-
RUSTFLAGS: -Dwarnings
115-
run: cargo clippy --workspace --exclude "optix*" --exclude "path_tracer" --exclude "denoiser" --exclude "add" --exclude "ex*" --exclude "cudnn*"
116-
11773
- name: Check documentation
11874
env:
11975
RUSTDOCFLAGS: -Dwarnings

container/rockylinux9-cuda12/Dockerfile

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
FROM nvidia/cuda:12.8.1-cudnn-devel-rockylinux9
22

33
RUN dnf -y install \
4+
clang \
45
openssl-devel \
56
pkgconfig \
67
redhat-rpm-config \
78
which \
89
xz \
910
zlib-devel
1011

12+
# Needed to build `path_tracer`, `optix/ex03_window` example
13+
RUN dnf -y install \
14+
cmake \
15+
fontconfig-devel \
16+
libX11-devel \
17+
libXcursor-devel \
18+
libXi-devel \
19+
libXrandr-devel
20+
1121
# Get LLVM 7 & libffi.so.6
1222
WORKDIR /data/llvm7
1323
RUN curl -sSf -L -O https://dl.fedoraproject.org/pub/epel/9/Everything/x86_64/Packages/l/libffi3.1-3.1-36.el9.x86_64.rpm
@@ -23,9 +33,10 @@ RUN curl -sSf -L https://sh.rustup.rs | bash -s -- -y
2333
ENV PATH="/root/.cargo/bin:${PATH}"
2434

2535
# Setup the workspace
26-
ADD . /data/Rust-CUDA
36+
ADD ./rust-toolchain.toml /data/Rust-CUDA/
2737
WORKDIR /data/Rust-CUDA
2838
RUN rustup show
39+
RUN rm -f "rust-toolchain.toml"
2940

3041
ENV LLVM_LINK_STATIC=1
3142
ENV RUST_LOG=info

container/ubuntu20-cuda12/Dockerfile container/ubuntu22-cuda11/Dockerfile

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
1-
FROM nvidia/cuda:12.8.1-cudnn-devel-ubuntu20.04
1+
FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04
22

33
RUN apt-get update
44
RUN DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \
55
build-essential \
66
curl \
7+
clang \
78
libssl-dev \
89
libtinfo-dev \
910
pkg-config \
1011
xz-utils \
1112
zlib1g-dev
1213

14+
# Needed to build `path_tracer`, `optix/ex03_window` example
15+
RUN DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \
16+
cmake \
17+
libfontconfig-dev \
18+
libx11-xcb-dev \
19+
libxcursor-dev \
20+
libxi-dev \
21+
libxinerama-dev \
22+
libxrandr-dev
23+
1324
# Get LLVM 7
1425
WORKDIR /data/llvm7
1526
RUN curl -sSf -L -O http://mirrors.kernel.org/ubuntu/pool/universe/l/llvm-toolchain-7/llvm-7_7.0.1-12_amd64.deb
@@ -24,9 +35,10 @@ RUN curl -sSf -L https://sh.rustup.rs | bash -s -- -y
2435
ENV PATH="/root/.cargo/bin:${PATH}"
2536

2637
# Setup the workspace
27-
ADD . /data/Rust-CUDA
38+
ADD ./rust-toolchain.toml /data/Rust-CUDA/
2839
WORKDIR /data/Rust-CUDA
2940
RUN rustup show
41+
RUN rm -f "rust-toolchain.toml"
3042

3143
ENV LLVM_LINK_STATIC=1
3244
ENV RUST_LOG=info

container/ubuntu20-cuda11/Dockerfile container/ubuntu22-cuda12/Dockerfile

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
1-
FROM nvidia/cuda:11.2.2-cudnn8-devel-ubuntu20.04
1+
FROM nvidia/cuda:12.8.1-cudnn-devel-ubuntu22.04
22

33
RUN apt-get update
44
RUN DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \
55
build-essential \
66
curl \
7+
clang \
78
libssl-dev \
89
libtinfo-dev \
910
pkg-config \
1011
xz-utils \
1112
zlib1g-dev
1213

14+
# Needed to build `path_tracer`, `optix/ex03_window` example
15+
RUN DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \
16+
cmake \
17+
libfontconfig-dev \
18+
libx11-xcb-dev \
19+
libxcursor-dev \
20+
libxi-dev \
21+
libxinerama-dev \
22+
libxrandr-dev
23+
1324
# Get LLVM 7
1425
WORKDIR /data/llvm7
1526
RUN curl -sSf -L -O http://mirrors.kernel.org/ubuntu/pool/universe/l/llvm-toolchain-7/llvm-7_7.0.1-12_amd64.deb
@@ -24,9 +35,10 @@ RUN curl -sSf -L https://sh.rustup.rs | bash -s -- -y
2435
ENV PATH="/root/.cargo/bin:${PATH}"
2536

2637
# Setup the workspace
27-
ADD . /data/Rust-CUDA
38+
ADD ./rust-toolchain.toml /data/Rust-CUDA/
2839
WORKDIR /data/Rust-CUDA
2940
RUN rustup show
41+
RUN rm -f "rust-toolchain.toml"
3042

3143
ENV LLVM_LINK_STATIC=1
3244
ENV RUST_LOG=info

container/ubuntu24-cuda12/Dockerfile

+13-1
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,24 @@ FROM nvidia/cuda:12.8.1-cudnn-devel-ubuntu24.04
33
RUN apt-get update
44
RUN DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \
55
build-essential \
6+
clang \
67
curl \
78
libssl-dev \
89
libtinfo-dev \
910
pkg-config \
1011
xz-utils \
1112
zlib1g-dev
1213

14+
# Needed to build `path_tracer`, `optix/ex03_window` example
15+
RUN DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \
16+
cmake \
17+
libfontconfig-dev \
18+
libx11-xcb-dev \
19+
libxcursor-dev \
20+
libxi-dev \
21+
libxinerama-dev \
22+
libxrandr-dev
23+
1324
# Get LLVM 7 & libffi7
1425
WORKDIR /data/llvm7
1526
RUN curl -sSf -L -O http://security.ubuntu.com/ubuntu/pool/universe/libf/libffi7/libffi7_3.3-5ubuntu1_amd64.deb
@@ -25,9 +36,10 @@ RUN curl -sSf -L https://sh.rustup.rs | bash -s -- -y
2536
ENV PATH="/root/.cargo/bin:${PATH}"
2637

2738
# Setup the workspace
28-
ADD . /data/Rust-CUDA
39+
ADD ./rust-toolchain.toml /data/Rust-CUDA/
2940
WORKDIR /data/Rust-CUDA
3041
RUN rustup show
42+
RUN rm -f "rust-toolchain.toml"
3143

3244
ENV LLVM_LINK_STATIC=1
3345
ENV RUST_LOG=info

rust-toolchain

-9
This file was deleted.

rust-toolchain.toml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[toolchain]
2+
channel = "nightly-2025-03-02"
3+
components = ["clippy", "llvm-tools-preview", "rust-src", "rustc-dev", "rustfmt"]

0 commit comments

Comments
 (0)