Skip to content

Commit 05f2a4f

Browse files
Run tests on macos and windows only on merge and push (#1597)
### What Add a setup job that dynamically generates the system matrix for the rust ci workflow. Use only ubuntu-latest for pull requests and the full set of targets (Linux, macOS, Windows across x86_64 and aarch64) for other events (merge group, push). ### Why Pull requests only need validation on a single platform to provide fast feedback, while the test runs on merge (the merge_group event) can catch any rare issues we create that are platform specific, and same with releases and main branch builds triggerd by push events.
1 parent c9cd6ea commit 05f2a4f

File tree

1 file changed

+44
-23
lines changed

1 file changed

+44
-23
lines changed

.github/workflows/rust.yml

Lines changed: 44 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,46 @@ jobs:
2727
- if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
2828
run: exit 1
2929

30+
setup:
31+
runs-on: ubuntu-latest
32+
outputs:
33+
sys: ${{ steps.sys.outputs.sys }}
34+
steps:
35+
- id: sys
36+
run: |
37+
if [ "${{ github.event_name }}" == "pull_request" ]; then
38+
sys='[
39+
{
40+
"os": "ubuntu-latest",
41+
"target": "x86_64-unknown-linux-gnu"
42+
}
43+
]'
44+
else
45+
sys='[
46+
{
47+
"os": "ubuntu-latest",
48+
"target": "x86_64-unknown-linux-gnu"
49+
},
50+
{
51+
"os": "ubuntu-24.04-arm",
52+
"target": "aarch64-unknown-linux-gnu"
53+
},
54+
{
55+
"os": "macos-15-intel",
56+
"target": "x86_64-apple-darwin"
57+
},
58+
{
59+
"os": "macos-latest",
60+
"target": "aarch64-apple-darwin"
61+
},
62+
{
63+
"os": "windows-latest",
64+
"target": "x86_64-pc-windows-msvc"
65+
}
66+
]'
67+
fi
68+
echo "sys=$(<<< $sys jq -c)" >> $GITHUB_OUTPUT
69+
3070
fmt:
3171
runs-on: ubuntu-latest
3272
steps:
@@ -71,21 +111,12 @@ jobs:
71111
--exclude stellar-asset-spec
72112
73113
build:
114+
needs: setup
74115
strategy:
75116
fail-fast: false
76117
matrix:
77118
rust: [msrv, latest]
78-
sys:
79-
- os: ubuntu-latest
80-
target: x86_64-unknown-linux-gnu
81-
- os: ubuntu-24.04-arm
82-
target: aarch64-unknown-linux-gnu
83-
- os: macos-15-intel
84-
target: x86_64-apple-darwin
85-
- os: macos-latest
86-
target: aarch64-apple-darwin
87-
- os: windows-latest
88-
target: x86_64-pc-windows-msvc
119+
sys: ${{ fromJSON(needs.setup.outputs.sys) }}
89120
runs-on: ${{ matrix.sys.os }}
90121
steps:
91122
- uses: actions/checkout@v3
@@ -129,22 +160,12 @@ jobs:
129160
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS_FOR_TEST_WASMS }}
130161

131162
test:
132-
needs: build
163+
needs: [setup, build]
133164
strategy:
134165
fail-fast: false
135166
matrix:
136167
rust: [msrv, latest]
137-
sys:
138-
- os: ubuntu-latest
139-
target: x86_64-unknown-linux-gnu
140-
- os: ubuntu-24.04-arm
141-
target: aarch64-unknown-linux-gnu
142-
- os: macos-15-intel
143-
target: x86_64-apple-darwin
144-
- os: macos-latest
145-
target: aarch64-apple-darwin
146-
- os: windows-latest
147-
target: x86_64-pc-windows-msvc
168+
sys: ${{ fromJSON(needs.setup.outputs.sys) }}
148169
runs-on: ${{ matrix.sys.os }}
149170
steps:
150171
- uses: actions/checkout@v3

0 commit comments

Comments
 (0)