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 }}