From 2de6327bfc338172c06094b8237d90a860d9be6a Mon Sep 17 00:00:00 2001 From: Anthony McLin Date: Mon, 22 Feb 2021 15:04:24 -0800 Subject: [PATCH 1/2] ci: replace travis with github actions Fixes #147 --- .github/workflows/release.yml | 45 +++++++++++++++++++++++++++++++++ .github/workflows/run-tests.yml | 30 ++++++++++++++++++++++ .travis.yml | 18 ------------- 3 files changed, 75 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/run-tests.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..f69680f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,45 @@ +# This workflow will run tests using node and then publish a package to GitHub Packages when a successful unit test +# has been run on master. +# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages + +name: Release + +on: + workflow_run: + workflows: ["Run Tests"] + branches: [master] + types: + - completed + +jobs: + release: + name: Semantic Release + if: ${{ github.event.workflow_run.conclusion == 'success' }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 14 + - run: npm ci + - name: Semantic Release + uses: cycjimmy/semantic-release-action@v2.3.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + + # publish-gpr: + # name: Release to GitHub Packages + # needs: release + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v2 + # - uses: actions/setup-node@v2 + # with: + # node-version: 12 + # registry-url: https://npm.pkg.github.com/ + # - run: npm ci + # - run: npm publish + # env: + # NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml new file mode 100644 index 0000000..734bfbc --- /dev/null +++ b/.github/workflows/run-tests.yml @@ -0,0 +1,30 @@ +# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions + +name: Run Tests + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: ['14'] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + - run: npm ci + - run: npm run build --if-present + - run: npm test && npm run report-coverage diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 3158950..0000000 --- a/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -language: node_js -node_js: - - "stable" -script: - - npm test - - npm run report-coverage -jobs: - include: - # Define the release stage that runs semantic-release - - stage: release - node_js: lts/* - # Advanced: optionally overwrite your default `script` step to skip the tests - # script: skip - deploy: - provider: script - skip_cleanup: true - script: - - npx semantic-release From 306ee2f113e983105da00847eda7ad89e41e18c5 Mon Sep 17 00:00:00 2001 From: Anthony McLin Date: Mon, 22 Feb 2021 15:06:49 -0800 Subject: [PATCH 2/2] ci: rename job to reflect usage --- .github/workflows/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 734bfbc..2801b19 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -10,7 +10,7 @@ on: branches: [ master ] jobs: - build: + test: runs-on: ubuntu-latest