1
+ name : CI
2
+
3
+ on :
4
+ pull_request :
5
+ types : [ 'labeled', 'unlabeled', 'opened', 'synchronize', 'reopened' ]
6
+ merge_group :
7
+ push :
8
+ branches :
9
+ - main
10
+
11
+ concurrency :
12
+ group : ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
13
+ cancel-in-progress : true
14
+
15
+ env :
16
+ RUST_BACKTRACE : 1
17
+ RUSTFLAGS : -Dwarnings
18
+ RUSTDOCFLAGS : -Dwarnings
19
+ MSRV : " 1.76"
20
+ SCCACHE_CACHE_SIZE : " 10G"
21
+ IROH_FORCE_STAGING_RELAYS : " 1"
22
+
23
+ jobs :
24
+ tests :
25
+ name : CI Test Suite
26
+ if : " github.event_name != 'pull_request' || ! contains(github.event.pull_request.labels.*.name, 'flaky-test')"
27
+ uses : ' ./.github/workflows/tests.yaml'
28
+
29
+ cross_build :
30
+ name : Cross Build Only
31
+ if : " github.event_name != 'pull_request' || ! contains(github.event.pull_request.labels.*.name, 'flaky-test')"
32
+ timeout-minutes : 30
33
+ runs-on : [self-hosted, linux, X64]
34
+ strategy :
35
+ fail-fast : false
36
+ matrix :
37
+ target :
38
+ # cross tests are currently broken vor armv7 and aarch64
39
+ # see https://github.com/cross-rs/cross/issues/1311
40
+ # - armv7-linux-androideabi
41
+ # - aarch64-linux-android
42
+ # Freebsd execution fails in cross
43
+ # - i686-unknown-freebsd # Linking fails :/
44
+ - x86_64-unknown-freebsd
45
+ # Netbsd execution fails to link in cross
46
+ # - x86_64-unknown-netbsd
47
+ steps :
48
+ - name : Checkout
49
+ uses : actions/checkout@v4
50
+ with :
51
+ submodules : recursive
52
+
53
+ - name : Install rust stable
54
+ uses : dtolnay/rust-toolchain@stable
55
+
56
+ - name : Cleanup Docker
57
+ continue-on-error : true
58
+ run : |
59
+ docker kill $(docker ps -q)
60
+
61
+ # See https://github.com/cross-rs/cross/issues/1222
62
+ - uses : taiki-e/install-action@cross
63
+
64
+ - name : build
65
+ # cross tests are currently broken vor armv7 and aarch64
66
+ # see https://github.com/cross-rs/cross/issues/1311. So on
67
+ # those platforms we only build but do not run tests.
68
+ run : cross build --all --target ${{ matrix.target }}
69
+ env :
70
+ RUST_LOG : ${{ runner.debug && 'TRACE' || 'DEBUG'}}
71
+
72
+ android_build :
73
+ name : Android Build Only
74
+ if : " github.event_name != 'pull_request' || ! contains(github.event.pull_request.labels.*.name, 'flaky-test')"
75
+ timeout-minutes : 30
76
+ # runs-on: ubuntu-latest
77
+ runs-on : [self-hosted, linux, X64]
78
+ strategy :
79
+ fail-fast : false
80
+ matrix :
81
+ target :
82
+ - aarch64-linux-android
83
+ - armv7-linux-androideabi
84
+ steps :
85
+ - name : Checkout
86
+ uses : actions/checkout@v4
87
+
88
+ - name : Set up Rust
89
+ uses : dtolnay/rust-toolchain@stable
90
+ with :
91
+ target : ${{ matrix.target }}
92
+ - name : Install rustup target
93
+ run : rustup target add ${{ matrix.target }}
94
+
95
+ - name : Setup Java
96
+ uses : actions/setup-java@v4
97
+ with :
98
+ distribution : ' temurin'
99
+ java-version : ' 17'
100
+
101
+ - name : Setup Android SDK
102
+ uses : android-actions/setup-android@v3
103
+
104
+ - name : Setup Android NDK
105
+ uses : arqu/setup-ndk@main
106
+ id : setup-ndk
107
+ with :
108
+ ndk-version : r23
109
+ add-to-path : true
110
+
111
+ - name : Build
112
+ env :
113
+ ANDROID_NDK_HOME : ${{ steps.setup-ndk.outputs.ndk-path }}
114
+ run : |
115
+ cargo install --version 3.5.4 cargo-ndk
116
+ cargo ndk --target ${{ matrix.target }} build
117
+
118
+ cross_test :
119
+ name : Cross Test
120
+ if : " github.event_name != 'pull_request' || ! contains(github.event.pull_request.labels.*.name, 'flaky-test')"
121
+ timeout-minutes : 30
122
+ runs-on : [self-hosted, linux, X64]
123
+ strategy :
124
+ fail-fast : false
125
+ matrix :
126
+ target :
127
+ - i686-unknown-linux-gnu
128
+ steps :
129
+ - name : Checkout
130
+ uses : actions/checkout@v4
131
+ with :
132
+ submodules : recursive
133
+
134
+ - name : Install rust stable
135
+ uses : dtolnay/rust-toolchain@stable
136
+
137
+ - name : Cleanup Docker
138
+ continue-on-error : true
139
+ run : |
140
+ docker kill $(docker ps -q)
141
+
142
+ # See https://github.com/cross-rs/cross/issues/1222
143
+ - uses : taiki-e/install-action@cross
144
+
145
+ - name : test
146
+ run : cross test --all --target ${{ matrix.target }} -- --test-threads=12
147
+ env :
148
+ RUST_LOG : ${{ runner.debug && 'TRACE' || 'DEBUG' }}
149
+
150
+ check_semver :
151
+ runs-on : ubuntu-latest
152
+ env :
153
+ RUSTC_WRAPPER : " sccache"
154
+ SCCACHE_GHA_ENABLED : " on"
155
+ steps :
156
+ - uses : actions/checkout@v4
157
+ with :
158
+ fetch-depth : 0
159
+ - name : Install sccache
160
+ uses :
mozilla-actions/[email protected]
161
+
162
+ - name : Setup Environment (PR)
163
+ if : ${{ github.event_name == 'pull_request' }}
164
+ shell : bash
165
+ run : |
166
+ echo "HEAD_COMMIT_SHA=$(git rev-parse origin/${{ github.base_ref }})" >> ${GITHUB_ENV}
167
+ - name : Setup Environment (Push)
168
+ if : ${{ github.event_name == 'push' || github.event_name == 'merge_group' }}
169
+ shell : bash
170
+ run : |
171
+ echo "HEAD_COMMIT_SHA=$(git rev-parse origin/main)" >> ${GITHUB_ENV}
172
+ - name : Check semver
173
+ # uses: obi1kenobi/cargo-semver-checks-action@v2
174
+ uses : n0-computer/cargo-semver-checks-action@feat-baseline
175
+ with :
176
+ package : iroh-gossip
177
+ baseline-rev : ${{ env.HEAD_COMMIT_SHA }}
178
+ use-cache : false
179
+
180
+ check_fmt :
181
+ timeout-minutes : 30
182
+ name : Checking fmt
183
+ runs-on : ubuntu-latest
184
+ env :
185
+ RUSTC_WRAPPER : " sccache"
186
+ SCCACHE_GHA_ENABLED : " on"
187
+ steps :
188
+ - uses : actions/checkout@v4
189
+ - uses : dtolnay/rust-toolchain@stable
190
+ with :
191
+ components : rustfmt
192
+ -
uses :
mozilla-actions/[email protected]
193
+ - uses : taiki-e/install-action@cargo-make
194
+ - run : cargo make format-check
195
+
196
+ check_docs :
197
+ timeout-minutes : 30
198
+ name : Checking docs
199
+ runs-on : ubuntu-latest
200
+ env :
201
+ RUSTC_WRAPPER : " sccache"
202
+ SCCACHE_GHA_ENABLED : " on"
203
+ steps :
204
+ - uses : actions/checkout@v4
205
+ - uses : dtolnay/rust-toolchain@master
206
+ with :
207
+ toolchain : nightly-2024-05-02
208
+ - name : Install sccache
209
+ uses :
mozilla-actions/[email protected]
210
+
211
+ - name : Docs
212
+ run : cargo doc --workspace --all-features --no-deps --document-private-items
213
+ env :
214
+ RUSTDOCFLAGS : --cfg docsrs
215
+
216
+ clippy_check :
217
+ timeout-minutes : 30
218
+ runs-on : ubuntu-latest
219
+ env :
220
+ RUSTC_WRAPPER : " sccache"
221
+ SCCACHE_GHA_ENABLED : " on"
222
+ steps :
223
+ - uses : actions/checkout@v4
224
+ - uses : dtolnay/rust-toolchain@stable
225
+ with :
226
+ components : clippy
227
+ - name : Install sccache
228
+ uses :
mozilla-actions/[email protected]
229
+
230
+ # TODO: We have a bunch of platform-dependent code so should
231
+ # probably run this job on the full platform matrix
232
+ - name : clippy check (all features)
233
+ run : cargo clippy --workspace --all-features --all-targets --bins --tests --benches
234
+
235
+ - name : clippy check (no features)
236
+ run : cargo clippy --workspace --no-default-features --lib --bins --tests
237
+
238
+ - name : clippy check (default features)
239
+ run : cargo clippy --workspace --all-targets
240
+
241
+ msrv :
242
+ if : " github.event_name != 'pull_request' || ! contains(github.event.pull_request.labels.*.name, 'flaky-test')"
243
+ timeout-minutes : 30
244
+ name : Minimal Supported Rust Version
245
+ runs-on : ubuntu-latest
246
+ env :
247
+ RUSTC_WRAPPER : " sccache"
248
+ SCCACHE_GHA_ENABLED : " on"
249
+ steps :
250
+ - uses : actions/checkout@v4
251
+ - uses : dtolnay/rust-toolchain@master
252
+ with :
253
+ toolchain : ${{ env.MSRV }}
254
+ - name : Install sccache
255
+ uses :
mozilla-actions/[email protected]
256
+
257
+ - name : Check MSRV all features
258
+ run : |
259
+ cargo +$MSRV check --workspace --all-targets
260
+
261
+ cargo_deny :
262
+ timeout-minutes : 30
263
+ name : cargo deny
264
+ runs-on : ubuntu-latest
265
+ steps :
266
+ - uses : actions/checkout@v4
267
+ - uses : EmbarkStudios/cargo-deny-action@v2
268
+ with :
269
+ arguments : --workspace --all-features
270
+ command : check
271
+ command-arguments : " -Dwarnings"
272
+
273
+ codespell :
274
+ timeout-minutes : 30
275
+ runs-on : ubuntu-latest
276
+ steps :
277
+ - uses : actions/checkout@v4
278
+ - run : pip install --user codespell[toml]
279
+ - run : codespell --ignore-words-list=ans,atmost,crate,inout,ratatui,ser,stayin,swarmin,worl --skip=CHANGELOG.md
0 commit comments