From 4cc6749d31904ab5d0f9e8839b3018bad7dc12cd Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Tue, 6 Apr 2021 15:39:18 -0700 Subject: [PATCH 1/3] [actions] add Automatic Rebase and Require Allow Edits workflows --- .github/workflows/rebase.yml | 15 +++++++++++++++ .github/workflows/require-allow-edits.yml | 12 ++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 .github/workflows/rebase.yml create mode 100644 .github/workflows/require-allow-edits.yml diff --git a/.github/workflows/rebase.yml b/.github/workflows/rebase.yml new file mode 100644 index 0000000..027aed0 --- /dev/null +++ b/.github/workflows/rebase.yml @@ -0,0 +1,15 @@ +name: Automatic Rebase + +on: [pull_request_target] + +jobs: + _: + name: "Automatic Rebase" + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - uses: ljharb/rebase@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/require-allow-edits.yml b/.github/workflows/require-allow-edits.yml new file mode 100644 index 0000000..549d7b4 --- /dev/null +++ b/.github/workflows/require-allow-edits.yml @@ -0,0 +1,12 @@ +name: Require “Allow Edits” + +on: [pull_request_target] + +jobs: + _: + name: "Require “Allow Edits”" + + runs-on: ubuntu-latest + + steps: + - uses: ljharb/require-allow-edits@main From ff0b62330490d3b125ccbd7d5191ebbaa4bd87b0 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Tue, 6 Apr 2021 15:47:21 -0700 Subject: [PATCH 2/3] [Tests] run `nyc` on all tests --- .eslintignore | 1 + .nycrc | 10 ++++++++++ package.json | 3 ++- 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 .nycrc diff --git a/.eslintignore b/.eslintignore index c3af857..2e6b92a 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1 +1,2 @@ lib/ +coverage/ diff --git a/.nycrc b/.nycrc new file mode 100644 index 0000000..710d250 --- /dev/null +++ b/.nycrc @@ -0,0 +1,10 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "lib", + "test" + ] +} diff --git a/package.json b/package.json index 5f87d27..1649486 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "preversion": "npm run test && npm run check-changelog && npm run check-only-changelog-changed", "tag": "git tag v$npm_package_version", "test": "npm run tests-only", - "tests-only": "npm run mocha --silent test", + "tests-only": "nyc npm run mocha --silent test", "version:major": "npm --no-git-tag-version version major", "version:minor": "npm --no-git-tag-version version minor", "version:patch": "npm --no-git-tag-version version patch" @@ -77,6 +77,7 @@ "jsdom": "^14.1.0", "jsdom-global": "3.0.2", "mocha": "^5.2.0", + "nyc": "^14.1.1", "react": "^16.8.6", "react-dom": "^16.14.0", "react-test-renderer": "^16.14.0", From e8e512b0d7e0898f4395e07dbfec48d2ba21f233 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Tue, 6 Apr 2021 15:47:35 -0700 Subject: [PATCH 3/3] [Tests] migrate tests to Github Actions --- .github/workflows/node-pretest.yml | 26 ++++++++++++++++++ .github/workflows/node.yml | 42 ++++++++++++++++++++++++++++++ .travis.yml | 30 --------------------- 3 files changed, 68 insertions(+), 30 deletions(-) create mode 100644 .github/workflows/node-pretest.yml create mode 100644 .github/workflows/node.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/node-pretest.yml b/.github/workflows/node-pretest.yml new file mode 100644 index 0000000..0569f74 --- /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.yml b/.github/workflows/node.yml new file mode 100644 index 0000000..69c25bb --- /dev/null +++ b/.github/workflows/node.yml @@ -0,0 +1,42 @@ +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' + type: 'majors' + + majors: + needs: [matrix] + name: 'latest majors' + runs-on: ubuntu-latest + + strategy: + matrix: ${{ fromJson(needs.matrix.outputs.latest) }} + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - 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 + - run: bash <(curl -s https://codecov.io/bash) -f coverage/*.json; + + node: + name: 'node 6+' + needs: [majors] + runs-on: ubuntu-latest + steps: + - run: 'echo tests completed' diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index dd4bb9b..0000000 --- a/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -language: node_js -os: - - linux -node_js: - - "11" - - "10" - - "8" - - "6" -before_install: - - 'nvm install-latest-npm' -install: - - 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ]; then nvm install --latest-npm 0.8 && npm install && nvm use "${TRAVIS_NODE_VERSION}"; else npm install; fi;' -script: - - 'if [ -n "${PRETEST-}" ]; then npm run pretest ; fi' - - 'if [ -n "${POSTTEST-}" ]; then npm run posttest ; fi' - - 'if [ -n "${COVERAGE-}" ]; then npm run coverage ; fi' - - 'if [ -n "${TEST-}" ]; then npm run tests-only ; fi' -sudo: false -env: - - TEST=true -matrix: - fast_finish: true - include: - - node_js: "14.16.0" - env: PRETEST=true - allow_failures: - - os: osx - - env: TEST=true ALLOW_FAILURE=true - - env: COVERAGE=true - - node_js: "11"