Skip to content

Commit 58974a7

Browse files
authored
Merge pull request #626 from embroider-build/windows-tests
setup windows tests
2 parents 6ec7c72 + 090c04f commit 58974a7

File tree

2 files changed

+60
-2
lines changed

2 files changed

+60
-2
lines changed

.github/workflows/nodejs.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,14 @@ jobs:
3030
run: for name in `ls packages/*/.eslintrc.js`; do dirname $name; done | xargs npx eslint --
3131
- id: set-matrix
3232
working-directory: test-scenarios
33-
run: echo "::set-output name=matrix::$(npm run --silent test:list -- --matrix 'npm run test -- --filter %s:')"
33+
run: |
34+
matrix_json=$(node --require ts-node/register ./suite-setup-util.ts)
35+
echo "matrix=$matrix_json" >> $GITHUB_OUTPUT
3436
3537
scenarios:
3638
needs: discover_matrix
3739
name: ${{ matrix.name }}
38-
runs-on: ubuntu-latest
40+
runs-on: '${{ matrix.os }}-latest'
3941
strategy:
4042
fail-fast: false
4143
matrix: ${{fromJson(needs.discover_matrix.outputs.matrix)}}

test-scenarios/suite-setup-util.ts

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import execa from 'execa';
2+
3+
async function githubMatrix() {
4+
let { stdout } = await execa(
5+
'npx',
6+
[
7+
'scenario-tester',
8+
'list',
9+
'--require',
10+
'ts-node/register',
11+
'--files',
12+
'*-test.ts',
13+
'--matrix',
14+
'npm run test -- --filter %s',
15+
],
16+
{
17+
preferLocal: true,
18+
}
19+
);
20+
21+
let { include: suites } = JSON.parse(stdout) as { include: { name: string; command: string }[]; name: string[] };
22+
23+
let include = [
24+
...suites.map(s => ({
25+
name: `${s.name} ubuntu`,
26+
os: 'ubuntu',
27+
command: s.command,
28+
})),
29+
...suites
30+
// only run release tests in windows for now as a smoke test and not slow down CI too much
31+
.filter(s => !['canary', 'beta', 'lts', 'ember3'].some(i => s.name.includes(i)))
32+
// this test fails in windows because of a command imcompatibility with powershell.
33+
// This is low priority but if someone had the time to look into PRs are welcome 👍
34+
.filter(s => s.name !== 'release-sample-addon')
35+
.map(s => ({
36+
name: `${s.name} windows`,
37+
os: 'windows',
38+
command: s.command,
39+
})),
40+
];
41+
42+
return {
43+
name: include.map(s => s.name),
44+
include,
45+
};
46+
}
47+
48+
async function main() {
49+
const result = await githubMatrix();
50+
51+
process.stdout.write(JSON.stringify(result));
52+
}
53+
54+
if (require.main === module) {
55+
main();
56+
}

0 commit comments

Comments
 (0)