Skip to content

Commit

Permalink
Create a workflow for frontend checks.
Browse files Browse the repository at this point in the history
This performs linting, format checks, runs tests, checks types, and
verifies prod builds. It does everything in a single job to simplify
setup (everything runs quickly so no need for multiple jobs).

Each check step always runs. If any check fails, the "Frontend Check"
check fails on PR's.
  • Loading branch information
alexjball committed Aug 20, 2021
1 parent f1c3fd6 commit 312f965
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/frontend-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Frontend Checks

on:
push:
paths:
- frontend/**
pull_request:
paths:
- frontend/**

env:
NODE_VERSION: 14.x

jobs:
build:
name: Checks
runs-on: ubuntu-latest

defaults:
run:
working-directory: frontend

steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v1
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install dependencies
run: npm ci

- name: Linting
if: always()
run: npm run lint

- name: Formatting
if: always()
run: npm run check-formatting

- name: Jest Tests
if: always()
run: npm run test

- name: Types and Production Build
if: always()
run: npm run build -- --no-lint

0 comments on commit 312f965

Please sign in to comment.