From ebee8e4159c3998a62b2d73ba850b85a37590281 Mon Sep 17 00:00:00 2001 From: Gil Barbara Date: Thu, 14 Apr 2022 20:37:12 -0300 Subject: [PATCH] Replace travis with GitHub Actions --- .github/workflows/main.yml | 66 ++++++++++++++++++++++++++++++++++++++ .travis.yml | 14 -------- 2 files changed, 66 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/main.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..3a6969b --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,66 @@ +name: CI + +on: + push: + branches: + - main + tags: + - 'v*' + pull_request: + branches: ['*'] + + workflow_dispatch: + +jobs: + main: + name: Validate and Deploy + runs-on: ubuntu-latest + + env: + CI: true + + steps: + - name: Setup timezone + uses: zcong1993/setup-timezone@master + with: + timezone: America/Sao_Paulo + + - name: Setup repo + uses: actions/checkout@v2 + + - name: Setup Node + uses: actions/setup-node@v1 + with: + node-version: '14.x' + registry-url: 'https://registry.npmjs.org' + + - name: Cache Packages + id: cache + uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + timeout-minutes: 1 + + - name: Install Packages + run: npm ci + timeout-minutes: 3 + + - name: Validate + if: "!startsWith(github.ref, 'refs/tags/')" + run: npm run validate + timeout-minutes: 3 + + - name: Publish code coverage + if: "!startsWith(github.ref, 'refs/tags/')" + uses: paambaati/codeclimate-action@v3.0.0 + env: + CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} + + - name: Publish Package + if: startsWith(github.ref, 'refs/tags/') + run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 834a4e5..0000000 --- a/.travis.yml +++ /dev/null @@ -1,14 +0,0 @@ -language: node_js -node_js: - - '14' -cache: - directories: - - node_modules -before_script: - - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter - - chmod +x ./cc-test-reporter - - ./cc-test-reporter before-build -script: - - npm run validate -after_script: - - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT