Skip to content

feat(ci): Split Linux CI workflow and add container images pipeline #188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/ci_linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: CI on Linux

on:
pull_request:
paths-ignore:
- "**.md"
push:
paths-ignore:
- "**.md"
env:
RUST_LOG: info
RUST_BACKTRACE: 1
jobs:
build:
name: ${{ matrix.variance.name }}
runs-on: ubuntu-latest
container:
image: ${{ matrix.variance.image }}
strategy:
fail-fast: false
matrix:
variance:
# - name: Ubuntu-22.04/CUDA-11.8.0
# image: "ghcr.io/rust-gpu/rust-cuda-ubuntu22-cuda11:latest"
- name: Ubuntu-22.04/CUDA-12.8.1
image: "ghcr.io/rust-gpu/rust-cuda-ubuntu22-cuda12:latest"
- name: Ubuntu-24.04/CUDA-12.8.1
image: "ghcr.io/rust-gpu/rust-cuda-ubuntu24-cuda12:latest"
- name: RockyLinux-9/CUDA-12.8.1
image: "ghcr.io/rust-gpu/rust-cuda-rockylinux9-cuda12:latest"
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Verify CUDA, Rust installation
run: |
nvcc --version
rustup show
- name: Load Rust cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.variance.name }}
- name: Rustfmt
run: cargo fmt --all -- --check
- name: Clippy
env:
RUSTFLAGS: -Dwarnings
run: cargo clippy --workspace --exclude "optix*" --exclude "path_tracer" --exclude "denoiser" --exclude "add" --exclude "ex*" --exclude "cudnn*"
- name: Build
run: cargo build --workspace --exclude "optix*" --exclude "path_tracer" --exclude "denoiser" --exclude "add" --exclude "ex*" --exclude "cudnn*"
- name: Check documentation
env:
RUSTDOCFLAGS: -Dwarnings
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 changes: 74 additions & 0 deletions .github/workflows/container_images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Build CI Container Images

