forked from eclipse-sirius/sirius-web
-
Notifications
You must be signed in to change notification settings - Fork 0
260 lines (226 loc) · 9.57 KB
/
build.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
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
name: Continuous integration
on:
push:
paths-ignore:
- "CHANGELOG.adoc"
- "README.adoc"
- "doc/**"
branches:
- "**"
tags:
- "*"
pull_request:
workflow_dispatch:
jobs:
build:
name: Build
runs-on: ubuntu-latest
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: github.event_name != 'pull_request'
with:
fetch-depth: 0
- name: Checkout
uses: actions/checkout@v4
if: github.event_name == 'pull_request'
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup Node SDK
uses: actions/setup-node@v4
with:
node-version: 18.7
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-charts
npx yalc add @eclipse-sirius/sirius-components-core
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-portals
npx yalc add @eclipse-sirius/sirius-components-widget-reference
npx yalc add @eclipse-sirius/sirius-components-selection
npx yalc add @eclipse-sirius/sirius-components-trees
npx yalc add @eclipse-sirius/sirius-components-validation
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(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(github.ref, 'refs/tags/v')
run: |
npm publish --workspaces
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Build the Docker image
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: sirius-web
IMAGE_TAG: ${{ env.git_describe }}
run: |
docker build -t siriusweb packages/sirius-web/backend/sirius-web
- name: Check the integration test code
run: |
npm ci
npm run eslint
working-directory: integration-tests
- name: Run end to end tests against the sirius-web application
if: startsWith(github.ref, 'refs/tags/v') == false && github.ref != 'refs/heads/master'
uses: cypress-io/github-action@v5
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
wait-on: "http://localhost:8080/login"
wait-on-timeout: 180
working-directory: integration-tests
record: false
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: sirius-web
IMAGE_TAG: ${{ env.git_describe }}
GITHUB_TOKEN: ${{ github.token }}
- name: Store Cypress screenshots
if: always()
uses: actions/upload-artifact@v4
with:
name: cypress-screenshots
path: integration-tests/target/screenshots/**/*.png
retention-days: 5
- name: Configure AWS CLI for Sirius Web
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.STAGING_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.STAGING_AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-3
- name: Login to Amazon Elastic Container Registry
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Tag the Docker image
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
run: docker tag siriusweb $REGISTRY/$REPOSITORY:$IMAGE_TAG
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: sirius-web
IMAGE_TAG: ${{ env.git_describe }}
- name: Upload the Docker image to AWS ECR
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: sirius-web
IMAGE_TAG: ${{ env.git_describe }}
run: |
docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG
- name: Upload the Docker configuration for AWS Elastic Beanstalk
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: sirius-web
IMAGE_TAG: ${{ env.git_describe }}
run: |
sed -e "s|IMAGE_NAME|$REGISTRY/$REPOSITORY:$IMAGE_TAG|" Dockerrun.aws.json.template > Dockerrun.aws.json
aws s3 cp Dockerrun.aws.json s3://sirius-web-deployment/integration/${{ env.git_describe }}/Dockerrun.aws.json
- name: Create a new ElasticBeanstalk Application Version for Sirius Web Staging
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
run: aws elasticbeanstalk create-application-version --application-name "Sirius Web" --source-bundle S3Bucket="sirius-web-deployment",S3Key="integration/${{ env.git_describe }}/Dockerrun.aws.json" --version-label "${{ env.git_describe }}" --description "${{ github.sha }}"
- name: Deploy a new ElasticBeanstalk Application Version for Sirius Web Staging
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
run: aws elasticbeanstalk update-environment --environment-name "sirius-web-staging" --version-label "${{ env.git_describe }}"