Dependency cleaning / Better Windows compat (#127) #648
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "CI/CD" | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, macos-latest, windows-latest ] # macos tends to break more often. | |
continue-on-error: false | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Rust | |
uses: actions-rs/toolchain@v1 | |
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 | |
# 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: Run clippy | |
run: cargo clippy -- -W warnings | |
- name: Build vanilla | |
run: | | |
cargo build --workspace --features macro_debug | |
- name: Build with mocks | |
run: | | |
cargo build --workspace --features mock | |
- name: Run tests | |
run: cargo test --workspace | |
# 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: | | |
cd templates | |
cargo generate -p cu_full --name test_project --destination $RUNNER_TEMP --silent | |
- name: Generate new project in temporary directory (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
cd templates | |
cargo generate -p cu_full --name test_project --destination $env:RUNNER_TEMP --silent | |
- name: Compile generated project | |
if: runner.os != 'Windows' | |
run: | | |
cd $RUNNER_TEMP/test_project | |
cargo build --release | |
- name: Compile generated project (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
cd $env:RUNNER_TEMP/test_project | |
cargo build --release |