-
Notifications
You must be signed in to change notification settings - Fork 1.3k
103 lines (92 loc) · 2.98 KB
/
rust.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
name: Rust
on:
pull_request:
paths:
- .github/workflows/rust.yml
- Cargo.lock
- "**/Cargo.toml"
- justfile
- deny.toml
- "**/*.rs"
- policy-*/Dockerfile
- rust-toolchain.toml
- bin/rust-toolchain-version
permissions:
contents: read
env:
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
PROTOC_NO_VENDOR: 1
RUST_BACKTRACE: short
RUSTUP_MAX_RETRIES: 10
jobs:
audit:
timeout-minutes: 10
runs-on: ubuntu-22.04
strategy:
matrix:
checks:
- advisories
- bans licenses sources
# Prevent sudden announcement of a new advisory from failing Ci.
continue-on-error: ${{ matrix.checks == 'advisories' }}
steps:
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b
- uses: EmbarkStudios/cargo-deny-action@3f4a782664881cf5725d0ffd23969fcce89fd868
with:
command: check ${{ matrix.checks }}
fmt:
timeout-minutes: 5
runs-on: ubuntu-22.04
container: ghcr.io/linkerd/dev:v43-rust
steps:
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b
- run: git config --global --add safe.directory "$PWD" # actions/runner#2033
- run: just rs-check-fmt
clippy:
timeout-minutes: 20
runs-on: ubuntu-22.04
container: ghcr.io/linkerd/dev:v43-rust
steps:
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b
- run: git config --global --add safe.directory "$PWD" # actions/runner#2033
- run: just rs-fetch
- run: just rs-clippy
- run: just rs-doc --no-deps
check:
timeout-minutes: 20
runs-on: ubuntu-22.04
container: ghcr.io/linkerd/dev:v43-rust
steps:
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b
- run: git config --global --add safe.directory "$PWD" # actions/runner#2033
- run: just rs-fetch
- run: just rs-check-dirs
test:
name: test
runs-on: ubuntu-22.04
timeout-minutes: 15
container: ghcr.io/linkerd/dev:v43-rust
steps:
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b
- run: git config --global --add safe.directory "$PWD" # actions/runner#2033
- run: just rs-fetch
- run: just rs-test-build
- run: just rs-test
rust-toolchain:
name: rust toolchain
runs-on: ubuntu-22.04
timeout-minutes: 2
steps:
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b
- shell: bash
run: |
toolchain_version="$(./bin/rust-toolchain-version)"
ex=0
# Check this workflow against the version in rust-toolchain.
versions=$(sed -nE 's|.*docker://(.*/)?rust:([^ #]+).*|\2|p' .github/workflows/*)
for mismatch in $(echo "$versions" | grep -vF "$toolchain_version" || true) ; do
echo "::error file=.github/workflows/rust.yml::Workflow uses incorrect rust version(s): $mismatch (expected '$toolchain_version)')"
ex=$((ex + 1))
done
exit $ex