-
Notifications
You must be signed in to change notification settings - Fork 16
130 lines (111 loc) · 3.64 KB
/
ci-atlas-app.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: CI-atlas-app
on:
push:
branches:
- dev
- monorepo
- main
paths:
- 'apps/atlas/**'
- 'packages/**'
- '.yarnrc.yml'
- '.github/workflows/**'
pull_request:
types:
- opened
- synchronize
- reopened
paths:
- 'apps/atlas/**'
- 'packages/**'
- '.yarnrc.yml'
- '.github/workflows/**'
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
# Why not using setup-node 2.2+ cache option (yet) ?
# see https://github.com/belgattitude/nextjs-monorepo-example/pull/369
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- name: Restore yarn cache
uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-cache-folder-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }}
restore-keys: |
yarn-cache-folder-
# see https://github.com/vercel/next.js/pull/27362
- name: Restore nextjs build atlas from cache
uses: actions/cache@v2
with:
path: |
${{ github.workspace }}/apps/atlas/.next/cache
${{ github.workspace }}/.cache
${{ github.workspace }}/**/tsconfig.tsbuildinfo
${{ github.workspace }}/**/.eslintcache
key: ${{ runner.os }}-nextjs-atlas-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('apps/atlas/src/**.[jt]sx?', 'apps/atlas/src/**.json') }}
restore-keys: |
${{ runner.os }}-nextjs-atlas-${{ hashFiles('**/yarn.lock') }}-
- name: Install dependencies
run: |
yarn install --immutable
- name: Typecheck
working-directory: apps/atlas
run: |
yarn typecheck
- name: Linter
working-directory: apps/atlas
run: |
yarn lint --cache
yarn lint-styles
- name: Unit tests
working-directory: apps/atlas
run: |
yarn test-unit
- name: Build atlas
working-directory: apps/atlas
run: |
yarn build
env:
# Speed up build: they are linted in a previous step
NEXTJS_IGNORE_ESLINT: 1
# Speed up build: they are typechecked in a previous step
NEXTJS_IGNORE_TYPECHECK: 1
# Speed up build: don't run if not needed, enable if it becomes needed
NEXT_DISABLE_SOURCEMAPS: 1
# Don't send telemetry for ci
NEXT_TELEMETRY_DISABLED: 1
- name: Check bundle size
working-directory: apps/atlas
run: |
yarn check-build-size
- name: Check ecmascript checks for build files
working-directory: apps/atlas
run: |
yarn check-dist
- name: Install Playwright
run: npx playwright install --with-deps chromium webkit
- name: E2E run atlas playwright tests
working-directory: apps/atlas
run: |
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn test-e2e
env:
E2E_WEBSERVER_MODE: START
CI: 1
- uses: actions/upload-artifact@v3
if: always()
with:
name: web-blog-playwright-test-results
path: apps/atlas/e2e/.out