@@ -2,37 +2,157 @@ name: 'CI Pipeline'
22on :
33 push :
44jobs :
5+ build :
6+ needs : [install]
7+ runs-on : ubuntu-latest
8+ strategy :
9+ matrix :
10+ node : [20.10.0, 18.x]
11+ os : [macos-latest]
12+ steps :
13+ - uses : actions/checkout@v4
14+ with :
15+ fetch-depth : 0
16+ - uses : actions/setup-node@v4
17+ with :
18+ node-version : ${{ matrix.node }}
19+ cache : ' npm'
20+ - name : Restore npm dependencies
21+ uses : actions/cache/restore@v4
22+ id : npm-cache
23+ with :
24+ path : |
25+ node_modules
26+ key : ${{ runner.os }}-npm-${{matrix.node}}-${{ hashFiles('**/package-lock.json') }}
27+ restore-keys : |
28+ ${{ runner.os }}-npm-${{matrix.node}}
29+ - run : npm run build:release
30+ - uses : actions/upload-artifact@v4
31+ with :
32+ name : package-${{ matrix.node }}
33+ path : package/*
34+
535 install :
636 strategy :
737 matrix :
8- node : [20.x , 18.x]
38+ node : [20.10.0 , 18.x]
939 os : [macos-latest, ubuntu-latest]
1040 runs-on : ${{ matrix.os }}
1141 steps :
12- - uses : actions/checkout@v3
42+ - uses : actions/checkout@v4
1343 with :
1444 fetch-depth : 0
1545 - name : Node ${{ matrix.node }} Run
1646 uses : actions/setup-node@v4
1747 with :
1848 node-version : ${{ matrix.node }}
1949 cache : ' npm'
20- - uses : actions/cache@v3
50+ - uses : actions/cache/restore@v4
2151 id : npm-cache
2252 with :
2353 path : |
2454 node_modules
25- key : ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
55+ key : ${{ runner.os }}-npm-${{matrix.node}}-${{ hashFiles('**/package-lock.json') }}
56+ - name : Install dependencies if cache invalid
57+ if : steps.npm-cache.outputs.cache-hit != 'true'
58+ run : npm ci
59+ - uses : actions/cache/save@v4
60+ with :
61+ key : ${{ runner.os }}-npm-${{matrix.node}}-${{ hashFiles('**/package-lock.json') }}
62+ path : |
63+ node_modules
64+ e2e :
65+ needs : [build]
66+ strategy :
67+ matrix :
68+ node : [20.10.0]
69+ os : [macos-latest, ubuntu-latest]
70+ shardIndex : [1, 2, 3, 4]
71+ shardTotal : [4]
72+ runs-on : ${{ matrix.os }}
73+ env :
74+ VITE_FR_AM_URL : ${{ secrets.VITE_FR_AM_URL }}
75+ VITE_FR_AM_COOKIE_NAME : ${{ secrets.VITE_FR_AM_COOKIE_NAME }}
76+ VITE_FR_OAUTH_PUBLIC_CLIENT : ${{ secrets.VITE_FR_OAUTH_PUBLIC_CLIENT }}
77+ VITE_FR_REALM_PATH : ${{ secrets.VITE_FR_REALM_PATH }}
78+ steps :
79+ - uses : actions/checkout@v4
80+ with :
81+ fetch-depth : 0
82+ - uses : actions/setup-node@v4
83+ with :
84+ node-version : ${{ matrix.node }}
85+ cache : ' npm'
86+ - name : Restore npm dependencies
87+ uses : actions/cache/restore@v4
88+ with :
89+ path : |
90+ node_modules
91+ key : ${{ runner.os }}-npm-${{matrix.node}}-${{ hashFiles('**/package-lock.json') }}
2692 restore-keys : |
93+ ${{ runner.os }}-npm-${{matrix.node}}
2794 ${{ runner.os }}-npm
28- - name : Install dependencies if cache invalid
95+ - run : npx playwright install
96+ - uses : actions/download-artifact@v4
97+ with :
98+ name : package-${{ matrix.node }}
99+ path : package
100+ - run : npm run build
101+ - name : e2e
102+ run : npm run ci:e2e -- --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
103+ - name : Upload blob report to GitHub Actions Artifacts
104+ if : always()
105+ uses : actions/upload-artifact@v4
106+ with :
107+ name : blob-report-${{runner.os}}-${{matrix.node}}-${{ matrix.shardIndex }}
108+ path : blob-report
109+ retention-days : 1
110+ merge-e2e-report :
111+ strategy :
112+ matrix :
113+ node : [20.10.0]
114+ os : [macos-latest, ubuntu-latest]
115+ # Merge reports after playwright-tests, even if some shards have failed
116+ if : always()
117+ needs : [e2e]
118+ runs-on : ${{matrix.os}}
119+ steps :
120+ - uses : actions/checkout@v4
121+ - uses : actions/setup-node@v4
122+ with :
123+ node-version : 18
124+ - uses : actions/cache/restore@v4
125+ id : npm-cache
126+ with :
127+ path : |
128+ node_modules
129+ key : ${{ runner.os }}-npm-${{matrix.node}}-${{ hashFiles('**/package-lock.json') }}
130+
131+ - name : Install dependencies
29132 if : steps.npm-cache.outputs.cache-hit != 'true'
30133 run : npm ci
31- pr :
134+
135+ - name : Download blob reports from GitHub Actions Artifacts
136+ uses : actions/download-artifact@v4
137+ with :
138+ path : all-blob-reports
139+ pattern : blob-report-*
140+ merge-multiple : true
141+
142+ - name : Merge into HTML Report
143+ run : npx playwright merge-reports --config=merge.config.ts ./all-blob-reports
144+
145+ - name : Upload HTML report
146+ uses : actions/upload-artifact@v4
147+ with :
148+ name : html-report--attempt--${{runner.os}}-${{matrix.node}}-${{ github.run_attempt }}
149+ path : playwright-report
150+ retention-days : 14
151+ test-lint-storybook-build :
32152 needs : install
33153 strategy :
34154 matrix :
35- node : [16.x, 18.x]
155+ node : [18.x]
36156 os : [macos-latest, ubuntu-latest]
37157 runs-on : ${{ matrix.os }}
38158 env :
@@ -41,53 +161,61 @@ jobs:
41161 VITE_FR_OAUTH_PUBLIC_CLIENT : ${{ secrets.VITE_FR_OAUTH_PUBLIC_CLIENT }}
42162 VITE_FR_REALM_PATH : ${{ secrets.VITE_FR_REALM_PATH }}
43163 steps :
44- - uses : actions/checkout@v3
164+ - uses : actions/checkout@v4
45165 with :
46166 fetch-depth : 0
167+ - uses : actions/setup-node@v4
168+ with :
169+ node-version : ${{ matrix.node }}
170+ cache : ' npm'
47171 - name : Restore npm dependencies
48- uses : actions/cache@v3
172+ uses : actions/cache/restore@v4
49173 id : npm-cache
50174 with :
51175 path : |
52176 node_modules
53- key : ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
177+ key : ${{ runner.os }}-npm-${{matrix.node}}-${{ hashFiles('**/package-lock.json') }}
54178 restore-keys : |
55- ${{ runner.os }}-npm
56- - run : npm run build
179+ ${{ runner.os }}-npm-${{matrix.node}}
180+ - run : npm run check:lint
181+ - run : npm run test
57182 - name : Build Storybook
58183 run : npm run build:storybook --quiet
59- - run : npx playwright install
60184 - name : Serve Storybook and run tests
61185 if : ${{ runner.os == 'ubuntu-latest' }} # this one hangs on mac os for some reason
62186 run : |
63187 npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
64188 "npx http-server storybook-static --port 6006 --silent" \
65189 "npx wait-on tcp:6006 && npm run test:storybook"
190+
66191 chromatic :
67192 runs-on : ubuntu-latest
68193 if : github.event_name != 'pull_request'
69194 needs : install
195+ strategy :
196+ matrix :
197+ node : [18.x]
70198 steps :
71- - uses : actions/checkout@v3
199+ - uses : actions/checkout@v4
72200 with :
73201 fetch-depth : 0
74202 - uses : actions/setup-node@v4
75203 with :
76204 node-version : 18.x
77205 cache : ' npm'
78206 - name : Restore npm dependencies
79- uses : actions/cache@v3
207+ uses : actions/cache@v4
80208 id : npm-cache
81209 with :
82210 path : |
83211 node_modules
84- key : ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
212+ key : ${{ runner.os }}-npm-${{matrix.node}}-${{ hashFiles('**/package-lock.json') }}
85213 restore-keys : |
86- ${{ runner.os }}-npm
214+ ${{ runner.os }}-npm-${{matrix.node}}
87215 - name : Install dependencies if cache invalid
88216 if : steps.npm-cache.outputs.cache-hit != 'true'
89217 run : npm ci
90- - uses : chromaui/action@v1
218+ - uses : chromaui/action@latest
91219 with :
92220 onlyChanged : true
93221 exitOnceUploaded : true
97225 exitZeroOnChanges : true
98226 env :
99227 CHROMATIC_PROJECT_TOKEN : ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
100- - uses : actions/upload-artifact@v3
228+ - uses : actions/upload-artifact@v4
101229 if : always()
102230 with :
103231 name : chromatic-build-artifacts-${{ github.run_id }}
0 commit comments