-
Notifications
You must be signed in to change notification settings - Fork 13
109 lines (89 loc) · 2.87 KB
/
ci-frontend.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: Front-end Checks
on:
workflow_call:
pull_request:
paths:
- frontend/**
- .github/workflows/ci-frontend.yml
defaults:
run:
working-directory: ./frontend
env:
NODE_VERSION: 18
LOCKFILE_PATH: ./frontend/package-lock.json # or yarn.lock
PACKAGE_MANAGER: npm # or yarn
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
tests:
name: FE Lint, Type Check, Format & Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache-dependency-path: ${{ env.LOCKFILE_PATH }}
cache: ${{ env.PACKAGE_MANAGER }}
- run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run lint
run: npm run lint
- name: Run type check
run: npm run ts:check
- name: Run format
run: npm run format-check
- name: Run tests
run: npm run test
- name: Run e2e tests
run: npm run test:e2e
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: ./frontend/playwright-report/
retention-days: 30
# Confirms the front end still builds successfully
check-frontend-builds:
name: FE Build Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache-dependency-path: ${{ env.LOCKFILE_PATH }}
cache: ${{ env.PACKAGE_MANAGER }}
# https://nextjs.org/docs/advanced-features/ci-build-caching
- uses: actions/cache@v3
with:
path: |
~/.npm
${{ github.workspace }}/frontend/.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
- run: npm ci
- run: npm run build -- --no-lint
# Confirms Storybook still builds successfully
check-storybook-builds:
name: FE Storybook Build Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache-dependency-path: ${{ env.LOCKFILE_PATH }}
cache: ${{ env.PACKAGE_MANAGER }}
- run: npm ci
- run: npm run storybook-build
vulnerability-scans:
name: Run Frontend Vulnerability Scans
uses: ./.github/workflows/vulnerability-scans.yml
with:
app_name: 'frontend'