Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
description: "The versions of Next.js to test against (quoted and comma separated)"
required: false
default: "latest"
runOnWindows:
description: "Run tests on Windows"
type: boolean

jobs:
setup:
Expand Down Expand Up @@ -48,10 +51,24 @@ jobs:
uses: actions/github-script@v8
with:
script: |
const { versionsToTest, runOnWindows } = ${{ steps.check-labels.outputs.result }} ?? {}
// steps.check-labels.outputs.result will be not defined on non-PR events, so we create
// either a JSON string or an empty string first and later will check if string is empty
// and either parse JSON string or use a default empty object
const checkLabelsResult = '${{ steps.check-labels.outputs.result }}';
let { versionsToTest, runOnWindows } = checkLabelsResult ? JSON.parse(checkLabelsResult) : {}

if ('${{ github.event_name }}' === 'workflow_dispatch') {
core.setOutput('matrix', '${{ github.event.inputs.versions }}');
// attempt some massaging of input to cover potential variants of inputs
// - `["latest", "canary"]`
// - `latest, canary`
// - `"latest", "canary"`
// - `'latest','canary'`
// Will strip `[]'"` and whitespaces first, then split by comma
const normalizedVersionsInputArray = `${{ github.event.inputs.versions }}`
.replaceAll(/["'\[\]\s]+/g, "")
.split(',')

core.setOutput('matrix', JSON.stringify(normalizedVersionsInputArray));
} else if ('${{ github.event_name }}' === 'schedule' || versionsToTest === 'all') {
core.setOutput('matrix', '["latest", "canary", "15.5.9", "14.2.35", "13.5.1"]');
} else if (versionsToTest === 'latest-and-canary') {
Expand All @@ -60,6 +77,10 @@ jobs:
core.setOutput('matrix', '["latest"]');
}

if ('${{ github.event_name }}' === 'workflow_dispatch' && "${{ github.event.inputs.runOnWindows }}" == "true") {
runOnWindows = true
}

if (runOnWindows) {
core.setOutput('os', '["ubuntu-latest", "windows-2025"]');
} else {
Expand Down
Loading