forked from coreos/coreos-installer
-
Notifications
You must be signed in to change notification settings - Fork 0
259 lines (255 loc) · 8.42 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
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
name: Rust
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
# s390x tests are expensive; don't waste job slots on superseded code
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CONTAINER: registry.fedoraproject.org/fedora:latest
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
# Pinned toolchain for linting
ACTIONS_LINTS_TOOLCHAIN: 1.71.0
defaults:
run:
# Created by env-setup early in the job
shell: 'wrap-container {0}'
jobs:
tests-stable:
name: "Tests, stable toolchain"
runs-on: ubuntu-latest
strategy:
# Keep x86_64 jobs alive if s390x jobs fail
fail-fast: false
matrix:
arch:
- x86_64
- s390x
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up environment
run: .github/workflows/env-setup
shell: bash
env:
ARCH: ${{ matrix.arch }}
TOOLCHAIN: stable
- name: Cache build artifacts
uses: Swatinem/rust-cache@v2
with:
# rust-cache creates a separate cache key for each job definition,
# but bases it on the Rust version in the host, not the container.
# Specify additional fields not implied by the job name.
key: ${{ matrix.arch }}
- name: Install dependencies
run: dnf install -y gcc git-core libzstd-devel openssl-devel cpio diffutils jq xz
- name: Configure cargo
run: |
# Avoid OOM on emulated s390x
# https://github.com/rust-lang/cargo/issues/10583
mkdir -p .cargo
cat >> .cargo/config.toml <<EOF
[net]
git-fetch-with-cli = true
EOF
- name: cargo build
run: cargo build --all-targets
- name: cargo test
run: cargo test --all-targets
- name: cargo build (rdcore)
run: cargo build --all-targets --features rdcore
- name: cargo test (rdcore)
run: cargo test --all-targets --features rdcore
- name: Image tests
if: ${{ matrix.arch == 'x86_64' }}
run: tests/images.sh
tests-msrv:
name: "Tests, minimum supported toolchain"
runs-on: ubuntu-latest
strategy:
# Keep x86_64 jobs alive if s390x jobs fail
fail-fast: false
matrix:
arch:
- x86_64
- s390x
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Detect crate MSRV
shell: bash
run: |
msrv=$(cargo metadata --format-version 1 --no-deps | \
jq -r '.packages | .[].rust_version')
echo "Crate MSRV: $msrv"
echo "MSRV=$msrv" >> $GITHUB_ENV
- name: Set up environment
run: .github/workflows/env-setup
shell: bash
env:
ARCH: ${{ matrix.arch }}
TOOLCHAIN: ${{ env.MSRV }}
- name: Cache build artifacts
uses: Swatinem/rust-cache@v2
with:
# rust-cache creates a separate cache key for each job definition,
# but bases it on the Rust version in the host, not the container.
# Specify additional fields not implied by the job name, plus the
# numeric MSRV as an optimization to ignore the old cache after the
# MSRV changes.
key: ${{ matrix.arch }}-${{ env.MSRV }}
- name: Install dependencies
run: dnf install -y gcc git-core libzstd-devel openssl-devel cpio diffutils jq xz
- name: Configure cargo
run: |
# Avoid OOM on emulated s390x
# https://github.com/rust-lang/cargo/issues/10583
mkdir -p .cargo
cat >> .cargo/config.toml <<EOF
[net]
git-fetch-with-cli = true
EOF
- name: cargo build
run: cargo build --all-targets
- name: cargo test
run: cargo test --all-targets
- name: cargo build (rdcore)
run: cargo build --all-targets --features rdcore
- name: cargo test (rdcore)
run: cargo test --all-targets --features rdcore
- name: Image tests
if: ${{ matrix.arch == 'x86_64' }}
run: tests/images.sh
lints:
name: "Lints, pinned toolchain"
runs-on: ubuntu-latest
strategy:
# Keep x86_64 jobs alive if s390x jobs fail
fail-fast: false
matrix:
arch:
- x86_64
- s390x
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up environment
run: .github/workflows/env-setup
shell: bash
env:
ARCH: ${{ matrix.arch }}
TOOLCHAIN: ${{ env.ACTIONS_LINTS_TOOLCHAIN }}
COMPONENTS: rustfmt,clippy
- name: Cache build artifacts
uses: Swatinem/rust-cache@v2
with:
# rust-cache creates a separate cache key for each job definition,
# but bases it on the Rust version in the host, not the container.
# Specify additional fields not implied by the job name, plus the
# numeric version as an optimization to ignore the old cache after
# the lint toolchain changes.
key: ${{ matrix.arch }}-${{ env.ACTIONS_LINTS_TOOLCHAIN }}
- name: Install dependencies
run: dnf install -y gcc git-core libzstd-devel openssl-devel
- name: Configure cargo
run: |
# Avoid OOM on emulated s390x
# https://github.com/rust-lang/cargo/issues/10583
mkdir -p .cargo
cat >> .cargo/config.toml <<EOF
[net]
git-fetch-with-cli = true
EOF
- name: cargo fmt (check)
run: cargo fmt -- --check -l
- name: cargo clippy (warnings)
run: cargo clippy --all-targets -- -D warnings
- name: cargo clippy (rdcore, warnings)
run: cargo clippy --all-targets --features rdcore -- -D warnings
tests-other-channels:
name: "Tests, unstable toolchain"
runs-on: ubuntu-latest
continue-on-error: true
strategy:
matrix:
channel:
- "beta"
- "nightly"
arch:
- x86_64
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up environment
run: .github/workflows/env-setup
shell: bash
env:
ARCH: ${{ matrix.arch }}
TOOLCHAIN: ${{ matrix.channel }}
- name: Cache build artifacts
uses: Swatinem/rust-cache@v2
with:
# rust-cache creates a separate cache key for each job definition,
# but bases it on the Rust version in the host, not the container.
# Specify additional fields not implied by the job name.
key: ${{ matrix.arch }}-${{ matrix.channel }}
- name: Install dependencies
run: dnf install -y gcc git-core libzstd-devel openssl-devel cpio diffutils jq xz
- name: Configure cargo
run: |
# Avoid OOM on emulated s390x
# https://github.com/rust-lang/cargo/issues/10583
mkdir -p .cargo
cat >> .cargo/config.toml <<EOF
[net]
git-fetch-with-cli = true
EOF
- name: cargo build
run: cargo build --all-targets
- name: cargo test
run: cargo test --all-targets
- name: cargo build (rdcore)
run: cargo build --all-targets --features rdcore
- name: cargo test (rdcore)
run: cargo test --all-targets --features rdcore
- name: Image tests
if: ${{ matrix.arch == 'x86_64' }}
run: tests/images.sh
docs:
name: "Docs"
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up environment
run: .github/workflows/env-setup
shell: bash
env:
ARCH: x86_64
TOOLCHAIN: stable
- name: Cache build artifacts
uses: Swatinem/rust-cache@v2
- name: Install dependencies
run: dnf install -y gcc git-core libzstd-devel openssl-devel util-linux
- name: cargo build
run: cargo build
- name: Help text line length
run: tests/help.sh
- name: Config file docs
run: tests/docs-config-file.sh
- name: Command-line docs
run: |
rm man/*.8
make docs
if [ -n "$(git status --porcelain data docs man)" ]; then
echo "Found local changes after regenerating docs:"
git --no-pager diff --color=always docs man
echo "Rerun 'make docs'."
exit 1
fi