Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tests] migrate tests to Github Actions #7

Merged
merged 2 commits into from
Feb 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
coverage/
26 changes: 26 additions & 0 deletions .github/workflows/node-pretest.yml
Original file line number Diff line number Diff line change
@@ -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'
56 changes: 56 additions & 0 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
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: '^6.2 || ^7 || ^8 || ^9.3 || ^10 || >= 11.2'

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
name: 'npm install && npm run tests-only'
with:
node-version: ${{ matrix.node-version }}
command: 'tests-only'

node:
name: 'node'
needs: [latest, minors]
runs-on: ubuntu-latest
steps:
- run: 'echo tests completed'
13 changes: 13 additions & 0 deletions .nycrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"all": true,
"check-coverage": false,
"reporter": ["text-summary", "text", "html", "json"],
"lines": 86,
"statements": 85.93,
"functions": 82.43,
"branches": 76.06,
"exclude": [
"coverage",
"test"
]
}
19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

17 changes: 8 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,15 @@
},
"scripts": {
"prepublish": "safe-publish-latest",
"pretest": "npm run --silent lint",
"test": "npm run --silent tests-only",
"tests-only": "node test",
"posttest": "npx aud",
"coverage": "covert test/*.js",
"lint": "eslint ."
"pretest": "npm run lint",
"test": "npm run tests-only",
"tests-only": "nyc tape 'test/**/*.js'",
"posttest": "npx aud --production",
"lint": "eslint --ext=.js,.mjs ."
},
"preferGlobal": true,
"bin": {
"deprecations": "bin.js"
"deprecations": "./bin.js"
},
"repository": {
"type": "git",
Expand All @@ -48,13 +47,13 @@
},
"devDependencies": {
"@ljharb/eslint-config": "^16.0.0",
"covert": "^1.1.1",
"eslint": "^6.8.0",
"nyc": "^14.1.1",
"safe-publish-latest": "^1.1.4",
"tape": "^5.0.0-next.4"
},
"engines": {
"npm": "^6.13.4",
"node": "^6.2 || ^7 || ^8 || ^9.3 || >= 10"
"node": "^6.2 || ^7 || ^8 || ^9.3 || ^10 || >= 11.2"
}
}