Skip to content

Commit

Permalink
[Tests] migrate tests to Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Jan 2, 2021
1 parent 688256a commit 266bc66
Show file tree
Hide file tree
Showing 7 changed files with 205 additions and 9 deletions.
7 changes: 7 additions & 0 deletions .editorconfig
Expand Up @@ -12,10 +12,17 @@ block_comment_start = /*
block_comment = *
block_comment_end = */

[.nycrc]
indent_style = tab

[*.md]
indent_style = space
indent_size = 4

[*.yml]
indent_style = space
indent_size = 2

[readme.markdown]
indent_size = off
max_line_length = off
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/node-4+.yml
@@ -0,0 +1,54 @@
name: 'Tests: node.js'

on: [pull_request, push]

jobs:
matrix:
runs-on: ubuntu-latest
outputs:
latest: ${{ steps.set-matrix.outputs.requireds }}
minors: ${{ steps.set-matrix.outputs.optionals }}
steps:
- uses: ljharb/actions/node/matrix@main
id: set-matrix
with:
preset: '>=4'

latest:
needs: [matrix]
name: 'latest minors'
runs-on: ubuntu-latest

strategy:
matrix: ${{ fromJson(needs.matrix.outputs.latest) }}

steps:
- uses: actions/checkout@v2
- uses: ljharb/actions/node/run@main
name: 'npm install && npm run tests-only'
with:
node-version: ${{ matrix.node-version }}
command: 'tests-only'
minors:
needs: [matrix, latest]
name: 'non-latest minors'
continue-on-error: true
if: ${{ !github.head_ref || !startsWith(github.head_ref, 'renovate') }}
runs-on: ubuntu-latest

strategy:
matrix: ${{ fromJson(needs.matrix.outputs.minors) }}

steps:
- uses: actions/checkout@v2
- uses: ljharb/actions/node/run@main
with:
node-version: ${{ matrix.node-version }}
command: 'tests-only'

node:
name: 'node 4+'
needs: [latest, minors]
runs-on: ubuntu-latest
steps:
- run: 'echo tests completed'
58 changes: 58 additions & 0 deletions .github/workflows/node-iojs.yml
@@ -0,0 +1,58 @@
name: 'Tests: node.js (io.js)'

on: [pull_request, push]

jobs:
matrix:
runs-on: ubuntu-latest
outputs:
latest: ${{ steps.set-matrix.outputs.requireds }}
minors: ${{ steps.set-matrix.outputs.optionals }}
steps:
- uses: ljharb/actions/node/matrix@main
id: set-matrix
with:
preset: 'iojs'

latest:
needs: [matrix]
name: 'latest minors'
runs-on: ubuntu-latest

strategy:
matrix: ${{ fromJson(needs.matrix.outputs.latest) }}

steps:
- uses: actions/checkout@v2
- uses: ljharb/actions/node/run@main
name: 'npm install && npm run tests-only'
with:
node-version: ${{ matrix.node-version }}
command: 'tests-only'
skip-ls-check: true

minors:
needs: [matrix, latest]
name: 'non-latest minors'
continue-on-error: true
if: ${{ !github.head_ref || !startsWith(github.head_ref, 'renovate') }}
runs-on: ubuntu-latest

strategy:
matrix: ${{ fromJson(needs.matrix.outputs.minors) }}

steps:
- uses: actions/checkout@v2
- uses: ljharb/actions/node/run@main
name: 'npm install && npm run tests-only'
with:
node-version: ${{ matrix.node-version }}
command: 'tests-only'
skip-ls-check: true

node:
name: 'io.js'
needs: [latest, minors]
runs-on: ubuntu-latest
steps:
- run: 'echo tests completed'
26 changes: 26 additions & 0 deletions .github/workflows/node-pretest.yml
@@ -0,0 +1,26 @@
name: 'Tests: pretest/posttest'

on: [pull_request, push]

jobs:
pretest:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: ljharb/actions/node/run@main
name: 'npm install && npm run pretest'
with:
node-version: 'lts/*'
command: 'pretest'

posttest:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: ljharb/actions/node/run@main
name: 'npm install && npm run posttest'
with:
node-version: 'lts/*'
command: 'posttest'
58 changes: 58 additions & 0 deletions .github/workflows/node-zero.yml
@@ -0,0 +1,58 @@
name: 'Tests: node.js (0.x)'

on: [pull_request, push]

jobs:
matrix:
runs-on: ubuntu-latest
outputs:
stable: ${{ steps.set-matrix.outputs.requireds }}
unstable: ${{ steps.set-matrix.outputs.optionals }}
steps:
- uses: ljharb/actions/node/matrix@main
id: set-matrix
with:
preset: '0.x'

stable:
needs: [matrix]
name: 'stable minors'
runs-on: ubuntu-latest

strategy:
matrix: ${{ fromJson(needs.matrix.outputs.stable) }}

steps:
- uses: actions/checkout@v2
- uses: ljharb/actions/node/run@main
with:
node-version: ${{ matrix.node-version }}
command: 'tests-only'
cache-node-modules-key: node_modules-${{ github.workflow }}-${{ github.action }}-${{ github.run_id }}
skip-ls-check: true

unstable:
needs: [matrix, stable]
name: 'unstable minors'
continue-on-error: true
if: ${{ !github.head_ref || !startsWith(github.head_ref, 'renovate') }}
runs-on: ubuntu-latest

strategy:
matrix: ${{ fromJson(needs.matrix.outputs.unstable) }}

steps:
- uses: actions/checkout@v2
- uses: ljharb/actions/node/run@main
with:
node-version: ${{ matrix.node-version }}
command: 'tests-only'
cache-node-modules-key: node_modules-${{ github.workflow }}-${{ github.action }}-${{ github.run_id }}
skip-ls-check: true

node:
name: 'node 0.x'
needs: [stable, unstable]
runs-on: ubuntu-latest
steps:
- run: 'echo tests completed'
7 changes: 0 additions & 7 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions test/timeoutAfter.js
Expand Up @@ -81,7 +81,7 @@ tap.test('timeoutAfter with Promises', { skip: typeof Promise === 'undefined' },
return new Promise(function (resolve) {
setTimeout(function () {
resolve();
}, 2);
}, 10);
});
});

Expand All @@ -92,7 +92,7 @@ tap.test('timeoutAfter with Promises', { skip: typeof Promise === 'undefined' },
return new Promise(function (reject) {
setTimeout(function () {
reject();
}, 2);
}, 10);
});
});
});
Expand Down

0 comments on commit 266bc66

Please sign in to comment.