From 396c0d7eca71418f9579819c36a8605d36e71281 Mon Sep 17 00:00:00 2001 From: Fernando Isidro L Date: Thu, 24 Feb 2022 15:15:20 -0600 Subject: [PATCH] chore: added GitHub Action workflow --- .github/workflows/main.yml | 74 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..838e459 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,74 @@ +name: CI +on: + push: + branches: + - main + pull_request: + +jobs: + main: + name: Build, lint, and test on Node ${{ matrix.node }} and ${{ matrix.os }} + runs-on: ${{ matrix.os }} + if: ${{ github.event_name != 'pull_request' }} + strategy: + matrix: + node: [ '14.x', '16.x', '17.x' ] + os: [ ubuntu-latest, windows-latest ] + + steps: + - name: Checkout repo + uses: actions/checkout@v2 + + - name: Use Node ${{ matrix.node }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node }} + + - name: Install deps and build (with cache) + uses: bahmutov/npm-install@v1 + with: + useLockFile: false + + - name: Lint + run: yarn lint + + - name: Test + run: yarn test --ci --coverage --maxWorkers=2 + + - name: Build + run: yarn build + + pr: + name: Build, lint, and test on Node ${{ matrix.node }} and ${{ matrix.os }} + runs-on: ${{ matrix.os }} + if: ${{ github.event_name == 'pull_request' }} + strategy: + matrix: + node: [ '14.x', '16.x', '17.x' ] + os: [ ubuntu-latest, windows-latest ] + + steps: + - name: Checkout repo + uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.ref }} + fetch-depth: 0 + + - name: Use Node ${{ matrix.node }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node }} + + - name: Install deps and build (with cache) + uses: bahmutov/npm-install@v1 + with: + useLockFile: false + + - name: Lint + run: yarn lint + + - name: Test + run: yarn test --ci --coverage --maxWorkers=2 + + - name: Build + run: yarn build