Use modal.com for running tests in CI #336
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Rust CI | |
| on: | |
| pull_request: | |
| paths-ignore: | |
| - "**.md" | |
| push: | |
| paths-ignore: | |
| - "**.md" | |
| env: | |
| RUST_LOG: info | |
| RUST_BACKTRACE: 1 | |
| jobs: | |
| rust: | |
| name: Rust on ${{ matrix.os }} with CUDA ${{ matrix.cuda }} | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| LLVM_LINK_STATIC: 1 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-20.04 | |
| target: x86_64-unknown-linux-gnu | |
| cuda: "11.2.2" | |
| gpu: "T4" | |
| linux-local-args: ["--toolkit"] | |
| - os: ubuntu-24.04 | |
| target: x86_64-unknown-linux-gnu | |
| cuda: "12.8.1" | |
| linux-local-args: ["--toolkit"] | |
| gpu: "T4" | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| cuda: "11.2.2" | |
| linux-local-args: [] | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| cuda: "12.8.1" | |
| linux-local-args: [] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v2 | |
| - name: Install CUDA | |
| uses: Jimver/[email protected] | |
| id: cuda-toolkit | |
| with: | |
| cuda: ${{ matrix.cuda }} | |
| linux-local-args: ${{ toJson(matrix.linux-local-args) }} | |
| use-local-cache: false | |
| - 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' | |
| shell: pwsh | |
| run: Get-ChildItem -Path $env:CUDA_PATH -Recurse | ForEach-Object { $_.FullName } | |
| # random command that forces rustup to install stuff in rust-toolchain | |
| - name: Install rust-toolchain | |
| run: cargo version | |
| - 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*" | |
| - name: Clippy | |
| if: runner.os == 'Linux' | |
| env: | |
| RUSTFLAGS: -Dwarnings | |
| run: cargo clippy --workspace --exclude "optix" --exclude "path_tracer" --exclude "denoiser" --exclude "add" --exclude "ex*" | |
| - 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*" | |
| # We now run tests. We run them last because they run on donated machines with | |
| # GPUs. | |
| - name: Install python (for CI test runner script) | |
| if: runner.os == 'Linux' | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - name: Install CI test runner deps | |
| if: runner.os == 'Linux' | |
| working-directory: .ci/modal.com | |
| run: | | |
| curl -LsSf https://astral.sh/uv/install.sh | sh | |
| uv sync | |
| - name: Check CI test runner formatting | |
| if: runner.os == 'Linux' | |
| working-directory: .ci/modal.com | |
| run: uvx black --check . | |
| - name: Run tests via CI test runner | |
| if: runner.os == 'Linux' | |
| env: | |
| # Pass runtime config TO THE python runner script | |
| RUNNER_OS_NAME: ${{ matrix.os }} | |
| RUNNER_CUDA_VERSION: ${{ matrix.cuda }} | |
| MODAL_GPU_TYPE: ${{ matrix.gpu }} | |
| MODAL_TOKEN_ID: ${{ secrets.MODAL_TOKEN_ID }} | |
| MODAL_TOKEN_SECRET: ${{ secrets.MODAL_TOKEN_SECRET }} | |
| # Run the tests, but point at a config that sets the runner to our test runner. | |
| run: cargo --config .ci/config.toml test --workspace --exclude "optix" --exclude "path_tracer" --exclude "denoiser" --exclude "add" --exclude "ex*" --exclude "cudnn" |