-
Notifications
You must be signed in to change notification settings - Fork 6
224 lines (211 loc) · 7.58 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
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: "Adding GitHub registry"
run: |
echo "//npm.pkg.github.com/:_authToken=${{ secrets.ORG_GITHUB_PACKAGES_PAT }}" > ~/.npmrc
echo "registry=https://npm.pkg.github.com/dasch-swiss" >> ~/.npmrc
- 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
- name: "Adding GitHub registry"
run: |
echo "//npm.pkg.github.com/:_authToken=${{ secrets.ORG_GITHUB_PACKAGES_PAT }}" > ~/.npmrc
echo "registry=https://npm.pkg.github.com/dasch-swiss" >> ~/.npmrc
- 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: |
echo "//npm.pkg.github.com/:_authToken=${{ secrets.ORG_GITHUB_PACKAGES_PAT }}" > ~/.npmrc
echo "registry=https://npm.pkg.github.com/dasch-swiss" >> ~/.npmrc
- run: 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
run: |
cd ../dsp-das
npm run e2e-ci
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: |
echo "//npm.pkg.github.com/:_authToken=${{ secrets.ORG_GITHUB_PACKAGES_PAT }}" > ~/.npmrc
echo "registry=https://npm.pkg.github.com/dasch-swiss" >> ~/.npmrc
- 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: |
echo "//npm.pkg.github.com/:_authToken=${{ secrets.ORG_GITHUB_PACKAGES_PAT }}" > ~/.npmrc
echo "registry=https://npm.pkg.github.com/dasch-swiss" >> ~/.npmrc
- 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: |
echo "//npm.pkg.github.com/:_authToken=${{ secrets.ORG_GITHUB_PACKAGES_PAT }}" > ~/.npmrc
echo "registry=https://npm.pkg.github.com/dasch-swiss" >> ~/.npmrc
- 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: |
echo "//npm.pkg.github.com/:_authToken=${{ secrets.ORG_GITHUB_PACKAGES_PAT }}" > ~/.npmrc
echo "registry=https://npm.pkg.github.com/dasch-swiss" >> ~/.npmrc
- 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}"
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", "hidden": false },
{"type": "fix", "section": "Bug Fixes", "hidden": false },
{"type": "chore", "section": "Maintenance", "hidden": false },
{"type": "refactor", "section": "Maintenance", "hidden": false },
{"type": "style", "section": "Maintenance", "hidden": false },
{"type": "docs", "section": "Documentation", "hidden": false }
]'
# 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-build