Skip to content

Commit 4c395fc

Browse files
committed
Use GitHub Actions for parallel running
1 parent 4c259f3 commit 4c395fc

3 files changed

Lines changed: 72 additions & 32 deletions

File tree

.github/workflows/tests.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Tests
2+
on:
3+
pull_request:
4+
branches: [master]
5+
6+
jobs:
7+
tests:
8+
name: Unit Tests
9+
runs-on: ubuntu-latest
10+
timeout-minutes: 15
11+
12+
steps:
13+
- uses: actions/checkout@v1
14+
- uses: actions/setup-node@v1
15+
with:
16+
node-version: '10.x'
17+
- name: Install
18+
run: yarn install
19+
- name: Linting
20+
run: yarn lint:js
21+
- name: Test
22+
run: yarn test
23+
24+
integration_tests:
25+
name: Integration Tests
26+
strategy:
27+
matrix:
28+
ember_version: ['3.10', '3.13']
29+
runs-on: ubuntu-latest
30+
timeout-minutes: 15
31+
32+
steps:
33+
- uses: actions/checkout@v1
34+
- uses: actions/setup-node@v1
35+
with:
36+
node-version: '10.x'
37+
- name: Install
38+
run: yarn install
39+
- name: Test
40+
env:
41+
EMBER_VERSION: ${{ matrix.ember_version }}
42+
run: yarn test:integration

.travis.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

test/run-test.js

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
11
/* eslint-disable no-console */
2-
const versions = ['3.10', '3.13'];
32

4-
const { spawn } = require('child_process');
3+
// const versions = [process.env.EMBER_VERSION]
4+
const allVersions = ['3.10', '3.13'];
5+
56
const execa = require('execa');
67
const path = require('path');
78

9+
async function kill(subprocess) {
10+
setTimeout(() => {
11+
subprocess.cancel();
12+
subprocess.kill('SIGTERM');
13+
}, 1000);
14+
15+
console.log(`Requesting SIGTERM of ${subprocess.pid}`);
16+
return new Promise(resolve => {
17+
setTimeout(() => {
18+
resolve();
19+
}, 1000);
20+
});
21+
}
22+
823
async function runTestForVersion(version) {
924
console.log(`
1025
Running Integration Test for Ember ${version}
@@ -22,8 +37,7 @@ async function runTestForVersion(version) {
2237
console.log('starting serve');
2338

2439
// We use spawn for this one so we can kill it later without throwing an error
25-
const emberServe = spawn('yarn', ['start'], execOpts);
26-
emberServe.stderr.pipe(process.stderr);
40+
const emberServe = execa('yarn', ['start'], { cwd: inputDir });
2741

2842
await new Promise(resolve => {
2943
emberServe.stdout.on('data', data => {
@@ -39,7 +53,7 @@ async function runTestForVersion(version) {
3953

4054
console.log('codemod complete, ending serve');
4155

42-
emberServe.kill('SIGTERM');
56+
await kill(emberServe);
4357

4458
console.log('comparing results');
4559

@@ -55,13 +69,19 @@ async function runTestForVersion(version) {
5569
console.log('codemod ran successfully! 🎉');
5670
}
5771

58-
5972
(async () => {
60-
for (let version of versions) {
61-
await runTestForVersion(version);
73+
let emberVersion = process.env.EMBER_VERSION;
74+
if (!emberVersion) {
75+
console.error(`No EMBER_VERSION set. No scenarios to run.`);
76+
process.exit(1);
6277
}
6378

64-
process.exit(0);
65-
})();
79+
if (!allVersions.includes(`${emberVersion}`)) {
80+
console.error(`EMBER_VERSION is not allowed. Available: ${allVersions.join(', ')}`);
81+
process.exit(1);
82+
}
6683

84+
await runTestForVersion(emberVersion);
6785

86+
process.exit(0);
87+
})();

0 commit comments

Comments
 (0)