Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix No space left on device (os error 28) and improve CI speed #215

Merged
merged 2 commits into from
Jan 11, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 51 additions & 33 deletions .github/workflows/general.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ env:
CARGO_TERM_COLOR: always

jobs:
build:
build-debug:
name: Build Debug
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ] # macos tends to break more often.
continue-on-error: false
os: [ ubuntu-latest, macos-latest, windows-latest ]

steps:
- uses: actions/checkout@v4
- name: Set up Rust
Expand All @@ -39,7 +40,6 @@ jobs:
- 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)
Expand All @@ -56,40 +56,58 @@ jobs:
$npcapLibDir = "$env:USERPROFILE\npcap-sdk\Lib\x64"
Add-Content -Path $env:GITHUB_ENV -Value "LIB=$npcapLibDir"

## End of system dependencies

# This is also relatively quick to do, so let's fail early.
# Run debug builds and tests
- name: Run clippy in debug
if: runner.os == 'Linux'
run: cargo clippy --workspace --all-targets -- --deny warnings
- name: Build in debug
run: cargo build --workspace --features macro_debug
- name: Run tests
run: cargo test --workspace

- name: Run clippy in release
if: runner.os == 'Linux'
run: cargo clippy --release --workspace --all-targets -- --deny warnings
build-release:
name: Build Release
runs-on: ${{ matrix.os }}

# - name: Install cargo-generate
# run: cargo install cargo-generate
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]

- name: Build vanilla
run: |
cargo build --workspace --features macro_debug
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

- name: Build with mocks
run: |
cargo build --workspace --features mock
# Fail cheaply and early if the code is not even formatted correctly.
- name: Cargo fmt check
run: cargo fmt --all -- --check

- name: Run tests
env:
LIB: ${{env.LIB}}
run: cargo test --workspace

# Integration Test for the 1 liner generation of a project.
# - name: Generate a test project from the repo template
# run: |
# cd templates
# cargo generate -p cu_full --name test_project --destination . -d copper_source=local --silent
## System dependencies
- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y libudev-dev libpcap-dev
- 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: Compile generated project
# run: |
# cd templates/test_project
# cargo build --release
# Run release builds and tests
- name: Run clippy in release
run: cargo clippy --release --workspace --all-targets -- --deny warnings
- name: Build in release
run: cargo build --release --workspace --features macro_debug
Loading