-
Notifications
You must be signed in to change notification settings - Fork 37
150 lines (127 loc) · 5.65 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
name: "CI/CD"
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
env:
CARGO_TERM_COLOR: always
jobs:
build-debug-release:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
mode: [debug, release]
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
# Fail cheaply and early if the code is not even formatted correctly.
- name: Cargo fmt check
run: cargo +stable 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"
- name: Set Release Flag (Linux / MacOS)
if: runner.os != 'Windows'
run: echo "RELEASE_FLAG=$([[ '${{ matrix.mode }}' == 'release' ]] && echo '--release' || echo '')" >> $GITHUB_ENV
- name: Set Release Flag (Windows)
if: runner.os == 'Windows'
run: |
if "%matrix_mode%" == "release" (
echo RELEASE_FLAG=--release >> %GITHUB_ENV%
) else (
echo RELEASE_FLAG= >> %GITHUB_ENV%
)
# Run clippy and build in debug / release
- name: Run clippy in debug / release
run: cargo +stable clippy $RELEASE_FLAG --workspace --all-targets -- --deny warnings
- name: Run clippy in debug / release with mock and macro_debug
run: cargo +stable clippy $RELEASE_FLAG --workspace --all-targets --features mock,macro_debug -- --deny warnings
- name: Run clippy in debug /release with perf-ui, image and kornia
run: cargo +stable clippy $RELEASE_FLAG --workspace --all-targets --features perf-ui,image,kornia -- --deny warnings
- name: Run doctests in debug
if: matrix.mode == 'debug'
run: cargo +stable test --doc --workspace
- name: Run build in debug / release
run: cargo +stable build $RELEASE_FLAG --workspace --all-targets --all-features}
test-debug-release:
name: Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
mode: [debug, release]
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
## 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"
- name: Install latest nextest
uses: taiki-e/install-action@nextest
- name: Set Release Flag (Linux / MacOS)
if: runner.os != 'Windows'
run: echo "RELEASE_FLAG=$([[ '${{ matrix.mode }}' == 'release' ]] && echo '--release' || echo '')" >> $GITHUB_ENV
- name: Set Release Flag (Windows)
if: runner.os == 'Windows' && matrix.mode == 'release'
run: |
Add-Content -Path $env:GITHUB_ENV -Value "RELEASE_FLAG=--release"
# Run test in debug / release
- name: Run test in debug / release
run: cargo +stable nextest run $RELEASE_FLAG --all-targets --workspace
- name: Run test in debug / release with mock and macro_debug
run: cargo +stable nextest run $RELEASE_FLAG --all-targets --workspace --features mock,macro_debug
- name: Run test in debug / release with perf-ui, image and kornia
run: cargo +stable nextest run $RELEASE_FLAG --all-targets --workspace --features perf-ui,image,kornia
- name: Run test in debug / release with all features
run: cargo +stable nextest run $RELEASE_FLAG --all-targets --workspace --all-features