1
- name : Frontend
1
+ name : " Frontend Build CI (unit tests, linting & sanity checks) "
2
2
3
3
on :
4
4
push :
@@ -13,68 +13,166 @@ concurrency:
13
13
group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
14
14
cancel-in-progress : true
15
15
16
+ env :
17
+ TAG : apache/superset:GHA-${{ github.run_id }}
18
+
16
19
jobs :
17
20
frontend-build :
18
21
runs-on : ubuntu-24.04
19
22
steps :
20
- - name : " Checkout ${{ github.ref }} ( ${{ github.sha }} ) "
23
+ - name : Checkout Code
21
24
uses : actions/checkout@v4
22
25
with :
23
26
persist-credentials : false
24
- submodules : recursive
25
- - name : Check npm lock file version
26
- run : ./scripts/ci_check_npm_lock_version.sh ./superset-frontend/package-lock.json
27
- - name : Check for file changes
27
+
28
+ - name : Check for File Changes
28
29
id : check
29
30
uses : ./.github/actions/change-detector/
30
31
with :
31
32
token : ${{ secrets.GITHUB_TOKEN }}
32
- - name : Setup Node.js
33
- if : steps.check.outputs.frontend
34
- uses : actions/setup-node@v4
35
- with :
36
- node-version : " 20"
37
- - name : Install dependencies
38
- if : steps.check.outputs.frontend
39
- uses : ./.github/actions/cached-dependencies
40
- with :
41
- run : npm-install
42
- - name : eslint
43
- if : steps.check.outputs.frontend
44
- working-directory : ./superset-frontend
45
- run : |
46
- npm run eslint -- . --quiet
47
- - name : tsc
33
+
34
+ - name : Build Docker Image
48
35
if : steps.check.outputs.frontend
49
- working-directory : ./superset-frontend
36
+ shell : bash
37
+ env :
38
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
50
39
run : |
51
- npm run type
52
- - name : Build plugins packages
53
- if : steps.check.outputs.frontend
54
- working-directory : ./superset-frontend
55
- run : npm run plugins:build
56
- - name : Build plugins Storybook
57
- if : steps.check.outputs.frontend
58
- working-directory : ./superset-frontend
59
- run : npm run plugins:build-storybook
60
- - name : superset-ui/core coverage
40
+ docker buildx build \
41
+ -t $TAG \
42
+ --cache-from=type=registry,ref=apache/superset-cache:3.10-slim-bookworm \
43
+ --target superset-node-ci \
44
+ .
45
+
46
+ - name : Save Docker Image as Artifact
61
47
if : steps.check.outputs.frontend
62
- working-directory : ./superset-frontend
63
48
run : |
64
- npm run core:cover
65
- - name : unit tests
49
+ docker save $TAG | gzip > docker-image.tar.gz
50
+
51
+ - name : Upload Docker Image Artifact
66
52
if : steps.check.outputs.frontend
67
- working-directory : ./superset-frontend
53
+ uses : actions/upload-artifact@v4
54
+ with :
55
+ name : docker-image
56
+ path : docker-image.tar.gz
57
+
58
+ sharded-jest-tests :
59
+ needs : frontend-build
60
+ if : needs.frontend-build.result == 'success'
61
+ strategy :
62
+ matrix :
63
+ shard : [1, 2, 3, 4, 5, 6, 7, 8]
64
+ fail-fast : false
65
+ runs-on : ubuntu-24.04
66
+ steps :
67
+ - name : Download Docker Image Artifact
68
+ uses : actions/download-artifact@v4
69
+ with :
70
+ name : docker-image
71
+
72
+ - name : Load Docker Image
73
+ run : docker load < docker-image.tar.gz
74
+
75
+ - name : npm run test with coverage
68
76
run : |
69
- npm run test -- --coverage --silent
70
- # todo: remove this step when fix generator as a project in root jest.config.js
71
- - name : generator-superset unit tests
72
- if : steps.check.outputs.frontend
73
- working-directory : ./superset-frontend/packages/generator-superset
74
- run : npm run test
75
- - name : Upload code coverage
77
+ mkdir -p ${{ github.workspace }}/superset-frontend/coverage
78
+ docker run \
79
+ -v ${{ github.workspace }}/superset-frontend/coverage:/app/superset-frontend/coverage \
80
+ --rm $TAG \
81
+ bash -c \
82
+ "npm run test -- --coverage --shard=${{ matrix.shard }}/8 --coverageReporters=json-summary"
83
+
84
+ - name : Upload Coverage Artifact
85
+ uses : actions/upload-artifact@v4
86
+ with :
87
+ name : coverage-artifacts-${{ matrix.shard }}
88
+ path : superset-frontend/coverage
89
+
90
+ report-coverage :
91
+ needs : [sharded-jest-tests]
92
+ if : needs.frontend-build.result == 'success'
93
+ runs-on : ubuntu-24.04
94
+ steps :
95
+ - name : Download Coverage Artifacts
96
+ uses : actions/download-artifact@v4
97
+ with :
98
+ pattern : coverage-artifacts-*
99
+ path : coverage/
100
+
101
+ - name : Show Files
102
+ run : find coverage/
103
+
104
+ - name : Merge Code Coverage
105
+ run : npx nyc merge coverage/ merged-output/coverage-summary.json
106
+
107
+ - name : Upload Code Coverage
76
108
uses : codecov/codecov-action@v5
77
109
with :
78
110
flags : javascript
79
111
token : ${{ secrets.CODECOV_TOKEN }}
80
112
verbose : true
113
+ files : merged-output/coverage-summary.json
114
+ slug : apache/superset
115
+
116
+ core-cover :
117
+ needs : frontend-build
118
+ if : needs.frontend-build.result == 'success'
119
+ runs-on : ubuntu-24.04
120
+ steps :
121
+ - name : Download Docker Image Artifact
122
+ uses : actions/download-artifact@v4
123
+ with :
124
+ name : docker-image
125
+
126
+ - name : Load Docker Image
127
+ run : docker load < docker-image.tar.gz
128
+
129
+ - name : superset-ui/core coverage
130
+ run : |
131
+ docker run --rm $TAG bash -c \
132
+ "npm run core:cover"
133
+
134
+ lint-frontend :
135
+ needs : frontend-build
136
+ if : needs.frontend-build.result == 'success'
137
+ runs-on : ubuntu-24.04
138
+ steps :
139
+ - name : Download Docker Image Artifact
140
+ uses : actions/download-artifact@v4
141
+ with :
142
+ name : docker-image
143
+
144
+ - name : Load Docker Image
145
+ run : docker load < docker-image.tar.gz
146
+
147
+ - name : eslint
148
+ run : |
149
+ docker run --rm $TAG bash -c \
150
+ "npm i && npm run eslint -- . --quiet"
151
+
152
+ - name : tsc
153
+ run : |
154
+ docker run --rm $TAG bash -c \
155
+ "npm run type"
156
+
157
+ validate-frontend :
158
+ needs : frontend-build
159
+ if : needs.frontend-build.result == 'success'
160
+ runs-on : ubuntu-24.04
161
+ steps :
162
+ - name : Download Docker Image Artifact
163
+ uses : actions/download-artifact@v4
164
+ with :
165
+ name : docker-image
166
+
167
+ - name : Load Docker Image
168
+ run : docker load < docker-image.tar.gz
169
+
170
+ - name : Build Plugins Packages
171
+ run : |
172
+ docker run --rm $TAG bash -c \
173
+ "npm run plugins:build"
174
+
175
+ - name : Build Plugins Storybook
176
+ run : |
177
+ docker run --rm $TAG bash -c \
178
+ "npm run plugins:build-storybook"
0 commit comments