forked from codeforboston/police-data-trust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a workflow for frontend checks.
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
Showing
1 changed file
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |