Skip to content

Commit

Permalink
[FIX] matrix mode setup for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
makeecat committed Jan 11, 2025
1 parent aa98f54 commit 134074e
Showing 1 changed file with 51 additions and 22 deletions.
73 changes: 51 additions & 22 deletions .github/workflows/general.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ env:
CARGO_TERM_COLOR: always

jobs:
setup:
name: Set Up Environment
build-debug-release:
name: Build Debug / release

runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
mode: [debug, release]

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -56,33 +58,24 @@ jobs:
$npcapLibDir = "$env:USERPROFILE\npcap-sdk\Lib\x64"
Add-Content -Path $env:GITHUB_ENV -Value "LIB=$npcapLibDir"
build-debug-release:
name: Build Debug / release
needs: setup
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
mode: [debug, release]
- name: Set Release Flag
run: echo "RELEASE_FLAG=$([[ '${{ matrix.mode }}' == 'release' ]] && echo '--release' || echo '')" >> $GITHUB_ENV

steps:
# Run clippy and build in debug / release
- name: Run clippy in debug / release
run: cargo +stable clippy $${ '--release' if matrix.mode == 'release' else '' } --workspace --all-targets -- --deny warnings
run: cargo +stable clippy $RELEASE_FLAG --workspace --all-targets -- --deny warnings
- name: Run clippy in debug / release with mock and macro_debug
run: cargo +stable clippy $${ '--release' if matrix.mode == 'release' else '' } --workspace --all-targets --features mock,macro_debug -- --deny warnings
run: cargo +stable clippy $RELEASE_FLAG --workspace --all-targets --features mock,macro_debug -- --deny warnings
- name: Run clippy in debug /release with perf-ui, image and kornia
run: cargo +stable clippy $${ '--release' if matrix.mode == 'release' else '' } --workspace --all-targets --features perf-ui,image,kornia -- --deny warnings
run: cargo +stable clippy $RELEASE_FLAG --workspace --all-targets --features perf-ui,image,kornia -- --deny warnings
- name: Run doctests in debug
if: runner.mode == 'debug'
if: matrix.mode == 'debug'
run: cargo +stable test --doc --workspace
- name: Run build in debug / release
run: cargo +stable build $${ '--release' if matrix.mode == 'release' else '' } --workspace --all-targets --all-features}
run: cargo +stable build $RELEASE_FLAG --workspace --all-targets --all-features}

test-debug-release:
name: Test Debug / Rlease
needs: setup
runs-on: ${{ matrix.os }}

strategy:
Expand All @@ -91,15 +84,51 @@ jobs:
mode: [debug, release]

steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
- name: Setup rust-cache
uses: Swatinem/rust-cache@v2
- name: Install winget
if: runner.os == 'Windows'
uses: Cyberboss/install-winget@v1

## System dependencies
# Install dependencies only on Linux
- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y libudev-dev libpcap-dev

# Those are needed for the integration tests on Windows
- name: Download Npcap SDK (Windows)
if: runner.os == 'Windows'
run: |
Invoke-WebRequest -Uri https://npcap.com/dist/npcap-sdk-1.13.zip -OutFile npcap-sdk.zip
Expand-Archive -Path npcap-sdk.zip -DestinationPath $env:USERPROFILE\npcap-sdk
Remove-Item npcap-sdk.zip
winget install --id DaiyuuNobori.Win10Pcap --disable-interactivity --accept-source-agreements --accept-package-agreements
- name: Set Library and Include Paths (Windows)
if: runner.os == 'Windows'
run: |
$npcapLibDir = "$env:USERPROFILE\npcap-sdk\Lib\x64"
Add-Content -Path $env:GITHUB_ENV -Value "LIB=$npcapLibDir"
- name: Install latest nextest
uses: taiki-e/install-action@nextest

- name: Set Release Flag
run: echo "RELEASE_FLAG=$([[ '${{ matrix.mode }}' == 'release' ]] && echo '--release' || echo '')" >> $GITHUB_ENV

# Run test in debug / release
- name: Run test in debug / release
run: cargo +stable nextest run $${ '--release' if matrix.mode == 'release' else '' } --all-targets --workspace
run: cargo +stable nextest run $RELEASE_FLAG --all-targets --workspace
- name: Run test in debug / release with mock and macro_debug
run: cargo +stable nextest run $${ '--release' if matrix.mode == 'release' else '' } --all-targets --workspace --features mock,macro_debug
run: cargo +stable nextest run $RELEASE_FLAG --all-targets --workspace --features mock,macro_debug
- name: Run test in debug / release with perf-ui, image and kornia
run: cargo +stable nextest run $${ '--release' if matrix.mode == 'release' else '' } --all-targets --workspace --features perf-ui,image,kornia
run: cargo +stable nextest run $RELEASE_FLAG --all-targets --workspace --features perf-ui,image,kornia
- name: Run test in debug / release with all features
run: cargo +stable nextest run $${ '--release' if matrix.mode == 'release' else '' } --all-targets --workspace --all-features
run: cargo +stable nextest run $RELEASE_FLAG --all-targets --workspace --all-features

0 comments on commit 134074e

Please sign in to comment.