diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml new file mode 100644 index 0000000..d8bfb3c --- /dev/null +++ b/.github/workflows/validate.yml @@ -0,0 +1,90 @@ +name: validate +on: + push: + branches: + - '+([0-9])?(.{+([0-9]),x}).x' + - 'master' + - 'next' + - 'next-major' + - 'beta' + - 'alpha' + - '!all-contributors/**' + pull_request: {} +jobs: + main: + # ignore all-contributors PRs + if: ${{ !contains(github.head_ref, 'all-contributors') }} + strategy: + matrix: + node: [12, 14, 16] + runs-on: ubuntu-latest + steps: + - name: 🛑 Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.9.0 + + - name: ⬇️ Checkout repo + uses: actions/checkout@v2 + + - name: ⎔ Setup node + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node }} + + - name: 📥 Download deps + uses: bahmutov/npm-install@v1 + with: + useLockFile: false + env: + HUSKY_SKIP_INSTALL: true + + - name: ▶️ Run validate script + run: npm run validate + + - name: ⬆️ Upload coverage report + uses: codecov/codecov-action@v2 + + release: + needs: main + runs-on: ubuntu-latest + if: + ${{ github.repository == 'testing-library/preact-testing-library' && + contains('refs/heads/master,refs/heads/beta,refs/heads/next,refs/heads/alpha', github.ref) && + github.event_name == 'push' }} + steps: + - name: 🛑 Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.9.0 + + - name: ⬇️ Checkout repo + uses: actions/checkout@v2 + + - name: ⎔ Setup node + uses: actions/setup-node@v2 + with: + node-version: 14 + + - name: 📥 Download deps + uses: bahmutov/npm-install@v1 + with: + useLockFile: false + env: + HUSKY_SKIP_INSTALL: true + + - name: 🏗 Run build script + run: npm run build + + - name: 🚀 Release + uses: cycjimmy/semantic-release-action@v2 + with: + semantic_version: 17 + branches: | + [ + '+([0-9])?(.{+([0-9]),x}).x', + 'master', + 'next', + 'next-major', + {name: 'beta', prerelease: true}, + {name: 'alpha', prerelease: true} + ] + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e29d478..0000000 --- a/.travis.yml +++ /dev/null @@ -1,19 +0,0 @@ -sudo: false -language: node_js -notifications: - email: false -node_js: - - '10' - - '12' - - '14' -script: npm run validate -jobs: - include: - - stage: release - node_js: '14' - deploy: - provider: script - script: npm run test:update && npx codecov && npx semantic-release - skip_cleanup: true -branches: - only: master diff --git a/README.md b/README.md index ee037ff..bedc09b 100644 --- a/README.md +++ b/README.md @@ -137,8 +137,8 @@ kind welcome! [npm]: https://www.npmjs.com [node]: https://nodejs.org -[build]: https://travis-ci.org/testing-library/preact-testing-library -[build-badge]: https://travis-ci.org/testing-library/preact-testing-library.svg?branch=master +[build]: https://github.com/testing-library/preact-testing-library/actions?query=workflow%3Avalidate +[build-badge]: https://img.shields.io/github/workflow/status/testing-library/preact-testing-library/validate?logo=github&style=flat-square [coverage-badge]: https://img.shields.io/codecov/c/github/testing-library/preact-testing-library.svg?style=flat-square [coverage]: https://codecov.io/github/testing-library/preact-testing-library [package]: https://www.npmjs.com/package/@testing-library/preact