From bcab01aada3c00c8500b6d5b6095cd5ca92e5651 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Thu, 4 Feb 2021 10:01:32 -0800 Subject: [PATCH] [Tests] migrate tests to Github Actions --- .github/workflows/node-8+.yml | 55 ++++++++++++++++++++++++++++++ .github/workflows/node-pretest.yml | 26 ++++++++++++++ .npmrc | 1 + .nycrc | 2 +- .travis.yml | 10 ------ package.json | 2 +- 6 files changed, 84 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/node-8+.yml create mode 100644 .github/workflows/node-pretest.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/node-8+.yml b/.github/workflows/node-8+.yml new file mode 100644 index 0000000..8c76a82 --- /dev/null +++ b/.github/workflows/node-8+.yml @@ -0,0 +1,55 @@ +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: '>=8' + + 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 4+' + needs: [latest, minors] + runs-on: ubuntu-latest + steps: + - run: 'echo tests completed' diff --git a/.github/workflows/node-pretest.yml b/.github/workflows/node-pretest.yml new file mode 100644 index 0000000..3921e0a --- /dev/null +++ b/.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' diff --git a/.npmrc b/.npmrc index eacea13..a08267f 100644 --- a/.npmrc +++ b/.npmrc @@ -1,3 +1,4 @@ package-lock=false allow-same-version=true message=v%s +audit-level=moderate diff --git a/.nycrc b/.nycrc index 36b45f5..45b7411 100644 --- a/.nycrc +++ b/.nycrc @@ -1,6 +1,6 @@ { "all": true, - "check-coverage": true, + "check-coverage": false, "reporter": ["text-summary", "text", "html", "json"], "lines": 100, "statements": 100, diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f5e26e1..0000000 --- a/.travis.yml +++ /dev/null @@ -1,10 +0,0 @@ -version: ~> 1.0 -language: node_js -os: - - linux -import: - - ljharb/travis-ci:node/minors/gte_8.yml - - ljharb/travis-ci:node/pretest.yml - - ljharb/travis-ci:node/posttest.yml -after_success: - - 'if [ -f coverage/*.json ]; then bash <(curl -s https://codecov.io/bash) -f coverage/*.json; fi' diff --git a/package.json b/package.json index 3185535..30be03b 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "prelint": "evalmd README.md", "lint": "eslint .", "pretest": "npm run lint", - "tests-only": "nyc tape test", + "tests-only": "nyc tape 'test/**/*.js'", "test": "npm run tests-only", "posttest": "npx aud --production", "version": "auto-changelog && git add CHANGELOG.md",