Skip to content

Commit 3a0656d

Browse files
authored
fix: skip cargo test for release builds on ordinary CI because it is slow, particularly with --all-features set (#2276)
I put this PR together because I noticed I have to wait quite a bit longer on my PRs since we added #2242 to catch more build issues. I think we should think about reigning in our use of create features, but this should be good enough to speed things up for now.
1 parent bb9ce3c commit 3a0656d

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

.github/workflows/rust-ci.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,9 @@ jobs:
5353
- runner: macos-14
5454
target: x86_64-apple-darwin
5555
profile: dev
56-
- runner: macos-14
57-
target: aarch64-apple-darwin
58-
profile: release
5956
- runner: ubuntu-24.04
6057
target: x86_64-unknown-linux-musl
6158
profile: dev
62-
- runner: ubuntu-24.04
63-
target: x86_64-unknown-linux-musl
64-
profile: release
6559
- runner: ubuntu-24.04
6660
target: x86_64-unknown-linux-gnu
6761
profile: dev
@@ -75,6 +69,15 @@ jobs:
7569
target: x86_64-pc-windows-msvc
7670
profile: dev
7771

72+
# Also run representative release builds on Mac and Linux because
73+
# there could be release-only build errors we want to catch.
74+
- runner: macos-14
75+
target: aarch64-apple-darwin
76+
profile: release
77+
- runner: ubuntu-24.04
78+
target: x86_64-unknown-linux-musl
79+
profile: release
80+
7881
steps:
7982
- uses: actions/checkout@v4
8083
- uses: dtolnay/[email protected]
@@ -108,12 +111,14 @@ jobs:
108111
# slower, we only do this for the x86_64-unknown-linux-gnu target.
109112
- name: cargo build individual crates
110113
id: build
111-
if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' }}
114+
if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' && matrix.profile != 'release' }}
112115
continue-on-error: true
113116
run: find . -name Cargo.toml -mindepth 2 -maxdepth 2 -print0 | xargs -0 -n1 -I{} bash -c 'cd "$(dirname "{}")" && cargo build --profile ${{ matrix.profile }}'
114117

115118
- name: cargo test
116119
id: test
120+
# `cargo test` takes too long for release builds to run them on every PR
121+
if: ${{ matrix.profile != 'release' }}
117122
continue-on-error: true
118123
run: cargo test --all-features --target ${{ matrix.target }} --profile ${{ matrix.profile }}
119124
env:

0 commit comments

Comments
 (0)