on:
workflow_dispatch:
pull_request:
paths:
- ".github/workflows/container_images.yml"
- "container/**"
push:
paths:
- ".github/workflows/container_images.yml"
- "container/**"
env:
REGISTRY: ghcr.io
jobs:
build-images:
name: ${{ matrix.variance.name }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
strategy:
fail-fast: false
matrix:
variance:
- name: Ubuntu-22.04/CUDA-11.8.0
image: "${{ github.repository }}-ubuntu22-cuda11"
dockerfile: ./container/ubuntu22-cuda11/Dockerfile
- name: Ubuntu-22.04/CUDA-12.8.1
image: "${{ github.repository }}-ubuntu22-cuda12"
dockerfile: ./container/ubuntu22-cuda12/Dockerfile
- name: Ubuntu-24.04/CUDA-12.8.1
image: "${{ github.repository }}-ubuntu24-cuda12"
dockerfile: ./container/ubuntu24-cuda12/Dockerfile
- name: RockyLinux-9/CUDA-12.8.1
image: "${{ github.repository }}-rockylinux9-cuda12"
dockerfile: ./container/rockylinux9-cuda12/Dockerfile
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for containers
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ matrix.variance.image }}
tags: |
type=ref,event=branch
type=sha,format=short
type=raw,value=latest
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push container images
id: push
uses: docker/build-push-action@v6
with:
context: .
file: ${{ matrix.variance.dockerfile }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: ${{ github.event_name != 'pull_request' }}
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v2
with:
subject-name: ${{ env.REGISTRY }}/${{ matrix.variance.image }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
54 changes: 1 addition & 53 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,6 @@ jobs:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
target: x86_64-unknown-linux-gnu
cuda: "11.2.2"
linux-local-args: ["--toolkit"]
sub-packages: []
- os: ubuntu-24.04
target: x86_64-unknown-linux-gnu
cuda: "12.8.1"
linux-local-args: ["--toolkit"]
sub-packages: []
- os: windows-latest
target: x86_64-pc-windows-msvc
cuda: "11.2.2"
linux-local-args: []
sub-packages: ["nvcc", "nvrtc", "nvrtc_dev", "cudart", "cublas", "cublas_dev", "curand", "curand_dev"]
- os: windows-latest
target: x86_64-pc-windows-msvc
cuda: "12.8.1"
Expand All @@ -61,12 +46,7 @@ jobs:
- name: Verify CUDA installation
run: nvcc --version

- name: List CUDA_PATH files (Linux)
if: runner.os == 'Linux'
run: find "$CUDA_PATH" -type f

- name: List CUDA_PATH files (Windows)
if: runner.os == 'Windows'
- name: List CUDA_PATH files
shell: pwsh
run: Get-ChildItem -Path $env:CUDA_PATH -Recurse | ForEach-Object { $_.FullName }

Expand All @@ -77,50 +57,18 @@ jobs:
- name: Add rustup components
run: rustup component add rustfmt clippy

- name: Install dependencies for LLVM 7
if: matrix.os == 'ubuntu-24.04'
run: |
wget -O libffi7.deb http://security.ubuntu.com/ubuntu/pool/universe/libf/libffi7/libffi7_3.3-5ubuntu1_amd64.deb
sudo apt-get update
sudo apt-get install -y ./*.deb
sudo apt-get install -y liblzma-dev
sudo apt-get install -y libssl-dev
sudo apt-get install -y libcurl4-openssl-dev

- name: Install LLVM 7
if: contains(matrix.os, 'ubuntu')
run: |
mkdir -p ~/llvm7 && cd ~/llvm7
wget http://mirrors.kernel.org/ubuntu/pool/universe/l/llvm-toolchain-7/llvm-7_7.0.1-12_amd64.deb \
http://mirrors.kernel.org/ubuntu/pool/universe/l/llvm-toolchain-7/llvm-7-dev_7.0.1-12_amd64.deb \
http://mirrors.kernel.org/ubuntu/pool/universe/l/llvm-toolchain-7/libllvm7_7.0.1-12_amd64.deb \
http://mirrors.kernel.org/ubuntu/pool/universe/l/llvm-toolchain-7/llvm-7-runtime_7.0.1-12_amd64.deb
sudo apt-get update
sudo apt-get install -y ./*.deb
sudo ln -s /usr/bin/llvm-config-7 /usr/local/bin/llvm-config

- name: Load Rust Cache
uses: Swatinem/[email protected]
with:
key: ${{ matrix.os }}-${{ matrix.target }}-${{ matrix.cuda }}

- name: Rustfmt
if: contains(matrix.os, 'ubuntu')
run: cargo fmt --all -- --check

- name: Build
run: cargo build --workspace --exclude "optix*" --exclude "path_tracer" --exclude "denoiser" --exclude "add" --exclude "ex*" --exclude "cudnn*"

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

- name: Clippy
if: contains(matrix.os, 'ubuntu')
env:
RUSTFLAGS: -Dwarnings
run: cargo clippy --workspace --exclude "optix*" --exclude "path_tracer" --exclude "denoiser" --exclude "add" --exclude "ex*" --exclude "cudnn*"

- name: Check documentation
env:
RUSTDOCFLAGS: -Dwarnings
Expand Down
13 changes: 12 additions & 1 deletion container/rockylinux9-cuda12/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
FROM nvidia/cuda:12.8.1-cudnn-devel-rockylinux9

RUN dnf -y install \
clang \
openssl-devel \
pkgconfig \
redhat-rpm-config \
which \
xz \
zlib-devel

# Needed to build `path_tracer`, `optix/ex03_window` example
RUN dnf -y install \
cmake \
fontconfig-devel \
libX11-devel \
libXcursor-devel \
libXi-devel \
libXrandr-devel

# Get LLVM 7 & libffi.so.6
WORKDIR /data/llvm7
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
Expand All @@ -23,9 +33,10 @@ RUN curl -sSf -L https://sh.rustup.rs | bash -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"

# Setup the workspace
ADD . /data/Rust-CUDA
ADD ./rust-toolchain.toml /data/Rust-CUDA/
WORKDIR /data/Rust-CUDA
RUN rustup show
RUN rm -f "rust-toolchain.toml"

ENV LLVM_LINK_STATIC=1
ENV RUST_LOG=info
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
FROM nvidia/cuda:12.8.1-cudnn-devel-ubuntu20.04
FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04

RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \
build-essential \
curl \
clang \
libssl-dev \
libtinfo-dev \
pkg-config \
xz-utils \
zlib1g-dev

# Needed to build `path_tracer`, `optix/ex03_window` example
RUN DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \
cmake \
libfontconfig-dev \
libx11-xcb-dev \
libxcursor-dev \
libxi-dev \
libxinerama-dev \
libxrandr-dev

# Get LLVM 7
WORKDIR /data/llvm7
RUN curl -sSf -L -O http://mirrors.kernel.org/ubuntu/pool/universe/l/llvm-toolchain-7/llvm-7_7.0.1-12_amd64.deb
Expand All @@ -24,9 +35,10 @@ RUN curl -sSf -L https://sh.rustup.rs | bash -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"

# Setup the workspace
ADD . /data/Rust-CUDA
ADD ./rust-toolchain.toml /data/Rust-CUDA/
WORKDIR /data/Rust-CUDA
RUN rustup show
RUN rm -f "rust-toolchain.toml"

ENV LLVM_LINK_STATIC=1
ENV RUST_LOG=info
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
FROM nvidia/cuda:11.2.2-cudnn8-devel-ubuntu20.04
FROM nvidia/cuda:12.8.1-cudnn-devel-ubuntu22.04

RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \
build-essential \
curl \
clang \
libssl-dev \
libtinfo-dev \
pkg-config \
xz-utils \
zlib1g-dev

# Needed to build `path_tracer`, `optix/ex03_window` example
RUN DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \
cmake \
libfontconfig-dev \
libx11-xcb-dev \
libxcursor-dev \
libxi-dev \
libxinerama-dev \
libxrandr-dev

# Get LLVM 7
WORKDIR /data/llvm7
RUN curl -sSf -L -O http://mirrors.kernel.org/ubuntu/pool/universe/l/llvm-toolchain-7/llvm-7_7.0.1-12_amd64.deb
Expand All @@ -24,9 +35,10 @@ RUN curl -sSf -L https://sh.rustup.rs | bash -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"

# Setup the workspace
ADD . /data/Rust-CUDA
ADD ./rust-toolchain.toml /data/Rust-CUDA/
WORKDIR /data/Rust-CUDA
RUN rustup show
RUN rm -f "rust-toolchain.toml"

ENV LLVM_LINK_STATIC=1
ENV RUST_LOG=info
14 changes: 13 additions & 1 deletion container/ubuntu24-cuda12/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,24 @@ FROM nvidia/cuda:12.8.1-cudnn-devel-ubuntu24.04
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \
build-essential \
clang \
curl \
libssl-dev \
libtinfo-dev \
pkg-config \
xz-utils \
zlib1g-dev

# Needed to build `path_tracer`, `optix/ex03_window` example
RUN DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \
cmake \
libfontconfig-dev \
libx11-xcb-dev \
libxcursor-dev \
libxi-dev \
libxinerama-dev \
libxrandr-dev

# Get LLVM 7 & libffi7
WORKDIR /data/llvm7
RUN curl -sSf -L -O http://security.ubuntu.com/ubuntu/pool/universe/libf/libffi7/libffi7_3.3-5ubuntu1_amd64.deb
Expand All @@ -25,9 +36,10 @@ RUN curl -sSf -L https://sh.rustup.rs | bash -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"

# Setup the workspace
ADD . /data/Rust-CUDA
ADD ./rust-toolchain.toml /data/Rust-CUDA/
WORKDIR /data/Rust-CUDA
RUN rustup show
RUN rm -f "rust-toolchain.toml"

ENV LLVM_LINK_STATIC=1
ENV RUST_LOG=info
9 changes: 0 additions & 9 deletions rust-toolchain

This file was deleted.

3 changes: 3 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[toolchain]
channel = "nightly-2025-03-02"
components = ["clippy", "llvm-tools-preview", "rust-src", "rustc-dev", "rustfmt"]
Loading