This repository has been archived by the owner on Dec 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
364 lines (321 loc) · 12.1 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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
name: Continuous integration
on:
pull_request:
push:
branches:
- main
jobs:
build_and_test:
name: Build and test
runs-on: ${{ matrix.runner }}
continue-on-error: false
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest]
rust: [stable]
experimental: [false]
include:
- os: ubuntu-latest
release-os: linux
release-arch: amd64
protoc-arch: linux-x86_64
runner: [self-hosted, linux, X64]
- os: macos-latest
release-os: darwin
release-arch: aarch64
protoc-arch: osx-aarch_64
runner: [self-hosted, macOS, ARM64]
# - os: windows-latest
# release-os: windows
# release-arch: amd64
# runner: [self-hosted, windows, X64]
env:
RUST_BACKTRACE: full
# Force not building debuginfo to save space on disk.
RUSTFLAGS: "-C debuginfo=0"
RUSTV: ${{ matrix.rust }}
MSRV: "1.65"
steps:
- uses: actions/checkout@master
- name: Set build arch
run: |
echo "PROTOC_ARCH=${{ matrix.protoc-arch }}" >> $GITHUB_ENV
- name: Install ${{ matrix.rust }}
run: |
rustup toolchain install --profile default ${{ matrix.rust }}
- name: Install Rust MSRV
if: matrix.os != 'windows-latest'
run: |
rustup toolchain install --profile minimal $MSRV
- name: Install Rust MSRV
if: matrix.os == 'windows-latest'
run: |
rustup toolchain install --profile minimal $Env:MSRV
- name: Install Protoc windows
if: matrix.os == 'windows-latest'
uses: arduino/setup-protoc@v1
with:
version: '3.20.1'
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Protoc
if: matrix.os != 'windows-latest'
run: |
PROTOC_VERSION=3.20.1
PROTOC_ZIP=protoc-$PROTOC_VERSION-$PROTOC_ARCH.zip
curl --retry 3 --retry-max-time 90 -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -OL https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOC_VERSION/$PROTOC_ZIP
sudo unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
sudo unzip -o $PROTOC_ZIP -d /usr/local 'include/*'
rm -f $PROTOC_ZIP
echo "PROTOC=/usr/local/bin/protoc" >> $GITHUB_ENV
echo "PROTOC_INCLUDE=/usr/local/include" >> $GITHUB_ENV
- name: check MSRV default features
if: matrix.os != 'windows-latest'
run: |
cargo +$MSRV check --workspace --all-targets
- name: check MSRV all features
if: matrix.os != 'windows-latest'
run: |
cargo +$MSRV check --workspace --all-features --all-targets
- name: check MSRV default features
if: matrix.os == 'windows-latest'
run: |
cargo +$Env:MSRV check --workspace --all-targets
- name: check MSRV all features
if: matrix.os == 'windows-latest'
run: |
cargo +$Env:MSRV check --workspace --all-features --all-targets
- name: check default features
run: |
cargo check --workspace --all-targets
- name: check all features
run: |
cargo check --workspace --all-features --all-targets
- name: clippy default features
run: |
cargo clippy --workspace --all-targets -- -D warnings
- name: clippy all features
run: |
cargo clippy --workspace --all-features --all-targets -- -D warnings
- name: docs
env:
RUSTDOCFLAGS: -Dwarnings
run: |
cargo doc --workspace --all-features --no-deps --document-private-items
- name: tests
timeout-minutes: 30
run: |
cargo test --workspace --all-features --lib --bins --tests --examples
- name: tests w/o default features
timeout-minutes: 30
run: |
cargo test --workspace --no-default-features --lib --bins --tests --examples
# build_release:
# name: Build release binaries
# runs-on: ${{ matrix.runner }}
# continue-on-error: false
# needs: build_and_test
# if: ${{ always() && github.ref_name=='main' }}
# strategy:
# fail-fast: false
# matrix:
# name: [ubuntu-latest, ubuntu-arm-latest, macOS-latest, macOS-arm-latest]
# rust: [stable]
# experimental: [false]
# include:
# - name: ubuntu-arm-latest
# os: ubuntu-latest
# release-os: linux
# release-arch: aarch64
# protoc-arch: linux-aarch_64
# runner: [self-hosted, linux, ARM64]
# - name: ubuntu-latest
# os: ubuntu-latest
# release-os: linux
# release-arch: amd64
# protoc-arch: linux-x86_64
# runner: [self-hosted, linux, X64]
# - name: macOS-latest
# os: macOS-latest
# release-os: darwin
# release-arch: x86_64
# protoc-arch: osx-x86_64
# runner: [self-hosted, macOS, X64]
# - name: macOS-arm-latest
# os: macOS-latest
# release-os: darwin
# release-arch: aarch64
# protoc-arch: osx-aarch_64
# runner: [self-hosted, macOS, ARM64]
# # - os: windows-latest
# # release-os: windows
# # release-arch: amd64
# # runner: [windows-latest]
# env:
# RUST_BACKTRACE: full
# # Force not building debuginfo to save space on disk.
# RUSTFLAGS: "-C debuginfo=0"
# RUSTV: ${{ matrix.rust }}
# steps:
# - uses: actions/checkout@master
# - name: Set build arch
# run: |
# echo "RELEASE_ARCH=${{ matrix.release-arch }}" >> $GITHUB_ENV
# echo "RELEASE_OS=${{ matrix.release-os }}" >> $GITHUB_ENV
# echo "PROTOC_ARCH=${{ matrix.protoc-arch }}" >> $GITHUB_ENV
# - name: Install ${{ matrix.rust }}
# run: |
# rustup toolchain install ${{ matrix.rust }}
# - name: Install Protoc windows
# if: matrix.os == 'windows-latest'
# uses: arduino/setup-protoc@v1
# with:
# version: '3.20.1'
# repo-token: ${{ secrets.GITHUB_TOKEN }}
# - name: Install Protoc
# if: matrix.os != 'windows-latest'
# run: |
# PROTOC_VERSION=3.20.1
# PROTOC_ZIP=protoc-$PROTOC_VERSION-$PROTOC_ARCH.zip
# curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOC_VERSION/$PROTOC_ZIP
# sudo unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
# sudo unzip -o $PROTOC_ZIP -d /usr/local 'include/*'
# rm -f $PROTOC_ZIP
# echo "PROTOC=/usr/local/bin/protoc" >> $GITHUB_ENV
# echo "PROTOC_INCLUDE=/usr/local/include" >> $GITHUB_ENV
# - name: build release
# run: |
# cargo build --profile optimized-release -p iroh -p iroh-gateway -p iroh-p2p -p iroh-store -p iroh-one
# - name: Setup awscli on linux
# if: matrix.name == 'ubuntu-latest'
# run: |
# curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
# unzip awscliv2.zip
# sudo ./aws/install --update
# - name: Setup awscli on linux
# if: matrix.name == 'ubuntu-arm-latest'
# run: |
# curl "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip" -o "awscliv2.zip"
# unzip awscliv2.zip
# sudo ./aws/install --update
# - name: Setup awscli on mac
# if: matrix.os == 'macos-latest'
# run: |
# curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"
# sudo installer -pkg AWSCLIV2.pkg -target /
# - name: Set aws credentials
# if: matrix.os != 'windows-latest'
# run: |
# echo "AWS_ACCESS_KEY_ID=${{secrets.S3_ACCESS_KEY_ID}}" >> $GITHUB_ENV
# echo "AWS_SECRET_ACCESS_KEY=${{secrets.S3_ACCESS_KEY}}" >> $GITHUB_ENV
# echo "AWS_DEFAULT_REGION=us-west-2" >> $GITHUB_ENV
# - name: push release
# if: matrix.os != 'windows-latest'
# run: |
# aws s3 cp ./target/optimized-release/iroh-gateway s3://vorc/iroh-gateway-${RELEASE_OS}-${RELEASE_ARCH}-${GITHUB_SHA::7} --no-progress
# aws s3 cp ./target/optimized-release/iroh-p2p s3://vorc/iroh-p2p-${RELEASE_OS}-${RELEASE_ARCH}-${GITHUB_SHA::7} --no-progress
# aws s3 cp ./target/optimized-release/iroh-store s3://vorc/iroh-store-${RELEASE_OS}-${RELEASE_ARCH}-${GITHUB_SHA::7} --no-progress
# aws s3 cp ./target/optimized-release/iroh s3://vorc/iroh-${RELEASE_OS}-${RELEASE_ARCH}-${GITHUB_SHA::7} --no-progress
# aws s3 cp ./target/optimized-release/iroh-one s3://vorc/iroh-one-${RELEASE_OS}-${RELEASE_ARCH}-${GITHUB_SHA::7} --no-progress
# - name: push release latest
# if: matrix.os != 'windows-latest'
# run: |
# aws s3 cp ./target/optimized-release/iroh-gateway s3://vorc/iroh-gateway-${RELEASE_OS}-${RELEASE_ARCH}-latest --no-progress
# aws s3 cp ./target/optimized-release/iroh-p2p s3://vorc/iroh-p2p-${RELEASE_OS}-${RELEASE_ARCH}-latest --no-progress
# aws s3 cp ./target/optimized-release/iroh-store s3://vorc/iroh-store-${RELEASE_OS}-${RELEASE_ARCH}-latest --no-progress
# aws s3 cp ./target/optimized-release/iroh s3://vorc/iroh-${RELEASE_OS}-${RELEASE_ARCH}-latest --no-progress
# aws s3 cp ./target/optimized-release/iroh-one s3://vorc/iroh-one-${RELEASE_OS}-${RELEASE_ARCH}-latest --no-progress
coverage:
name: Coverage
runs-on: ${{ matrix.runner }}
continue-on-error: false
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
rust: [stable]
experimental: [false]
include:
- os: ubuntu-latest
release-os: linux
release-arch: amd64
protoc-arch: linux-x86_64
runner: [self-hosted, linux, X64]
env:
RUST_BACKTRACE: full
RUSTV: ${{ matrix.rust }}
steps:
- uses: actions/checkout@master
- name: Set build arch
run: |
echo "PROTOC_ARCH=${{ matrix.protoc-arch }}" >> $GITHUB_ENV
- name: Install ${{ matrix.rust }}
run: |
rustup toolchain install --profile default ${{ matrix.rust }}
rustup component add llvm-tools-preview
- name: Install Protoc
run: |
PROTOC_VERSION=3.20.1
PROTOC_ZIP=protoc-$PROTOC_VERSION-$PROTOC_ARCH.zip
curl --retry 3 --retry-max-time 90 -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -OL https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOC_VERSION/$PROTOC_ZIP
sudo unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
sudo unzip -o $PROTOC_ZIP -d /usr/local 'include/*'
rm -f $PROTOC_ZIP
echo "PROTOC=/usr/local/bin/protoc" >> $GITHUB_ENV
echo "PROTOC_INCLUDE=/usr/local/include" >> $GITHUB_ENV
- name: Install grcov
run: |
mkdir -p "${HOME}/.local/bin"
curl -sL https://github.com/mozilla/grcov/releases/download/v0.8.10/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar jxf - -C "${HOME}/.local/bin"
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: coverage
timeout-minutes: 30
run: |
cargo xtask coverage
- name: Upload to codecov.io
uses: codecov/codecov-action@v3
with:
files: coverage/*.lcov
fmt:
name: Rustfmt
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
audit:
name: audit
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- uses: actions-rs/cargo@v1
with:
command: install
args: --force cargo-audit
- uses: actions-rs/cargo@v1
with:
command: generate-lockfile
- uses: actions-rs/cargo@v1
with:
command: audit