Skip to content

Commit 9ff6d0d

Browse files
committed
Improve GitHub Actions CI config
1 parent a383063 commit 9ff6d0d

File tree

1 file changed

+41
-2
lines changed

1 file changed

+41
-2
lines changed

.github/workflows/main.yml

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
name: CI
22
on:
33
push:
4-
branches-ignore: [master]
4+
branches:
5+
- auto-cargo
6+
- try
7+
- automation/bors/try
8+
- "rust-**"
59
pull_request:
6-
branches: ['*']
10+
branches:
11+
- "**"
712

813
defaults:
914
run:
@@ -12,6 +17,10 @@ defaults:
1217
permissions:
1318
contents: read
1419

20+
concurrency:
21+
group: "${{ github.workflow }}-${{ (github.ref == 'refs/heads/try' && github.sha) || github.ref }}"
22+
cancel-in-progress: true
23+
1524
jobs:
1625
success:
1726
permissions:
@@ -53,17 +62,23 @@ jobs:
5362
# Check Code style quickly by running `rustfmt` over all code
5463
rustfmt:
5564
runs-on: ubuntu-latest
65+
if: "github.repository == 'rust-lang/cargo'"
5666
steps:
5767
- uses: actions/checkout@v4
68+
with:
69+
fetch-depth: 2
5870
- run: rustup update stable && rustup default stable
5971
- run: rustup component add rustfmt
6072
- run: cargo fmt --all --check
6173

6274
# Ensure there are no clippy warnings
6375
clippy:
6476
runs-on: ubuntu-latest
77+
if: "github.repository == 'rust-lang/cargo'"
6578
steps:
6679
- uses: actions/checkout@v4
80+
with:
81+
fetch-depth: 2
6782
- run: rustup update stable && rustup default stable
6883
- run: rustup component add clippy
6984
- run: cargo clippy --workspace --all-targets --no-deps -- -D warnings
@@ -72,19 +87,25 @@ jobs:
7287
runs-on: ubuntu-latest
7388
steps:
7489
- uses: actions/checkout@v4
90+
with:
91+
fetch-depth: 2
7592
- run: rustup update stable && rustup default stable
7693
- run: cargo stale-label
7794

7895
# Ensure Cargo.lock is up-to-date
7996
lockfile:
8097
runs-on: ubuntu-latest
98+
if: "github.repository == 'rust-lang/cargo'"
8199
steps:
82100
- uses: actions/checkout@v4
101+
with:
102+
fetch-depth: 2
83103
- run: rustup update stable && rustup default stable
84104
- run: cargo update -p cargo --locked
85105

86106
check-version-bump:
87107
runs-on: ubuntu-latest
108+
if: "github.repository == 'rust-lang/cargo'"
88109
env:
89110
BASE_SHA: ${{ github.event.pull_request.base.sha }}
90111
HEAD_SHA: ${{ github.event.pull_request.head.sha != '' && github.event.pull_request.head.sha || github.sha }}
@@ -108,6 +129,7 @@ jobs:
108129
CARGO_PROFILE_TEST_DEBUG: 1
109130
CARGO_INCREMENTAL: 0
110131
CARGO_PUBLIC_NETWORK_TESTS: 1
132+
if: "github.repository == 'rust-lang/cargo'"
111133
strategy:
112134
matrix:
113135
include:
@@ -142,6 +164,8 @@ jobs:
142164
name: Tests ${{ matrix.name }}
143165
steps:
144166
- uses: actions/checkout@v4
167+
with:
168+
fetch-depth: 2
145169
- name: Dump Environment
146170
run: ci/dump-environment.sh
147171
- run: rustup update --no-self-update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
@@ -191,15 +215,21 @@ jobs:
191215

192216
resolver:
193217
runs-on: ubuntu-latest
218+
if: "github.repository == 'rust-lang/cargo'"
194219
steps:
195220
- uses: actions/checkout@v4
221+
with:
222+
fetch-depth: 2
196223
- run: rustup update stable && rustup default stable
197224
- run: cargo test -p resolver-tests
198225

199226
test_gitoxide:
200227
runs-on: ubuntu-latest
228+
if: "github.repository == 'rust-lang/cargo'"
201229
steps:
202230
- uses: actions/checkout@v4
231+
with:
232+
fetch-depth: 2
203233
- run: rustup update --no-self-update stable && rustup default stable
204234
- run: rustup target add i686-unknown-linux-gnu
205235
- run: sudo apt update -y && sudo apt install gcc-multilib libsecret-1-0 libsecret-1-dev -y
@@ -210,8 +240,11 @@ jobs:
210240

211241
build_std:
212242
runs-on: ubuntu-latest
243+
if: "github.repository == 'rust-lang/cargo'"
213244
steps:
214245
- uses: actions/checkout@v4
246+
with:
247+
fetch-depth: 2
215248
- run: rustup update nightly && rustup default nightly
216249
- run: rustup component add rust-src
217250
- run: cargo build
@@ -220,8 +253,11 @@ jobs:
220253
CARGO_RUN_BUILD_STD_TESTS: 1
221254
docs:
222255
runs-on: ubuntu-latest
256+
if: "github.repository == 'rust-lang/cargo'"
223257
steps:
224258
- uses: actions/checkout@v4
259+
with:
260+
fetch-depth: 2
225261
- run: rustup update nightly && rustup default nightly
226262
- run: rustup update stable
227263
- run: rustup component add rust-docs
@@ -247,7 +283,10 @@ jobs:
247283
248284
msrv:
249285
runs-on: ubuntu-latest
286+
if: "github.repository == 'rust-lang/cargo'"
250287
steps:
251288
- uses: actions/checkout@v4
289+
with:
290+
fetch-depth: 2
252291
- uses: taiki-e/install-action@cargo-hack
253292
- run: cargo hack check --all-targets --rust-version --workspace --ignore-private

0 commit comments

Comments
 (0)