-
Notifications
You must be signed in to change notification settings - Fork 6
233 lines (219 loc) · 7.33 KB
/
main.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
name: CI
on:
push:
env:
# use the read-write access token so that build cache in nx-cloud can be updated
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
jobs:
test:
name: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # gets additionally all tags which we need
- uses: actions/setup-node@v3
with:
node-version: 18
- name: "Run npm install"
run: |
npm install
npx nx run-many --all --target=lint --skip-nx-cache
# npx nx run-many --all --target=test --configuration=ci
env:
TZ: Europe/Zurich
dsp-app-tests:
name: DSP-APP
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # gets additionally all tags which we need
- uses: actions/setup-node@v3
with:
node-version: 18
- uses: browser-actions/setup-chrome@v1
- run: npm install
- run: npx nx run dsp-app:lint
# - run: npx nx run dsp-app:test:ci
env:
TZ: Europe/Zurich
dsp-app-e2e-tests:
name: DSP-APP E2E
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # gets additionally all tags which we need
- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm install
- name: Install Cypress dependencies
run: |
cd ../dsp-das/apps/dsp-app/cypress
npm install
- name: Checkout DSP-API repo
uses: actions/checkout@v3
with:
repository: dasch-swiss/dsp-api
ref: main
path: dsp-api
- name: Start API
run: |
cd dsp-api
make init-db-test
docker compose -f docker-compose.yml up -d sipi ingest api
./webapi/scripts/wait-for-api.sh
- name: Run e2e tests in CI
if: github.event_name == 'push'
run: |
cd ../dsp-das
npm run e2e-ci
- name: Run e2e tests on Cypress Cloud on push
if: github.event_name == 'pull_request' && startsWith(github.event.pull_request.head.ref, 'release-please') && github.event.pull_request.merged == true
run: |
cd ../dsp-das
export CYPRESS_RECORD_KEY=$CYPRESS_RECORD_KEY_SECRET
npm run e2e-cloud
env:
CYPRESS_RECORD_KEY_SECRET: ${{ secrets.CYPRESS_RECORD_KEY }}
- name: Upload artifact
uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-snapshots
path: apps/dsp-app/cypress/fixtures/screenshots
jdnconvertiblecalendar-tests:
name: JDNConvertibleCalendar
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # gets additionally all tags which we need
- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm install
- run: npx nx run jdnconvertiblecalendar:lint
- run: npx nx run jdnconvertiblecalendar:test:ci
jdnconvertiblecalendardateadapter-tests:
name: JDNConvertibleCalendarDateAdapter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # gets additionally all tags which we need
- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm install
- run: npx nx run jdnconvertiblecalendardateadapter:lint
- run: npx nx run jdnconvertiblecalendardateadapter:test:ci
vre-shared-app-config-tests:
name: vre-shared-app-config
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # gets additionally all tags which we need
- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm install
- run: npx nx run vre-shared-app-config:lint
- run: npx nx run vre-shared-app-config:test:ci
# publish on commit to main or tag
publish:
name: Publish to Dockerhub only on main or tag (release) commits
needs: [
# test,
# dsp-app-tests,
jdnconvertiblecalendar-tests,
jdnconvertiblecalendardateadapter-tests,
vre-shared-app-config-tests
]
runs-on: ubuntu-latest
if: github.ref_name == 'main' || startsWith(github.ref, 'refs/tags')
outputs:
tag: ${{ steps.output_docker_image_tag.outputs.tag }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # gets additionally all tags which we need
- name: Output docker image tag
id: output_docker_image_tag
run: echo "tag=$(make docker-image-tag | tr -d '\n')" >> "$GITHUB_OUTPUT"
shell: bash # Explicit for fail-fast behaviour
- uses: actions/setup-node@v3
with:
node-version: 18
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- run: make docker-publish
trigger-dev-deployment:
name: Trigger deployment to DEV
runs-on: ubuntu-latest
needs: publish
steps:
- name: Trigger deployment to DEV
env:
IMAGE_TAG: ${{ needs.publish.outputs.tag }}
JENKINS_BASIC_AUTH_USER: ${{ secrets.JENKINS_BASIC_AUTH_USER }}
JENKINS_BASIC_AUTH_PASS: ${{ secrets.JENKINS_BASIC_AUTH_PASS }}
JENKINS_DEV_WEBHOOK: ${{ secrets.JENKINS_DEV_WEBHOOK }}
run: |
curl -f -u "${JENKINS_BASIC_AUTH_USER}:${JENKINS_BASIC_AUTH_PASS}" \
-X POST "${JENKINS_DEV_WEBHOOK}" \
-d "Service=app&Version=${IMAGE_TAG}"
send-chat-notification:
name: Send google chat notification
needs: [publish]
runs-on: ubuntu-latest
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags')
steps:
- name: Send notification to google chat room "DSP releases"
uses: lakto/google-chat-action@main
with:
url: ${{ secrets.GOOGLE_CHAT_DSP_RELEASES_WEBHOOK_URL }}
release-please:
name: Prepare next release
runs-on: ubuntu-latest
# Automate releases with Conventional Commit Messages as Pull Requests are merged into "main" branch
if: github.ref == 'refs/heads/main'
steps:
- name: Get release please action
uses: GoogleCloudPlatform/release-please-action@v3
with:
token: ${{ secrets.GH_TOKEN }}
release-type: node
package-name: DSP-APP
changelog-types: '[
{"type": "feat", "section": "Enhancements"},
{"type": "fix", "section": "Bug Fixes"},
{"type": "chore", "section": "Maintenances"},
{"type": "refactor", "section": "Maintenances"},
{"type": "style", "section": "Maintenances"},
{"type": "docs", "section": "Documentation"},
{"type": "test", "section": "Tests"}
]'
# build documentation
docs-build-test:
name: Docs Build Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r docs/requirements.txt
- run: make docs-lint
- run: make docs-build