-
Notifications
You must be signed in to change notification settings - Fork 84
329 lines (289 loc) · 12.3 KB
/
build.yml
File metadata and controls
329 lines (289 loc) · 12.3 KB
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
name: Continuous integration
on:
push:
paths-ignore:
- "CHANGELOG.adoc"
- "README.adoc"
- "doc/**"
branches:
- "**"
tags:
- "*"
pull_request:
workflow_dispatch:
env:
GITHUB_EVENT_NAME: ${{ github.event_name }}
GITHUB_EVENT_PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
GITHUB_REF: ${{ github.ref }}
jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
attestations: write
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
steps:
- name: Checkout
uses: actions/checkout@v4
if: env.GITHUB_EVENT_NAME != 'pull_request'
with:
fetch-depth: 0
- name: Checkout
uses: actions/checkout@v4
if: env.GITHUB_EVENT_NAME == 'pull_request'
with:
ref: ${{ env.GITHUB_EVENT_PR_HEAD_SHA }}
persist-credentials: false
- name: Setup Node SDK
uses: actions/setup-node@v4
with:
node-version: 22.16
registry-url: https://npm.pkg.github.com/
- name: Cache Node.js modules
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Setup Java SDK
uses: actions/setup-java@v4
with:
java-version: 17
distribution: "temurin"
- name: Setup some global environment variables
run: |
echo "git_describe=$(git describe)" >> $GITHUB_ENV
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build the frontend packages
run: |
echo "//npm.pkg.github.com/:_authToken=${{ github.token }}" >> .npmrc
npm install -g yalc
npm ci
npx turbo run coverage
npx turbo run publish:local
- name: Copy frontend artifacts
run: |
mkdir -p packages/sirius-web/backend/sirius-web-frontend/src/main/resources/static
cp -R packages/sirius-web/frontend/sirius-web/dist/* packages/sirius-web/backend/sirius-web-frontend/src/main/resources/static
- name: Build the backend
env:
USERNAME: ${{github.actor}}
PASSWORD: ${{secrets.GITHUB_TOKEN}}
run: mvn -U -B -e clean verify -f packages/pom.xml --settings settings.xml
- name: Check if all files have been commited
run: node scripts/check-gitdiff.js
- name: Build the vscode extension
run: |
echo "//npm.pkg.github.com/:_authToken=${{ github.token }}" >> .npmrc
npm install -g vsce
npx yalc add @eclipse-sirius/sirius-components-browser
npx yalc add @eclipse-sirius/sirius-components-charts
npx yalc add @eclipse-sirius/sirius-components-core
npx yalc add @eclipse-sirius/sirius-components-datatree
npx yalc add @eclipse-sirius/sirius-components-deck
npx yalc add @eclipse-sirius/sirius-components-diagrams
npx yalc add @eclipse-sirius/sirius-components-formdescriptioneditors
npx yalc add @eclipse-sirius/sirius-components-forms
npx yalc add @eclipse-sirius/sirius-components-gantt
npx yalc add @eclipse-sirius/sirius-components-impactanalysis
npx yalc add @eclipse-sirius/sirius-components-omnibox
npx yalc add @eclipse-sirius/sirius-components-portals
npx yalc add @eclipse-sirius/sirius-components-selection
npx yalc add @eclipse-sirius/sirius-components-tables
npx yalc add @eclipse-sirius/sirius-components-trees
npx yalc add @eclipse-sirius/sirius-components-validation
npx yalc add @eclipse-sirius/sirius-components-widget-reference
npx yalc add @eclipse-sirius/sirius-components-widget-table
npx yalc add @eclipse-sirius/sirius-web-application
npm i
npm run compile
vsce package
working-directory: vscode-extension
- name: Store the vscode extension
uses: actions/upload-artifact@v4
with:
name: vscode
path: vscode-extension/sirius-web-*.vsix
retention-days: 20
- name: Archive the code coverage results
run: tar -cf coverage.tar packages/releng/backend/sirius-components-test-coverage/target/site/jacoco-aggregate
- name: Store code coverage results
uses: actions/upload-artifact@v4
if: always()
with:
name: jacoco
path: coverage.tar
retention-days: 5
- name: Store Core frontend code coverage results
uses: actions/upload-artifact@v4
if: always()
with:
name: core
path: packages/core/frontend/sirius-components-core/coverage
retention-days: 5
- name: Store FormDescriptionEditors frontend code coverage results
uses: actions/upload-artifact@v4
if: always()
with:
name: formdescriptioneditors
path: packages/formdescriptioneditors/frontend/sirius-components-formdescriptioneditors/coverage
retention-days: 5
- name: Store Forms frontend code coverage results
uses: actions/upload-artifact@v4
if: always()
with:
name: forms
path: packages/forms/frontend/sirius-components-forms/coverage
retention-days: 5
- name: Store Trees frontend code coverage results
uses: actions/upload-artifact@v4
if: always()
with:
name: trees
path: packages/trees/frontend/sirius-components-trees/coverage
retention-days: 5
- name: Check the global code coverage
run: jshell scripts/check-coverage.jsh
- name: Publish the backend
if: startsWith(env.GITHUB_REF, 'refs/tags/v')
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: mvn -B deploy -f packages/pom.xml
- name: Publish the frontend packages
if: startsWith(env.GITHUB_REF, 'refs/tags/v')
run: |
npm publish --workspaces
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Extract metadata (tags, labels) for main Docker image
id: extract-metadata
uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 # v5.7.0
with:
images: eclipsesirius/sirius-web
tags: |
type=ref,event=branch
type=ref,event=tag
type=sha
- name: Set up Docker Buildx to use cache feature
uses: docker/setup-buildx-action@v3
- name: Build Docker image
id: build
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
with:
context: packages/sirius-web/backend/sirius-web
load: true
tags: ${{ steps.extract-metadata.outputs.tags }}
labels: ${{ steps.extract-metadata.outputs.labels }}
- name: Check the Playwright integration test code
run: |
npm ci
npm run eslint
working-directory: integration-tests-playwright
- name: Install Playwright Browsers
if: startsWith(env.GITHUB_REF, 'refs/tags/v') == false && env.GITHUB_REF != 'refs/heads/master' && env.GITHUB_REF != 'refs/heads/cooldown'
run: npx playwright install --with-deps
working-directory: integration-tests-playwright
- name: Run Playwright tests against the sirius-web application
if: startsWith(env.GITHUB_REF, 'refs/tags/v') == false && env.GITHUB_REF != 'refs/heads/master' && env.GITHUB_REF != 'refs/heads/cooldown'
run: |
docker compose -f ../packages/sirius-web/backend/sirius-web/docker-compose.yml up -d
docker compose -f ../packages/sirius-web/backend/sirius-web/docker-compose.yml ps
npx wait-on -t 180000 http://localhost:8080
npx playwright test
working-directory: integration-tests-playwright
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: sirius-web
IMAGE_TAG: eclipsesirius/sirius-web:${{ steps.extract-metadata.outputs.version }}
- name: Store Playwright report
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: integration-tests-playwright/playwright-report/
retention-days: 5
- name: Check the Cypress integration test code
run: |
npm ci
npm run eslint
working-directory: integration-tests-cypress
- name: Run Cypress end to end tests against the sirius-web application
if: startsWith(env.GITHUB_REF, 'refs/tags/v') == false && env.GITHUB_REF != 'refs/heads/master' && env.GITHUB_REF != 'refs/heads/cooldown'
uses: cypress-io/github-action@v6
with:
build: docker compose -f ../packages/sirius-web/backend/sirius-web/docker-compose.yml up -d
start: |
docker compose -f ../packages/sirius-web/backend/sirius-web/docker-compose.yml ps
docker compose -f ../packages/sirius-web/backend/sirius-web/docker-compose.yml logs
wait-on: "http://localhost:8080"
wait-on-timeout: 180
working-directory: integration-tests-cypress
record: false
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: sirius-web
IMAGE_TAG: eclipsesirius/sirius-web:${{ steps.extract-metadata.outputs.version }}
GITHUB_TOKEN: ${{ github.token }}
- name: Store Cypress screenshots
if: always()
uses: actions/upload-artifact@v4
with:
name: cypress-screenshots
path: integration-tests-cypress/target/screenshots/**/*.png
retention-days: 5
- name: Log in to Docker Hub
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
if: env.GITHUB_EVENT_NAME == 'push' && (env.GITHUB_REF == 'refs/heads/master' || startsWith(env.GITHUB_REF, 'refs/tags/v'))
with:
username: ${{ env.DOCKER_HUB_USER }}
password: ${{ env.DOCKER_HUB_TOKEN }}
env:
DOCKER_HUB_USER: ${{ secrets.ORG_DOCKER_HUB_USER }}
DOCKER_HUB_TOKEN: ${{ secrets.ORG_DOCKER_HUB_TOKEN }}
- name: Push Docker image
if: env.GITHUB_EVENT_NAME == 'push' && (env.GITHUB_REF == 'refs/heads/master' || startsWith(env.GITHUB_REF, 'refs/tags/v'))
id: push
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
with:
context: packages/sirius-web/backend/sirius-web
push: true
tags: ${{ steps.extract-metadata.outputs.tags }}
labels: ${{ steps.extract-metadata.outputs.labels }}
- name: Extract metadata (tags, labels) for diagram image server Docker image
id: extract-metadata-image-server
uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 # v5.7.0
if: env.GITHUB_EVENT_NAME == 'push' && startsWith(env.GITHUB_REF, 'refs/tags/v')
with:
images: eclipsesirius/sirius-web-diagram-image-server
tags: |
type=ref,event=branch
type=ref,event=tag
type=sha
- name: Build the diagram image server Docker image
id: build-image-server
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
if: env.GITHUB_EVENT_NAME == 'push' && startsWith(env.GITHUB_REF, 'refs/tags/v')
with:
context: diagram-image-server
load: true
tags: ${{ steps.extract-metadata-image-server.outputs.tags }}
labels: ${{ steps.extract-metadata-image-server.outputs.labels }}
- name: Push diagram image server Docker image
if: env.GITHUB_EVENT_NAME == 'push' && startsWith(env.GITHUB_REF, 'refs/tags/v')
id: push-image-server
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
with:
context: diagram-image-server
push: true
tags: ${{ steps.extract-metadata-image-server.outputs.tags }}
labels: ${{ steps.extract-metadata-image-server.outputs.labels }}