Skip to content

Commit

Permalink
Merge pull request #626 from embroider-build/windows-tests
Browse files Browse the repository at this point in the history
setup windows tests
  • Loading branch information
ef4 authored May 29, 2024
2 parents 6ec7c72 + 090c04f commit 58974a7
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 2 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)}}
Expand Down
56 changes: 56 additions & 0 deletions test-scenarios/suite-setup-util.ts
Original file line number Diff line number Diff line change
@@ -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();
}

0 comments on commit 58974a7

Please sign in to comment.