From b9feec22317f1ef0fe64275757afd9e876966dff Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Thu, 20 May 2021 22:39:30 -0700 Subject: [PATCH 1/3] [actions] update workflows --- .github/workflows/rebase.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rebase.yml b/.github/workflows/rebase.yml index 436cb79..027aed0 100644 --- a/.github/workflows/rebase.yml +++ b/.github/workflows/rebase.yml @@ -1,6 +1,6 @@ name: Automatic Rebase -on: [pull_request] +on: [pull_request_target] jobs: _: @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - uses: ljharb/rebase@master env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From a49bd47226a89b4870d3577a70fc2f334d4b7f94 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Thu, 20 May 2021 22:39:39 -0700 Subject: [PATCH 2/3] [Tests] run `nyc` on all tests; use `tape` runner --- .eslintignore | 1 + .gitignore | 3 +++ .nycrc | 9 +++++++++ package.json | 8 +++----- 4 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 .eslintignore create mode 100644 .nycrc diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..404abb2 --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +coverage/ diff --git a/.gitignore b/.gitignore index c77d1b6..36fb30a 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,9 @@ node_modules +coverage/ +.nyc_output/ + # Only apps should have lockfiles npm-shrinkwrap.json package-lock.json diff --git a/.nycrc b/.nycrc new file mode 100644 index 0000000..bdd626c --- /dev/null +++ b/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/package.json b/package.json index 10cc322..d432b8d 100644 --- a/package.json +++ b/package.json @@ -12,9 +12,8 @@ "prepublish": "safe-publish-latest", "pretest": "npm run --silent lint", "test": "npm run tests-only", - "tests-only": "node --harmony test", - "posttest": "npx aud --production", - "coverage": "covert test/*.js", + "tests-only": "nyc tape 'test/**/*.js'", + "posttest": "aud --production", "lint": "eslint .", "eccheck": "eclint check *.js **/*.js > /dev/null", "version": "auto-changelog && git add CHANGELOG.md", @@ -33,16 +32,15 @@ "generator", "function*" ], - "dependencies": {}, "devDependencies": { "@ljharb/eslint-config": "^17.1.0", "aud": "^1.1.2", "auto-changelog": "^2.1.0", - "covert": "^1.1.1", "eclint": "^2.8.1", "eslint": "^7.2.0", "for-each": "^0.3.3", "iterate-iterator": "^1.0.1", + "nyc": "^10.3.2", "safe-publish-latest": "^1.1.4", "tape": "^5.0.1" }, From c7c2c5997e4e4b9c3d5bfddcd1a837b30b52a4d8 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Thu, 20 May 2021 22:41:40 -0700 Subject: [PATCH 3/3] [Tests] migrate tests to Github Actions --- .github/workflows/node-4+.yml | 60 ++++++++++++++++++++++++++++ .github/workflows/node-harmony.yml | 64 ++++++++++++++++++++++++++++++ .github/workflows/node-iojs.yml | 62 +++++++++++++++++++++++++++++ .github/workflows/node-pretest.yml | 26 ++++++++++++ .github/workflows/node-zero.yml | 64 ++++++++++++++++++++++++++++++ .npmrc | 1 - .travis.yml | 12 ------ package.json | 1 + 8 files changed, 277 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/node-4+.yml create mode 100644 .github/workflows/node-harmony.yml create mode 100644 .github/workflows/node-iojs.yml create mode 100644 .github/workflows/node-pretest.yml create mode 100644 .github/workflows/node-zero.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/node-4+.yml b/.github/workflows/node-4+.yml new file mode 100644 index 0000000..007f773 --- /dev/null +++ b/.github/workflows/node-4+.yml @@ -0,0 +1,60 @@ +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: + fail-fast: false + matrix: ${{ fromJson(needs.matrix.outputs.latest) }} + + steps: + - uses: actions/checkout@v2 + - uses: ljharb/actions/node/install@main + name: 'nvm install ${{ matrix.node-version }} && npm install' + with: + node-version: ${{ matrix.node-version }} + - run: npm run tests-only + - uses: codecov/codecov-action@v1 + + 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: + fail-fast: false + matrix: ${{ fromJson(needs.matrix.outputs.minors) }} + + steps: + - uses: actions/checkout@v2 + - uses: ljharb/actions/node/install@main + name: 'nvm install ${{ matrix.node-version }} && npm install' + with: + node-version: ${{ matrix.node-version }} + - run: npm run tests-only + - uses: codecov/codecov-action@v1 + + node: + name: 'node 4+' + needs: [latest, minors] + runs-on: ubuntu-latest + steps: + - run: 'echo tests completed' diff --git a/.github/workflows/node-harmony.yml b/.github/workflows/node-harmony.yml new file mode 100644 index 0000000..3182fc9 --- /dev/null +++ b/.github/workflows/node-harmony.yml @@ -0,0 +1,64 @@ +name: 'Tests: node.js (harmony)' + +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.8 <16' + + stable: + needs: [matrix] + name: 'stable minors' + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: ${{ fromJson(needs.matrix.outputs.stable) }} + + steps: + - uses: actions/checkout@v2 + - uses: ljharb/actions/node/install@main + name: 'nvm install ${{ matrix.node-version }} && npm install' + with: + node-version: ${{ matrix.node-version }} + cache-node-modules-key: node_modules-${{ github.workflow }}-${{ github.action }}-${{ github.run_id }} + skip-ls-check: true + - run: npm run test:harmony + - uses: codecov/codecov-action@v1 + + 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: + fail-fast: false + matrix: ${{ fromJson(needs.matrix.outputs.unstable) }} + + steps: + - uses: actions/checkout@v2 + - uses: ljharb/actions/node/install@main + name: 'nvm install ${{ matrix.node-version }} && npm install' + with: + node-version: ${{ matrix.node-version }} + cache-node-modules-key: node_modules-${{ github.workflow }}-${{ github.action }}-${{ github.run_id }} + skip-ls-check: true + - run: npm run test:harmony + - uses: codecov/codecov-action@v1 + + node: + name: 'node: harmony' + needs: [stable, unstable] + runs-on: ubuntu-latest + steps: + - run: 'echo tests completed' diff --git a/.github/workflows/node-iojs.yml b/.github/workflows/node-iojs.yml new file mode 100644 index 0000000..891b73d --- /dev/null +++ b/.github/workflows/node-iojs.yml @@ -0,0 +1,62 @@ +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: + fail-fast: false + matrix: ${{ fromJson(needs.matrix.outputs.latest) }} + + steps: + - uses: actions/checkout@v2 + - uses: ljharb/actions/node/install@main + name: 'nvm install ${{ matrix.node-version }} && npm install' + with: + node-version: ${{ matrix.node-version }} + skip-ls-check: true + - run: npm run tests-only + - uses: codecov/codecov-action@v1 + + 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: + fail-fast: false + matrix: ${{ fromJson(needs.matrix.outputs.minors) }} + + steps: + - uses: actions/checkout@v2 + - uses: ljharb/actions/node/install@main + name: 'nvm install ${{ matrix.node-version }} && npm install' + with: + node-version: ${{ matrix.node-version }} + skip-ls-check: true + - run: npm run tests-only + - uses: codecov/codecov-action@v1 + + node: + name: 'io.js' + 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..969d138 --- /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/install@main + name: 'nvm install lts/* && npm install' + with: + node-version: 'lts/*' + - run: npm run pretest + + posttest: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - uses: ljharb/actions/node/install@main + name: 'nvm install lts/* && npm install' + with: + node-version: 'lts/*' + - run: npm run posttest diff --git a/.github/workflows/node-zero.yml b/.github/workflows/node-zero.yml new file mode 100644 index 0000000..18dcd1a --- /dev/null +++ b/.github/workflows/node-zero.yml @@ -0,0 +1,64 @@ +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: + fail-fast: false + matrix: ${{ fromJson(needs.matrix.outputs.stable) }} + + steps: + - uses: actions/checkout@v2 + - uses: ljharb/actions/node/install@main + name: 'nvm install ${{ matrix.node-version }} && npm install' + with: + node-version: ${{ matrix.node-version }} + cache-node-modules-key: node_modules-${{ github.workflow }}-${{ github.action }}-${{ github.run_id }} + skip-ls-check: true + - run: npm run tests-only + - uses: codecov/codecov-action@v1 + + 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: + fail-fast: false + matrix: ${{ fromJson(needs.matrix.outputs.unstable) }} + + steps: + - uses: actions/checkout@v2 + - uses: ljharb/actions/node/install@main + name: 'nvm install ${{ matrix.node-version }} && npm install' + with: + node-version: ${{ matrix.node-version }} + cache-node-modules-key: node_modules-${{ github.workflow }}-${{ github.action }}-${{ github.run_id }} + skip-ls-check: true + - run: npm run tests-only + - uses: codecov/codecov-action@v1 + + node: + name: 'node 0.x' + needs: [stable, unstable] + runs-on: ubuntu-latest + steps: + - run: 'echo tests completed' diff --git a/.npmrc b/.npmrc index 44a98a8..eacea13 100644 --- a/.npmrc +++ b/.npmrc @@ -1,4 +1,3 @@ package-lock=false -audit-level=high allow-same-version=true message=v%s diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 2d1c1d2..0000000 --- a/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -version: ~> 1.0 -language: node_js -os: - - linux -import: - - ljharb/travis-ci:node/all.yml - - ljharb/travis-ci:node/pretest.yml - - ljharb/travis-ci:node/posttest.yml - - ljharb/travis-ci:node/coverage.yml -matrix: - allow_failures: - - env: COVERAGE=true diff --git a/package.json b/package.json index d432b8d..7324e04 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "pretest": "npm run --silent lint", "test": "npm run tests-only", "tests-only": "nyc tape 'test/**/*.js'", + "test:harmony": "node --harmony test", "posttest": "aud --production", "lint": "eslint .", "eccheck": "eclint check *.js **/*.js > /dev/null",