Skip to content

Commit

Permalink
Get the ncap lib from the SDK instead.
Browse files Browse the repository at this point in the history
  • Loading branch information
gbin committed Dec 4, 2024
1 parent d9bc22d commit 8a3cc6d
Showing 1 changed file with 32 additions and 25 deletions.
57 changes: 32 additions & 25 deletions .github/workflows/general.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,48 +24,56 @@ jobs:
with:
toolchain: stable
profile: minimal

# Fail cheaply and early if the code is not even formatted correctly.
- name: Cargo fmt check
run: cargo fmt --all -- --check


## 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

- name: Build vanilla
# Those are needed for the integration tests on Windows
- name: Download Npcap SDK (Windows)
if: runner.os == 'Windows'
run: |
cargo build --workspace --features macro_debug
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
- name: Build with mocks
- name: Set Library and Include Paths (Windows)
if: runner.os == 'Windows'
run: |
cargo build --workspace --features mock
$npcapLibDir = "$env:USERPROFILE\npcap-sdk\Lib"
$npcapIncludeDir = "$env:USERPROFILE\npcap-sdk\Include"
[System.Environment]::SetEnvironmentVariable("LIB", "$npcapLibDir;"+$env:LIB, [System.EnvironmentVariableTarget]::Process)
[System.Environment]::SetEnvironmentVariable("INCLUDE", "$npcapIncludeDir;"+$env:INCLUDE, [System.EnvironmentVariableTarget]::Process)
# Those are needed for the integration tests
- name: Install Npcap
if: runner.os == 'Windows'
## End of system dependencies

## Rust env
- name: Install cargo-generate
run: cargo install cargo-generate
## End of rust env

- name: Run clippy
run: cargo clippy -- -W warnings

- name: Build vanilla
run: |
$ErrorActionPreference = 'Stop'
Invoke-WebRequest -Uri https://nmap.org/npcap/dist/npcap-1.75.exe -OutFile npcap-installer.exe
Start-Process -FilePath npcap-installer.exe -ArgumentList "/S" -NoNewWindow -Wait
Remove-Item npcap-installer.exe
cargo build --workspace --features macro_debug
- name: Set Library Path
if: runner.os == 'Windows'
- name: Build with mocks
run: |
$npcapDir = "C:\Program Files\Npcap\Lib"
if (-Not (Test-Path $npcapDir)) { throw "Npcap library directory not found." }
[System.Environment]::SetEnvironmentVariable("LIB", "$npcapDir;"+$env:LIB, [System.EnvironmentVariableTarget]::Process)
cargo build --workspace --features mock
- name: Run tests
run: cargo test --workspace

- name: Run clippy
run: cargo clippy -- -W warnings

# Integration Test for the 1 liner generation of a project.
- name: Install cargo-generate
run: cargo install cargo-generate

- name: Generate new project in temporary directory
if: runner.os != 'Windows'
run: |
Expand All @@ -88,5 +96,4 @@ jobs:
if: runner.os == 'Windows'
run: |
cd $env:RUNNER_TEMP/test_project
cargo build --release
cargo build --release

0 comments on commit 8a3cc6d

Please sign in to comment.