Skip to content

Commit 5088cd4

Browse files
committed
Add checks workflow
1 parent 4b31843 commit 5088cd4

File tree

2 files changed

+94
-0
lines changed

2 files changed

+94
-0
lines changed

.github/workflows/checks.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# This workflow performs basic checks:
2+
#
3+
# 1. run a preparation step to install and cache node modules
4+
# 2. once prep succeeds, lint and test run in parallel
5+
#
6+
# The checks only run on non-draft Pull Requests. They don't run on the main
7+
# branch prior to deploy. It's recommended to use branch protection to avoid
8+
# pushes straight to 'main'.
9+
10+
name: Checks
11+
12+
on:
13+
pull_request:
14+
types:
15+
- opened
16+
- synchronize
17+
- reopened
18+
- ready_for_review
19+
20+
env:
21+
NODE: 18
22+
23+
jobs:
24+
prep:
25+
if: github.event.pull_request.draft == false
26+
runs-on: ubuntu-latest
27+
28+
steps:
29+
- name: Cancel Previous Runs
30+
uses: styfle/[email protected]
31+
with:
32+
access_token: ${{ github.token }}
33+
34+
- name: Checkout
35+
uses: actions/checkout@v3
36+
37+
- name: Use Node.js ${{ env.NODE }}
38+
uses: actions/setup-node@v3
39+
with:
40+
node-version: ${{ env.NODE }}
41+
42+
- name: Get yarn cache directory path
43+
id: yarn-cache-dir-path
44+
run: echo "::set-output name=dir::$(yarn cache dir)"
45+
working-directory: web-vite
46+
47+
- uses: actions/cache@v3
48+
id: yarn-cache
49+
with:
50+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
51+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
52+
restore-keys: |
53+
${{ runner.os }}-yarn-
54+
55+
- name: Install
56+
run: yarn install
57+
working-directory: web-vite
58+
59+
lint:
60+
needs: prep
61+
runs-on: ubuntu-latest
62+
63+
steps:
64+
- name: Checkout
65+
uses: actions/checkout@v3
66+
67+
- name: Use Node.js ${{ env.NODE }}
68+
uses: actions/setup-node@v3
69+
with:
70+
node-version: ${{ env.NODE }}
71+
72+
- name: Get yarn cache directory path
73+
id: yarn-cache-dir-path
74+
run: echo "::set-output name=dir::$(yarn cache dir)"
75+
76+
- uses: actions/cache@v3
77+
id: yarn-cache
78+
with:
79+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
80+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
81+
restore-keys: |
82+
${{ runner.os }}-yarn-
83+
84+
- name: Install
85+
run: yarn install
86+
working-directory: web-vite
87+
88+
- name: Lint
89+
run: yarn lint
90+
working-directory: web-vite

.github/workflows/deploy-web.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ jobs:
2929
run: yarn install
3030
working-directory: web-vite
3131

32+
- name: Lint
33+
run: yarn lint
34+
working-directory: web-vite
35+
3236
- name: Deploy to surge
3337
run: yarn deploy
3438
working-directory: web-vite

0 commit comments

Comments
 (0)