Skip to content

Commit

Permalink
Fix No space left on device (os error 28) and improve CI speed (#215)
Browse files Browse the repository at this point in the history
* Run debug and release profile in parallel

* CACHE TEST

This is an empty commit which was pushed to check the time taken by CI
when using cache
  • Loading branch information
AS1100K authored Jan 11, 2025
1 parent 5caa3ce commit 357698a
Showing 1 changed file with 51 additions and 33 deletions.
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

0 comments on commit 357698a

Please sign in to comment.