-
Notifications
You must be signed in to change notification settings - Fork 28
101 lines (82 loc) · 3.04 KB
/
general.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
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
- name: Install winget
if: runner.os == 'Windows'
uses: Cyberboss/install-winget@v1
# Fail cheaply and early if the code is not even formatted correctly.
- name: Cargo fmt check
run: cargo fmt --all -- --check
## System dependencies
# 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
# Those are needed for the integration tests on Windows
- 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"
## End of system dependencies
- name: Install cargo-generate
run: cargo install cargo-generate
- 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
env:
LIB: ${{env.LIB}}
run: cargo test --workspace
# Integration Test for the 1 liner generation of a project.
- 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