-
Notifications
You must be signed in to change notification settings - Fork 2.4k
270 lines (253 loc) · 8.74 KB
/
main.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
name: CI
on:
push:
branches:
- auto-cargo
- try
- automation/bors/try
pull_request:
branches:
- "**"
defaults:
run:
shell: bash
permissions:
contents: read
concurrency:
group: "${{ github.workflow }}-${{ (github.ref == 'refs/heads/try' && github.sha) || github.ref }}"
cancel-in-progress: true
jobs:
success:
permissions:
contents: none
name: bors build finished
needs:
- build_std
- clippy
- msrv
- docs
- lockfile
- resolver
- rustfmt
- test
- test_gitoxide
runs-on: ubuntu-latest
if: "success() && github.event_name == 'push' && (github.ref == 'refs/heads/auto-cargo' || github.ref == 'refs/heads/try') && github.repository == 'rust-lang/cargo'"
steps:
- run: echo ok
failure:
permissions:
contents: none
name: bors build finished
needs:
- build_std
- clippy
- msrv
- docs
- lockfile
- resolver
- rustfmt
- test
- test_gitoxide
runs-on: ubuntu-latest
if: "!success() && github.event_name == 'push' && (github.ref == 'refs/heads/auto-cargo' || github.ref == 'refs/heads/try') && github.repository == 'rust-lang/cargo'"
steps:
- run: exit 1
# Check Code style quickly by running `rustfmt` over all code
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup update stable && rustup default stable
- run: rustup component add rustfmt
- run: cargo fmt --all --check
# Ensure there are no clippy warnings
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup update stable && rustup default stable
- run: rustup component add clippy
- run: cargo clippy --workspace --all-targets --no-deps -- -D warnings
stale-label:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup update stable && rustup default stable
- run: cargo stale-label
# Ensure Cargo.lock is up-to-date
lockfile:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup update stable && rustup default stable
- run: cargo update -p cargo --locked
check-version-bump:
runs-on: ubuntu-latest
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha != '' && github.event.pull_request.head.sha || github.sha }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: rustup update stable && rustup default stable
- name: Install cargo-semver-checks
run: |
mkdir installed-bins
curl -Lf https://github.com/obi1kenobi/cargo-semver-checks/releases/download/v0.29.0/cargo-semver-checks-x86_64-unknown-linux-gnu.tar.gz \
| tar -xz --directory=./installed-bins
echo `pwd`/installed-bins >> $GITHUB_PATH
- run: ci/validate-version-bump.sh
test:
runs-on: ${{ matrix.os }}
env:
CARGO_PROFILE_DEV_DEBUG: 1
CARGO_PROFILE_TEST_DEBUG: 1
CARGO_INCREMENTAL: 0
CARGO_PUBLIC_NETWORK_TESTS: 1
# Workaround for https://github.com/rust-lang/rustup/issues/3036
RUSTUP_WINDOWS_PATH_ADD_BIN: 0
strategy:
matrix:
include:
- name: Linux x86_64 stable
os: ubuntu-latest
rust: stable
other: i686-unknown-linux-gnu
- name: Linux x86_64 beta
os: ubuntu-latest
rust: beta
other: i686-unknown-linux-gnu
- name: Linux x86_64 nightly
os: ubuntu-latest
rust: nightly
other: i686-unknown-linux-gnu
- name: macOS x86_64 stable
os: macos-latest
rust: stable
other: x86_64-apple-ios
- name: macOS x86_64 nightly
os: macos-latest
rust: nightly
other: x86_64-apple-ios
- name: macOS aarch64 stable
os: macos-14
rust: stable
other: x86_64-apple-darwin
- name: Windows x86_64 MSVC stable
os: windows-latest
rust: stable-msvc
other: i686-pc-windows-msvc
- name: Windows x86_64 gnu nightly # runs out of space while trying to link the test suite
os: windows-latest
rust: nightly-gnu
other: i686-pc-windows-gnu
name: Tests ${{ matrix.name }}
steps:
- uses: actions/checkout@v4
- name: Dump Environment
run: ci/dump-environment.sh
# Some tests require stable. Make sure it is set to the most recent stable
# so that we can predictably handle updates if necessary (and not randomly
# when GitHub updates its image).
- run: rustup update --no-self-update stable
- run: rustup update --no-self-update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
- run: rustup target add ${{ matrix.other }}
- run: rustup component add rustc-dev llvm-tools-preview rust-docs
if: startsWith(matrix.rust, 'nightly')
- run: sudo apt update -y && sudo apt install lldb gcc-multilib libsecret-1-0 libsecret-1-dev -y
if: matrix.os == 'ubuntu-latest'
- run: rustup component add rustfmt || echo "rustfmt not available"
- name: Configure extra test environment
run: echo CARGO_CONTAINER_TESTS=1 >> $GITHUB_ENV
if: matrix.os == 'ubuntu-latest'
- run: cargo test -p cargo
- name: Clear intermediate test output
run: ci/clean-test-output.sh
- name: gitoxide tests (all git-related tests)
run: cargo test -p cargo git
env:
__CARGO_USE_GITOXIDE_INSTEAD_OF_GIT2: 1
# The testsuite generates a huge amount of data, and fetch-smoke-test was
# running out of disk space.
- name: Clear test output
run: ci/clean-test-output.sh
# This only tests `cargo fix` because fix-proxy-mode is one of the most
# complicated subprocess management in Cargo.
- name: Check operability of rustc invocation with argfile
run: 'cargo test -p cargo --test testsuite -- fix::'
env:
__CARGO_TEST_FORCE_ARGFILE: 1
- run: cargo test --workspace --exclude cargo --exclude benchsuite --exclude resolver-tests
- name: Check benchmarks
run: |
# This only tests one benchmark since it can take over 10 minutes to
# download all workspaces.
cargo test -p benchsuite --all-targets -- cargo
cargo check -p capture
# The testsuite generates a huge amount of data, and fetch-smoke-test was
# running out of disk space.
- name: Clear benchmark output
run: ci/clean-test-output.sh
- name: Fetch smoke test
run: ci/fetch-smoke-test.sh
resolver:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup update stable && rustup default stable
- run: cargo test -p resolver-tests
test_gitoxide:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup update --no-self-update stable && rustup default stable
- run: rustup target add i686-unknown-linux-gnu
- run: sudo apt update -y && sudo apt install gcc-multilib libsecret-1-0 libsecret-1-dev -y
- run: rustup component add rustfmt || echo "rustfmt not available"
- run: cargo test -p cargo
env:
__CARGO_USE_GITOXIDE_INSTEAD_OF_GIT2: 1
build_std:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup update nightly && rustup default nightly
- run: rustup component add rust-src
- run: cargo build
- run: cargo test -p cargo --test build-std
env:
CARGO_RUN_BUILD_STD_TESTS: 1
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup update nightly && rustup default nightly
- run: rustup update stable
- run: rustup component add rust-docs
- run: ci/validate-man.sh
# This requires rustfmt, use stable.
- name: Run semver-check
run: cargo +stable run -p semver-check
- name: Ensure intradoc links are valid
run: cargo doc --workspace --document-private-items --no-deps
env:
RUSTDOCFLAGS: -D warnings
- name: Install mdbook
run: |
mkdir mdbook
curl -Lf https://github.com/rust-lang/mdBook/releases/download/v0.4.37/mdbook-v0.4.37-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook
echo `pwd`/mdbook >> $GITHUB_PATH
- run: cd src/doc && mdbook build --dest-dir ../../target/doc
- name: Run linkchecker.sh
run: |
cd target
curl -sSLO https://raw.githubusercontent.com/rust-lang/rust/master/src/tools/linkchecker/linkcheck.sh
sh linkcheck.sh --all --path ../src/doc cargo
msrv:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: taiki-e/install-action@cargo-hack
- run: cargo hack check --all-targets --rust-version --workspace --ignore-private --locked