Skip to content

Commit 9786fac

Browse files
ci: Restructure CI process (#2599)
This PR contains several improvements to our CI process which aim to make the CI workflow cleaner and to make it easier to configure required tests in code. ## Restructuring Before the change: <img width="1642" height="1161" alt="image" src="https://github.com/user-attachments/assets/4a0b9ddc-ed45-4e21-b4a7-50625ee0e350" /> After the change: <img width="1642" height="1161" alt="image" src="https://github.com/user-attachments/assets/6d3f37d2-0150-45f3-b8e1-5060180b555b" /> After the change, with some of the groups expanded: <img width="1642" height="1161" alt="image" src="https://github.com/user-attachments/assets/9727ebcb-d642-4989-882f-15b83e8e44f8" /> As can be observed in the screenshots, this restructuring makes it clearer what all the CI check is doing, when viewing the workflow summary in CI. The restructure also moves the Swift tests from a separate workflow file into the main `ci.yml` file. ## Functional changes This PR also adds a "Check required jobs" job, which passes only if all other jobs in `ci.yml` pass. We intend to make this check the only required status from `ci.yml` to make PRs mergeable. Making "Check required jobs" required will indirectly make the previously non-required checks required: Test Node, Test Swift, and the `-Funstable-mobile-app` tests. With this change, it is now also possible to configure the required checks in code. Also, this PR adds an optimization, so that any in progress jobs are cancelled if a new commit is pushed to the branch. Closes #2509 Closes #2558 Closes #2597
1 parent 49afbb4 commit 9786fac

File tree

5 files changed

+153
-88
lines changed

5 files changed

+153
-88
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -9,97 +9,38 @@ on:
99

1010
pull_request:
1111

12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
14+
cancel-in-progress: true
15+
1216
env:
1317
RUSTFLAGS: -Dwarnings
1418

1519
jobs:
16-
lint-each-os:
17-
strategy:
18-
fail-fast: false
19-
matrix:
20-
os: [ubuntu-24.04, macos-14, windows-2022]
21-
feature-args: ['', '-Funstable-mobile-app']
22-
include:
23-
- feature-args: ''
24-
feature-suffix: ''
25-
- feature-args: '-Funstable-mobile-app'
26-
feature-suffix: ', mobile-app'
27-
28-
name: Lint (${{ matrix.os }}${{ matrix.feature-suffix }})
29-
runs-on: ${{ matrix.os }}
30-
steps:
31-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
32-
33-
- name: Install Rust Toolchain
34-
run: rustup toolchain install stable --profile minimal --component clippy --component rustfmt --no-self-update
35-
36-
- uses: swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # 2.8.0
37-
38-
- name: Run Rustfmt
39-
run: cargo fmt --all -- --check
40-
41-
- name: Run Clippy
42-
run: cargo clippy --workspace --tests ${{ matrix.feature-args }}
43-
4420
lint:
45-
needs: lint-each-os
46-
runs-on: ubuntu-24.04
47-
if: always() # Run even if lint-each-os fails
4821
name: Lint
49-
steps:
50-
- name: Check for lint failures
51-
if: contains(needs.lint-each-os.result, 'failure') || contains(needs.lint-each-os.result, 'skipped')
52-
run: |
53-
echo "Required lint check failed. You need to fix the problem before merging."
54-
exit 1
22+
uses: ./.github/workflows/lint.yml
5523

5624
test:
57-
strategy:
58-
fail-fast: false
59-
matrix:
60-
os: [ubuntu-24.04, macos-14, windows-2022]
61-
feature-args: ['', '-Funstable-mobile-app']
62-
include:
63-
- feature-args: ''
64-
feature-suffix: ''
65-
- feature-args: '-Funstable-mobile-app'
66-
feature-suffix: ', mobile-app'
67-
68-
name: Test (${{ matrix.os }}${{ matrix.feature-suffix }})
69-
runs-on: ${{ matrix.os }}
70-
71-
steps:
72-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
73-
74-
- uses: swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # 2.8.0
75-
with:
76-
key: ${{ github.job }}
77-
78-
- name: Run Cargo Tests
79-
run: cargo test --all ${{ matrix.feature-args }}
25+
name: Test
26+
uses: ./.github/workflows/test.yml
8027

8128
test_node:
82-
strategy:
83-
fail-fast: false
84-
matrix:
85-
node-version: [10.x, 12.x, 14.x, 16.x, 18.x, 20.x]
29+
name: Test Node
30+
uses: ./.github/workflows/test_node.yml
8631

87-
name: Test Node ${{ matrix.node-version }}
88-
runs-on: ubuntu-24.04
32+
test_swift:
33+
name: Test Swift
34+
uses: ./.github/workflows/swift-test.yml
8935

36+
required:
37+
name: Check required jobs
38+
runs-on: ubuntu-24.04
39+
needs: [lint, test, test_node, test_swift]
40+
if: always()
9041
steps:
91-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
92-
93-
- name: Use Node.js ${{ matrix.node-version }}
94-
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # 4.4.0
95-
with:
96-
node-version: ${{ matrix.node-version }}
97-
98-
# We need to skip the fallback download because downloading will fail on release branches because the new version isn't available yet.
99-
- run: SENTRYCLI_SKIP_DOWNLOAD=1 npm install
100-
101-
# older node versions need an older nft
102-
- run: SENTRYCLI_SKIP_DOWNLOAD=1 npm install @vercel/nft@0.22.1
103-
if: matrix.node-version == '10.x' || matrix.node-version == '12.x'
104-
105-
- run: npm test
42+
- name: Check for failure
43+
if: ${{ needs.lint.result != 'success' || needs.test.result != 'success' || needs.test_node.result != 'success' || needs.test_swift.result != 'success' }}
44+
run: |
45+
echo "One or more jobs failed"
46+
exit 1

.github/workflows/lint.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Lint
2+
3+
on:
4+
workflow_call:
5+
outputs:
6+
matrix-result:
7+
description: 'Matrix job result'
8+
value: ${{ jobs.lint.result }}
9+
10+
env:
11+
RUSTFLAGS: -Dwarnings
12+
13+
jobs:
14+
lint:
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
os: [ubuntu-24.04, macos-14, windows-2022]
19+
feature-args: ['', '-Funstable-mobile-app']
20+
include:
21+
- os: ubuntu-24.04
22+
display-os: Linux
23+
- os: macos-14
24+
display-os: macOS
25+
- os: windows-2022
26+
display-os: Windows
27+
- feature-args: ''
28+
feature-suffix: ''
29+
- feature-args: '-Funstable-mobile-app'
30+
feature-suffix: ' (-Funstable-mobile-app)'
31+
32+
name: ${{ matrix.display-os }}${{ matrix.feature-suffix }}
33+
runs-on: ${{ matrix.os }}
34+
steps:
35+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
36+
37+
- name: Install Rust Toolchain
38+
run: rustup toolchain install stable --profile minimal --component clippy --component rustfmt --no-self-update
39+
40+
- uses: swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # 2.8.0
41+
42+
- name: Run Rustfmt
43+
run: cargo fmt --all -- --check
44+
45+
- name: Run Clippy
46+
run: cargo clippy --workspace --tests ${{ matrix.feature-args }}

.github/workflows/swift-test.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
name: Swift Test
1+
name: Test Swift
22

33
on:
4-
push:
5-
branches:
6-
- master
7-
- release/**
8-
9-
pull_request:
4+
workflow_call:
5+
outputs:
6+
matrix-result:
7+
description: 'Job result'
8+
value: ${{ jobs.run-tests.result }}
109

1110
jobs:
1211
run-tests:
12+
name: Run tests
1313
runs-on: macos-15
1414
steps:
1515
- name: Checkout code

.github/workflows/test.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Test
2+
3+
on:
4+
workflow_call:
5+
outputs:
6+
matrix-result:
7+
description: 'Matrix job result'
8+
value: ${{ jobs.test.result }}
9+
10+
env:
11+
RUSTFLAGS: -Dwarnings
12+
13+
jobs:
14+
test:
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
os: [ubuntu-24.04, macos-14, windows-2022]
19+
feature-args: ['', '-Funstable-mobile-app']
20+
include:
21+
- os: ubuntu-24.04
22+
display-os: Linux
23+
- os: macos-14
24+
display-os: macOS
25+
- os: windows-2022
26+
display-os: Windows
27+
- feature-args: ''
28+
feature-suffix: ''
29+
- feature-args: '-Funstable-mobile-app'
30+
feature-suffix: ' (-Funstable-mobile-app)'
31+
32+
name: ${{ matrix.display-os }}${{ matrix.feature-suffix }}
33+
runs-on: ${{ matrix.os }}
34+
35+
steps:
36+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
37+
38+
- uses: swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # 2.8.0
39+
with:
40+
key: ${{ github.job }}
41+
42+
- name: Run Cargo Tests
43+
run: cargo test --all ${{ matrix.feature-args }}

.github/workflows/test_node.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Test Node
2+
3+
on:
4+
workflow_call:
5+
outputs:
6+
matrix-result:
7+
description: 'Matrix job result'
8+
value: ${{ jobs.test_node.result }}
9+
10+
jobs:
11+
test_node:
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
node-version: [10.x, 12.x, 14.x, 16.x, 18.x, 20.x]
16+
17+
name: Test Node ${{ matrix.node-version }}
18+
runs-on: ubuntu-24.04
19+
20+
steps:
21+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
22+
23+
- name: Use Node.js ${{ matrix.node-version }}
24+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # 4.4.0
25+
with:
26+
node-version: ${{ matrix.node-version }}
27+
28+
# We need to skip the fallback download because downloading will fail on release branches because the new version isn't available yet.
29+
- run: SENTRYCLI_SKIP_DOWNLOAD=1 npm install
30+
31+
# older node versions need an older nft
32+
- run: SENTRYCLI_SKIP_DOWNLOAD=1 npm install @vercel/nft@0.22.1
33+
if: matrix.node-version == '10.x' || matrix.node-version == '12.x'
34+
35+
- run: npm test

0 commit comments

Comments
 (0)