Skip to content

Commit

Permalink
chore: added GitHub Action workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
luffynando committed Feb 24, 2022
1 parent 8b30380 commit 396c0d7
Showing 1 changed file with 74 additions and 0 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 396c0d7

Please sign in to comment.