Skip to content

Commit c22d123

Browse files
committed
test: add ability to trigger pull request integration tests on windows via label
1 parent 4c0edcd commit c22d123

File tree

1 file changed

+34
-16
lines changed

1 file changed

+34
-16
lines changed

.github/workflows/run-tests.yml

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,43 @@ jobs:
2828
repo: context.repo.repo,
2929
issue_number: context.payload.pull_request.number,
3030
});
31-
const shouldTestAllVersions = labels.some(label => label.name === 'autorelease: pending' || label.name === 'test all versions');
32-
if (shouldTestAllVersions) {
33-
return 'all'
31+
32+
const runOnWindows = labels.some(label => label.name === 'test on windows');
33+
34+
let versionsToTest = 'latest';
35+
if (labels.some(label => label.name === 'autorelease: pending' || label.name === 'test all versions')) {
36+
versionsToTest = 'all';
37+
} else if (labels.some(label => label.name === 'test latest and canary')) {
38+
versionsToTest = 'latest-and-canary';
39+
}
40+
41+
return {
42+
versionsToTest,
43+
runOnWindows
3444
}
3545
36-
return labels.some(label => label.name === 'test latest and canary') ? 'latest-and-canary' : 'latest'
3746
- name: Set Next.js versions to test
3847
id: set-matrix
39-
# If this is the nightly build or a release PR then run the full matrix of versions
40-
run: |
41-
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
42-
echo "matrix=${{ github.event.inputs.versions }}" >> $GITHUB_OUTPUT
43-
elif [ "${{ github.event_name }}" = "schedule" ] || [ "${{ steps.check-labels.outputs.result }}" = "all" ]; then
44-
echo "matrix=[\"latest\", \"canary\", \"14.2.15\", \"13.5.1\"]" >> $GITHUB_OUTPUT
45-
elif [ "${{ steps.check-labels.outputs.result }}" = "latest-and-canary" ]; then
46-
echo "matrix=[\"latest\", \"canary\"]" >> $GITHUB_OUTPUT
47-
else
48-
echo "matrix=[\"latest\"]" >> $GITHUB_OUTPUT
49-
fi
48+
uses: actions/github-script@v8
49+
with:
50+
script: |
51+
const { versionsToTest, runOnWindows} = ${{ steps.check-labels.outputs.result }} ?? {}
52+
53+
if ('${{ github.event_name }}' === 'workflow_dispatch') {
54+
core.setOutput('matrix', '${{ github.event.inputs.versions }}');
55+
} else if ('${{ github.event_name }}' === 'schedule' || versionsToTest === 'all') {
56+
core.setOutput('matrix', '["latest", "canary", "14.2.15", "13.5.1"]');
57+
} else if ()versionsToTest === 'latest-and-canary') {
58+
core.setOutput('matrix', '["latest", "canary"]');
59+
} else {
60+
core.setOutput('matrix', '["latest"]');}
61+
}
62+
63+
if (runOnWindows) {
64+
core.setOutput('os', '[''ubuntu-latest', 'windows-2025']');
65+
} else {
66+
core.setOutput('os', '[''ubuntu-latest']');
67+
}
5068
5169
e2e:
5270
needs: setup
@@ -137,7 +155,7 @@ jobs:
137155
fail-fast: false
138156
matrix:
139157
shard: [1, 2, 3, 4, 5, 6, 7, 8]
140-
os: [ubuntu-latest]
158+
os: ${{ fromJson(needs.setup.outputs.os) }}
141159
version: ${{ fromJson(needs.setup.outputs.matrix) }}
142160
exclude:
143161
- os: windows-2025

0 commit comments

Comments
 (0)