diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 58af474b..641ce385 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -30,12 +30,14 @@ jobs: run: for name in `ls packages/*/.eslintrc.js`; do dirname $name; done | xargs npx eslint -- - id: set-matrix working-directory: test-scenarios - run: echo "::set-output name=matrix::$(npm run --silent test:list -- --matrix 'npm run test -- --filter %s:')" + run: | + matrix_json=$(node --require ts-node/register ./suite-setup-util.ts) + echo "matrix=$matrix_json" >> $GITHUB_OUTPUT scenarios: needs: discover_matrix name: ${{ matrix.name }} - runs-on: ubuntu-latest + runs-on: '${{ matrix.os }}-latest' strategy: fail-fast: false matrix: ${{fromJson(needs.discover_matrix.outputs.matrix)}} diff --git a/test-scenarios/suite-setup-util.ts b/test-scenarios/suite-setup-util.ts new file mode 100644 index 00000000..d5fb0039 --- /dev/null +++ b/test-scenarios/suite-setup-util.ts @@ -0,0 +1,56 @@ +import execa from 'execa'; + +async function githubMatrix() { + let { stdout } = await execa( + 'npx', + [ + 'scenario-tester', + 'list', + '--require', + 'ts-node/register', + '--files', + '*-test.ts', + '--matrix', + 'npm run test -- --filter %s', + ], + { + preferLocal: true, + } + ); + + let { include: suites } = JSON.parse(stdout) as { include: { name: string; command: string }[]; name: string[] }; + + let include = [ + ...suites.map(s => ({ + name: `${s.name} ubuntu`, + os: 'ubuntu', + command: s.command, + })), + ...suites + // only run release tests in windows for now as a smoke test and not slow down CI too much + .filter(s => !['canary', 'beta', 'lts', 'ember3'].some(i => s.name.includes(i))) + // this test fails in windows because of a command imcompatibility with powershell. + // This is low priority but if someone had the time to look into PRs are welcome 👍 + .filter(s => s.name !== 'release-sample-addon') + .map(s => ({ + name: `${s.name} windows`, + os: 'windows', + command: s.command, + })), + ]; + + return { + name: include.map(s => s.name), + include, + }; +} + +async function main() { + const result = await githubMatrix(); + + process.stdout.write(JSON.stringify(result)); +} + +if (require.main === module) { + main(); +}