diff --git a/.ci/cargo_glue.sh b/.ci/cargo_glue.sh new file mode 100755 index 0000000..cc424b5 --- /dev/null +++ b/.ci/cargo_glue.sh @@ -0,0 +1,12 @@ +#!/bin/bash +set -e + +# This script is used by cargo to run the test runner with the +# specified arguments. +# +# We need this script because the cwd that cargo runs the runner in changes +# depending on crate. + +cd "$GITHUB_WORKSPACE/.ci/" +echo "In glue script with cwd: $(pwd)" +echo "Got args: $@" diff --git a/.ci/config.toml b/.ci/config.toml new file mode 100644 index 0000000..d860b86 --- /dev/null +++ b/.ci/config.toml @@ -0,0 +1,8 @@ +[target.x86_64-unknown-linux-gnu] +# The command to execute instead of the compiled test binary. Cargo will append the +# actual path to the compiled test executable and any arguments (like --list, --exact, +# --nocapture) after this command. +# We use a tool without a slash in it so cargo will search $PATH. +# +# Before calling the `cargo test` we append the location of the glue to the path. +runner = ["cargo_glue.sh"] diff --git a/.github/workflows/ci_linux.yml b/.github/workflows/ci_linux.yml index 45ea255..8cf8a7b 100644 --- a/.github/workflows/ci_linux.yml +++ b/.github/workflows/ci_linux.yml @@ -138,6 +138,13 @@ jobs: - 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 + + # random command that forces rustup to install stuff in rust-toolchain + - name: Install rust-toolchain + run: cargo version + - name: Download build artifacts uses: actions/download-artifact@v4 with: @@ -152,4 +159,5 @@ jobs: MODAL_TOKEN_ID: ${{ secrets.MODAL_TOKEN_ID }} MODAL_TOKEN_SECRET: ${{ secrets.MODAL_TOKEN_SECRET }} run: | - echo "Stubbed out" + export PATH="$PATH:$GITHUB_WORKSPACE/.ci" + cargo --config .ci/config.toml test --workspace --exclude "optix*" --exclude "path_tracer" --exclude "denoiser" --exclude "ex*" --exclude "cudnn*" --exclude "blastoff" diff --git a/examples/cuda/cpu/add/build.rs b/examples/cuda/cpu/add/build.rs index bb96d32..a0c6ee1 100644 --- a/examples/cuda/cpu/add/build.rs +++ b/examples/cuda/cpu/add/build.rs @@ -1,8 +1,10 @@ use cuda_builder::CudaBuilder; fn main() { - CudaBuilder::new("../../gpu/add_gpu") - .copy_to("../../resources/add.ptx") + let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR exists"); + let manifest_dir = std::path::Path::new(&manifest_dir); + CudaBuilder::new(manifest_dir.join("../../gpu/add_gpu")) + .copy_to(manifest_dir.join("../../resources/add.ptx")) .build() .unwrap(); }