name: Build project
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "*" ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v3
- name: Update platform
run: sudo apt-get update
- name: Install Rust
run: rustup toolchain install stable --profile minimal
- name: Install Essentials
run: sudo apt-get install libpcap-dev build-essential cmake
- name: Cargo Cache
uses: actions/cache@v3
continue-on-error: false
with:
path: ~/.cargo
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-${{ hashFiles('Cargo.toml') }}
${{ runner.os }}-cargo
- name: Target Cache
uses: actions/cache@v3
continue-on-error: false
with:
path: target
key: ${{ runner.os }}-cargo-target-${{ hashFiles('Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-target-${{ hashFiles('Cargo.toml') }}
${{ runner.os }}-cargo-target
- name: Cargo Build
env:
CARGO_MANIFEST_DIR: ${{ github.workspace }}
run: |
cargo build
- name: Cargo Test
env:
CARGO_MANIFEST_DIR: ${{ github.workspace }}
run: |
cargo test
- name: Clippy check
run:
cargo clippy --all-features -- -D warnings