-
Notifications
You must be signed in to change notification settings - Fork 7
206 lines (175 loc) · 7.31 KB
/
ci-verify-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
# Copyright (C) 2022 Dynamic Solutions
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: 'CI: verify build'
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
permissions:
id-token: write
contents: read
env:
APP_LC_FRONTEND_MODULE: applications/luna-low-code/frontend
APP_CC_FRONTEND_MODULE: applications/luna-custom-code/frontend
jobs:
verify-cms-docker-image:
name: Verify CMS Docker image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ secrets.GCP_WEBSIGHT_RELEASES_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GCP_WEBSIGHT_SNAPSHOTS_SNAPSHOT_READ_SA }}
- name: Build Docker image
uses: docker/build-push-action@v6
with:
load: true
tags: ds/websight-cms-starter:latest
- name: Run CMS with custom admin credentials
run: |
mkdir -p .test-secrets && echo -n "customPassword" > .test-secrets/admin.password
docker run -d -p 8080:8080 --name websight-cms --rm \
--mount source=segment-store-repository,target=/websight/launcher/repository \
-v "$(pwd)/.test-secrets/admin.password:/websight/launcher/resources/secrets/admin.password:ro" \
--env "WS_ADMIN_USERNAME=customAdmin" \
ds/websight-cms-starter:latest
echo "Waiting for the environment to be ready..."
timeout 300 bash -c 'until curl -s -f -o /dev/null -w "%{http_code}" http://localhost:8080/system/health; do echo " - waiting for the server..."; sleep 1; done'
- name: Verify custom credentials
run: ./.github/scripts/ci-verify-docker-image-with-custom-credentials.sh
verify-e2e-tests:
name: Verify E2E tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ secrets.GCP_WEBSIGHT_RELEASES_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GCP_WEBSIGHT_SNAPSHOTS_SNAPSHOT_READ_SA }}
- uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
cache: 'maven'
- uses: actions/cache@v3
with:
path: |
${{ env.APP_LC_FRONTEND_MODULE }}/node
${{ env.APP_LC_FRONTEND_MODULE }}/node_modules
${{ env.APP_CC_FRONTEND_MODULE }}/node
${{ env.APP_CC_FRONTEND_MODULE }}/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
- name: Verify Starter CMS Feature model with integration and E2E tests
run: ./mvnw --batch-mode clean verify -P e2e-functional
- name: Clear snapshots before caching
if: always()
run: find ~/.m2/repository/pl/ds -name "*-SNAPSHOT" -type d -print -prune -exec rm -r "{}" \;
prepare-data-for-visual-tests-from-main-branch:
name: Prepare data for visual tests from main branch
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.base.ref }} # main branch
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ secrets.GCP_WEBSIGHT_RELEASES_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GCP_WEBSIGHT_SNAPSHOTS_SNAPSHOT_READ_SA }}
- uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
cache: 'maven'
- uses: actions/cache@v3
with:
path: |
${{ env.APP_LC_FRONTEND_MODULE }}/node
${{ env.APP_LC_FRONTEND_MODULE }}/node_modules
${{ env.APP_CC_FRONTEND_MODULE }}/node
${{ env.APP_CC_FRONTEND_MODULE }}/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
- name: Visual tests - create reference snapshots
run: ./mvnw --batch-mode clean verify -DskipITs -P e2e-visual-seed
- name: Upload reference snapshots
uses: actions/upload-artifact@v3
with:
name: backstopjs-references
path: ./tests/end-to-end/backstop_data/bitmaps_reference
if-no-files-found: error
- name: Clear snapshots before caching
if: always()
run: find ~/.m2/repository/pl/ds -name "*-SNAPSHOT" -type d -print -prune -exec rm -r "{}" \;
verify-visual-regression:
name: Verify with visual regression tests
runs-on: ubuntu-latest
needs: [ prepare-data-for-visual-tests-from-main-branch ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ secrets.GCP_WEBSIGHT_RELEASES_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GCP_WEBSIGHT_SNAPSHOTS_SNAPSHOT_READ_SA }}
- uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
cache: 'maven'
- uses: actions/cache@v3
with:
path: |
${{ env.APP_LC_FRONTEND_MODULE }}/node
${{ env.APP_LC_FRONTEND_MODULE }}/node_modules
${{ env.APP_CC_FRONTEND_MODULE }}/node
${{ env.APP_CC_FRONTEND_MODULE }}/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
- name: Download reference screenshots
uses: actions/download-artifact@v3
with:
name: backstopjs-references
path: ./tests/end-to-end/backstop_data/bitmaps_reference
- name: Visual tests - compare with reference screenshots
id: visualTestsCompare
run: ./mvnw --batch-mode clean verify -DskipITs -P e2e-visual-check
continue-on-error: true
- name: Create visual tests report
if: steps.visualTestsCompare.outcome == 'failure'
shell: bash
run: |
./.github/scripts/ci-verify-build-read-report-failures.sh
sudo apt-get install -y pngquant && ./.github/scripts/ci-verify-build-provide-visual-regression-report.sh
- name: Upload visual test report
if: steps.visualTestsCompare.outcome == 'failure'
uses: actions/upload-artifact@v3
with:
name: visual-tests-report
path: artifacts/visual/
if-no-files-found: error
retention-days: 1
- name: Clear snapshots before caching
if: always()
run: find ~/.m2/repository/pl/ds -name "*-SNAPSHOT" -type d -print -prune -exec rm -r "{}" \;