From e1fb5a092d837d01bca6cc99093d9f45811aacf9 Mon Sep 17 00:00:00 2001 From: Yang Zhou Date: Mon, 20 Jan 2025 07:47:45 -0500 Subject: [PATCH] [FIX] (CI) add cuda-release for weekly CI --- .github/workflows/weekly.yml | 55 +++++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 10 deletions(-) diff --git a/.github/workflows/weekly.yml b/.github/workflows/weekly.yml index 6c7495982..498ecfc4e 100644 --- a/.github/workflows/weekly.yml +++ b/.github/workflows/weekly.yml @@ -31,12 +31,12 @@ jobs: strategy: matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - mode: [debug, release] + os: [ ubuntu-latest, macos-latest, windows-latest ] + mode: [ debug, release, cuda-release] steps: - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@beta + - uses: dtolnay/rust-toolchain@stable - name: Setup rust-cache uses: Swatinem/rust-cache@v2 with: @@ -50,6 +50,21 @@ jobs: - name: Check formatting run: cargo +stable fmt --all -- --check + - name: Free Disk Space (Ubuntu) + if: runner.os == 'Linux' && matrix.mode == 'cuda-release' + uses: jlumbroso/free-disk-space@main + with: + # this might remove tools that are actually needed, + # if set to "true" but frees about 6 GB + tool-cache: false + android: true + dotnet: true + haskell: true + # do not remove large-packages, as it is necessary + large-packages: false + docker-images: true + swap-storage: true + - name: Install dependencies (Linux) if: runner.os == 'Linux' run: sudo apt-get update && sudo apt-get install -y libudev-dev libpcap-dev @@ -63,22 +78,42 @@ jobs: winget install DaiyuuNobori.Win10Pcap --accept-source-agreements --accept-package-agreements Add-Content -Path $env:GITHUB_ENV -Value "LIB=$env:USERPROFILE\npcap-sdk\Lib\x64" + - name: Install CUDA + uses: Jimver/cuda-toolkit@master + if: runner.os != 'macOS' && matrix.mode == 'cuda-release' + with: + log-file-suffix: '${{ matrix.os }}-${{ matrix.mode }}-cuda.txt' + - name: Set build mode (Linux / MacOS) - if: runner.os != 'Windows' - run: echo "RELEASE_FLAG=$([[ '${{ matrix.mode }}' == 'release' ]] && echo '--release' || echo '')" >> $GITHUB_ENV + if: runner.os != 'Windows' && ( matrix.mode == 'release' || matrix.mode == 'cuda-release' ) + run: echo "RELEASE_FLAG=--release" >> $GITHUB_ENV - name: Set build mode (Windows) - if: runner.os == 'Windows' && matrix.mode == 'release' + if: runner.os == 'Windows' && ( matrix.mode == 'release' || matrix.mode == 'cuda-release' ) run: | Add-Content -Path $env:GITHUB_ENV -Value "RELEASE_FLAG=--release" + - name: Set features (Linux / MacOS) + if: runner.os != 'Windows' + run: echo "FEATURES_FLAG=$([[ '${{ matrix.mode }}' == 'cuda-release' ]] && echo '--all-features' || echo '--features macro_debug,mock,iyes_perf_ui,image,kornia')" >> $GITHUB_ENV + + - name: Set features (Windows) + if: runner.os == 'Windows' + run: | + $features = if ($env:matrix_mode -eq 'cuda-release') { + '--all-features' + } else { + '--features macro_debug,mock,iyes_perf_ui,image,kornia' + } + Add-Content -Path $env:GITHUB_ENV -Value "FEATURES_FLAG=$features" + # Run Clippy and build - name: Run clippy on (${{ matrix.os }} | ${{matrix.mode}}) run: cargo +stable clippy $RELEASE_FLAG --workspace --all-targets -- --deny warnings - name: Run clippy with all features on (${{ matrix.os }} | ${{matrix.mode}}) - run: cargo +stable clippy $RELEASE_FLAG --workspace --all-targets --all-features -- --deny warnings - - name: Run build with all features on $(${{ matrix.os }} | ${{matrix.mode}}) - run: cargo +stable build $RELEASE_FLAG --workspace --all-targets --all-features + run: cargo +stable clippy $RELEASE_FLAG --workspace --all-targets $FEATURES_FLAG -- --deny warnings + - name: Run build with all features on (${{ matrix.os }} | ${{matrix.mode}}) + run: cargo +stable build $RELEASE_FLAG --workspace --all-targets $FEATURES_FLAG - name: Run doctests on (${{ matrix.os }} | debug) if: matrix.mode == 'debug' @@ -88,7 +123,7 @@ jobs: - name: Run Unit Tests on (${{ matrix.os }} | ${{matrix.mode}}) run: cargo +stable nextest run $RELEASE_FLAG --all-targets --workspace - name: Run Unit Tests with all features on (${{ matrix.os }} | ${{matrix.mode}}) - run: cargo +stable nextest run $RELEASE_FLAG --all-targets --workspace --all-features + run: cargo +stable nextest run $RELEASE_FLAG --all-targets --workspace $FEATURES_FLAG # Run Project Generation Tests - name: Install cargo-generate on (${{ matrix.os }} | debug)