-
-
Notifications
You must be signed in to change notification settings - Fork 80
218 lines (209 loc) · 7.22 KB
/
ci.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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
on:
pull_request:
branches: [ master ]
schedule:
- cron: '00 18 * * *'
name: CI
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
build:
- linux-stable
- linux-musl-stable
- linux-beta
- linux-nightly
- macos-stable
- macos-stable-arm64
- windows-stable
include:
- build: linux-stable
os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
rust: stable
- build: linux-musl-stable
os: ubuntu-22.04
target: x86_64-unknown-linux-musl
rust: stable
- build: linux-beta
os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
rust: beta
- build: linux-nightly
os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
rust: nightly
- build: macos-stable
os: macos-13
target: x86_64-apple-darwin
rust: stable
- build: macos-stable-arm64
os: macos-14
target: aarch64-apple-darwin
rust: stable
- build: windows-stable
os: windows-2022
target: x86_64-pc-windows-msvc
rust: stable
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- run: cargo test --target ${{ matrix.target }}
build-cross:
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [ netbsd, freebsd ]
include:
- build: netbsd
os: ubuntu-22.04
target: x86_64-unknown-netbsd
rust: stable
- build: freebsd
os: ubuntu-22.04
target: x86_64-unknown-freebsd
rust: stable
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- name: Use Cross
shell: bash
run: |
cargo install cross --git https://github.com/cross-rs/cross
- name: Show command used for Cargo
run: |
echo "cargo command is: ${{ env.CARGO }}"
echo "target flag is: ${{ env.TARGET_FLAGS }}"
- name: cross build
run: cross build --target ${{ matrix.target }} --verbose
sim-test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
build:
- linux-stable
- macos-stable
- windows-stable
include:
- build: linux-stable
os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
rust: stable
- build: macos-stable
os: macos-13
target: x86_64-apple-darwin
rust: stable
- build: windows-stable
os: windows-2022
target: x86_64-pc-windows-msvc
rust: stable
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- name: Copy wintun.dll to current dir
if: startsWith(matrix.build, 'windows')
shell: bash
# The simulation tests run from the crates/trippy-core directory and so `wintun.dll` needs to be copied there
run: |
cp "crates/trippy-core/tests/resources/wintun.dll" "./crates/trippy-core/"
- name: Allow ICMPv4 and ICMPv6 in Windows defender firewall
if: startsWith(matrix.build, 'windows')
shell: pwsh
run: |
New-NetFirewallRule -DisplayName "ICMPv4 Trippy Allow" -Name ICMPv4_TRIPPY_ALLOW -Protocol ICMPv4 -Action Allow
New-NetFirewallRule -DisplayName "ICMPv6 Trippy Allow" -Name ICMPv6_TRIPPY_ALLOW -Protocol ICMPv6 -Action Allow
- name: Build (without root)
run: cargo build --target ${{ matrix.target }} --features sim-tests --test sim
- name: Run simulation test on ${{ matrix.build }}
if: ${{ ! startsWith(matrix.build, 'windows') }}
run: sudo -E env "PATH=$PATH" cargo test --target ${{ matrix.target }} --features sim-tests --test sim -- --exact --nocapture
- name: Run simulation test on ${{ matrix.build }}
if: startsWith(matrix.build, 'windows')
run: cargo test --target ${{ matrix.target }} --features sim-tests --test sim -- --exact --nocapture
fmt:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: rustfmt
- uses: Swatinem/rust-cache@v2
- run: cargo fmt --all -- --check
clippy:
runs-on: ${{ matrix.os }}
strategy:
matrix:
build:
- linux-stable
- macos-stable
- windows-stable
include:
- build: linux-stable
os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
rust: stable
- build: macos-stable
os: macos-13
target: x86_64-apple-darwin
rust: stable
- build: windows-stable
os: windows-2022
target: x86_64-pc-windows-msvc
rust: stable
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
components: clippy
- uses: Swatinem/rust-cache@v2
- run: cargo clippy --workspace --all-features --target ${{ matrix.target }} --tests -- -Dwarnings
build-docker:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- name: Build Docker image
run: docker build -t trippy-docker-image .
cargo-deny:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: EmbarkStudios/cargo-deny-action@v1
with:
log-level: warn
command: check
arguments: --all-features
cargo-msrv:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- name: install cargo-msrv
run: cargo install --git https://github.com/foresterre/cargo-msrv.git cargo-msrv
- name: check msrv for trippy
run: cargo msrv verify --output-format json --manifest-path crates/trippy/Cargo.toml -- cargo check
- name: check msrv for trippy-tui
run: cargo msrv verify --output-format json --manifest-path crates/trippy-tui/Cargo.toml -- cargo check
- name: check msrv for trippy-core
run: cargo msrv verify --output-format json --manifest-path crates/trippy-core/Cargo.toml -- cargo check
- name: check msrv for trippy-packet
run: cargo msrv verify --output-format json --manifest-path crates/trippy-packet/Cargo.toml -- cargo check
- name: check msrv for trippy-dns
run: cargo msrv verify --output-format json --manifest-path crates/trippy-dns/Cargo.toml -- cargo check
- name: check msrv for trippy-privilege
run: cargo msrv verify --output-format json --manifest-path crates/trippy-privilege/Cargo.toml -- cargo check