From f025290913a4eadf5e39b744d1a00d62f8af772f Mon Sep 17 00:00:00 2001 From: William Di Pasquale Date: Thu, 21 Jan 2021 10:44:08 +0000 Subject: [PATCH] fix: Migrate to GitHub Action As CircleCI has proven to be unreliable and we have several repositories using GitHub Actions successfully, we need to migrate this repository as well. Using `fix` instead of `ci` as prefix as I want to trigger a build to checkout semantic release. See: - [ENG-166] --- .circleci/config.yml | 38 ------------------ .github/workflows/main.yml | 79 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 38 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/main.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index aa14a3b2..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,38 +0,0 @@ -# Javascript Node CircleCI 2.0 configuration file -# -# Check https://circleci.com/docs/2.0/language-javascript/ for more details -# -version: 2 -jobs: - build: - docker: - - image: node:10 - - working_directory: ~/repo - - steps: - - checkout - - # Download and cache dependencies - - restore_cache: - key: dependency-cache-{{ checksum "yarn.lock" }} - - - run: yarn install - - - save_cache: - key: dependency-cache-{{ checksum "yarn.lock" }} - paths: - - node_modules - - # run tests! - - run: - name: Test Code Style - command: yarn eslint src - - - run: - name: Run unit tests - command: yarn test - - - run: - name: Release to npm - command: yarn semantic-release diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..0a8548c2 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,79 @@ +name: test-and-publish + +on: [push] + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Use Node.js 12.x + uses: actions/setup-node@v1 + with: + node-version: 12.x + + - name: Restore cache + uses: actions/cache@v2 + with: + path: '**/node_modules' + key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} + + - run: yarn install + + - run: yarn lint + env: + CI: true + + unit-test: + name: Run Unit Tests + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Use Node.js 12.x + uses: actions/setup-node@v1 + with: + node-version: 12.x + + - name: Restore cache + uses: actions/cache@v2 + with: + path: '**/node_modules' + key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} + + - run: yarn install + + - run: yarn test + env: + CI: true + + publish: + name: Publish + runs-on: ubuntu-latest + needs: unit-test + if: github.ref == 'refs/heads/master' + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Restore cache + uses: actions/cache@v2 + with: + path: '**/node_modules' + key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} + + - name: Build and publish release. + run: yarn install + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Publish via Semantic Release + run: yarn semantic-release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }}