sniffnet/.github/workflows/rust.yml
dependabot[bot] fe96249cb6
Bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-14 08:53:28 +00:00

97 lines
2.6 KiB
YAML

name: Rust
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
workflow_call:
secrets:
NPCAP_OEM_URL:
required: true
env:
CARGO_TERM_COLOR: always
# Linters inspired from here: https://github.com/actions-rs/meta/blob/master/recipes/quickstart.md
jobs:
fmt:
name: Rustfmt
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
clippy:
name: Clippy
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add clippy
- uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
Mac:
name: Mac Tests
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
Linux:
name: Linux Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install libpcap
run: sudo apt-get install libpcap-dev
- name: Install dependency for alsa-sys
run: sudo apt-get install libasound2-dev
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
Windows:
name: Windows Tests
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Install npcap sdk
run: |
Invoke-WebRequest -Uri "https://npcap.com/dist/npcap-sdk-1.13.zip" -OutFile "C:/npcap-sdk.zip"
Expand-Archive -LiteralPath C:/npcap-sdk.zip -DestinationPath C:/npcap-sdk
echo "LIB=C:/npcap-sdk/Lib/x64" >> $env:GITHUB_ENV
- name: Install npcap dll
# Secrets are not passed to workflows that are triggered by a pull request from a fork.
# https://docs.github.com/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets
if: github.event_name != 'pull_request'
run: |
Invoke-WebRequest -Uri ${{secrets.NPCAP_OEM_URL}} -OutFile C:/npcap-oem.exe
C:/npcap-oem.exe /S
- name: Build
if: github.event_name != 'pull_request'
run: cargo build --verbose
- name: Run tests
if: github.event_name != 'pull_request'
run: cargo test --verbose