255 lines (245 loc) · 8.81 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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
name: CI
on:
push:
release:
types: [published]
jobs:
compile:
name: Build and Test
runs-on: ubuntu-latest
steps:
- name: checkout source
uses: actions/checkout@v1
with:
fetch-depth: 15
- name: Setup JDK
uses: actions/setup-java@v2
with:
distribution: temurin
java-version: 11
- name: get current time
uses: josStorer/get-current-time@v2
id: current-time
with:
format: YYYY-MM-DD
utcOffset: "+02:00"
- name: use daily bazel disk cache
uses: actions/cache@v2
with:
path: ~/.bazel_disk_cache
key: ${{ runner.OS }}-bazel_disk_cache-${{ steps.current-time.outputs.formattedTime }}
- name: setup java version
uses: joschi/setup-jdk@v2
with:
java-version: '11' # The OpenJDK version to make available on the path
architecture: 'x64' # defaults to 'x64'
- name: install requirements
run: sudo apt-get install ca-certificates-java expect
- name: Coursier cache
uses: coursier/cache-action@v6
- name: Build and Test
run: make test
- name: Cleanup before cache
shell: bash
run: |
rm -rf "$HOME/.ivy2/local" || true
find $HOME/Library/Caches/Coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true
find $HOME/.cache/coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.sbt -name "*.lock" -delete || true
# ------------------------------------------
# ------------------------------------------
# Test client-test-data
client-test-data-tests:
name: Test client-test-data
runs-on: ubuntu-latest
steps:
- name: checkout source
uses: actions/checkout@v1
with:
fetch-depth: 15
- name: get current time
uses: josStorer/get-current-time@v2
id: current-time
with:
format: YYYY-MM-DD
utcOffset: "+02:00"
- name: use daily bazel disk cache
uses: actions/cache@v2
with:
path: ~/.bazel_disk_cache
key: ${{ runner.OS }}-bazel_disk_cache-${{ steps.current-time.outputs.formattedTime }}
- name: setup java version
uses: joschi/setup-jdk@v2
with:
java-version: '11' # The OpenJDK version to make available on the path
architecture: 'x64' # defaults to 'x64'
- name: install requirements
run: sudo apt-get install ca-certificates-java expect unzip
- name: Coursier cache
uses: coursier/cache-action@v6
- name: generate api-client-test-data
run: make client-test-data
- name: Cleanup before cache
shell: bash
run: |
rm -rf "$HOME/.ivy2/local" || true
find $HOME/Library/Caches/Coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true
find $HOME/.cache/coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.sbt -name "*.lock" -delete || true
# ------------------------------------------
# ------------------------------------------
upgrade-integration-tests:
name: Upgrade Integration Tests
runs-on: ubuntu-latest
steps:
- name: checkout source
uses: actions/checkout@v1
with:
fetch-depth: 15
- name: get current time
uses: josStorer/get-current-time@v2
id: current-time
with:
format: YYYY-MM-DD
utcOffset: "+02:00"
- name: use daily bazel disk cache
uses: actions/cache@v2
with:
path: ~/.bazel_disk_cache
key: ${{ runner.OS }}-bazel_disk_cache-${{ steps.current-time.outputs.formattedTime }}
- name: setup java version
uses: joschi/setup-jdk@v2
with:
java-version: '11' # The OpenJDK version to make available on the path
architecture: 'x64' # defaults to 'x64'
- name: Install dependencies
run: |
sudo apt-get install ca-certificates-java expect
- name: test repository upgrade
run: make test-repository-upgrade
docs-build-test:
name: Build Docs Testrun
runs-on: ubuntu-latest
steps:
- name: checkout source
uses: actions/checkout@v1
with:
fetch-depth: 1
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r docs/requirements.txt
npm install --global typedoc
sudo apt-get install graphviz
- name: run docs build
run: make docs-build
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:
- uses: GoogleCloudPlatform/release-please-action@v2
with:
token: ${{ secrets.GH_TOKEN }}
release-type: simple
package-name: dsp-api
changelog-types: '[
{"type": "feat", "section": "Enhancements", "hidden": false },
{"type": "fix", "section": "Bug Fixes", "hidden": false },
{"type": "build", "section": "Maintenance", "hidden": false },
{"type": "chore", "section": "Maintenance", "hidden": false },
{"type": "refactor", "section": "Maintenance", "hidden": false },
{"type": "docs", "section": "Documentation", "hidden": false }
]'
# publish only on release
publish:
name: Publish (on release only)
needs: [
compile,
client-test-data-tests,
upgrade-integration-tests,
docs-build-test
]
runs-on: ubuntu-latest
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags')
steps:
- name: checkout source
uses: actions/checkout@v1
with:
fetch-depth: 50
- name: get current time
uses: josStorer/get-current-time@v2
id: current-time
with:
format: YYYY-MM-DD
utcOffset: "+02:00"
- name: use daily bazel disk cache
uses: actions/cache@v2
with:
path: ~/.bazel_disk_cache
key: ${{ runner.OS }}-bazel_disk_cache-${{ steps.current-time.outputs.formattedTime }}
- name: setup java version
uses: joschi/setup-jdk@v2
with:
java-version: '11' # The OpenJDK version to make available on the path
architecture: 'x64' # defaults to 'x64'
- name: install requirements
run: sudo apt-get install ca-certificates-java expect unzip
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r docs/requirements.txt
npm install --global typedoc
sudo apt-get install graphviz
- name: generate api-client-test-data
run: make client-test-data
- name: add api-client-test-data to release assets
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GH_TOKEN }}
file: client-test-data.zip
tag: ${{ github.ref }}
overwrite: true
- name: build and publish all images to Dockerhub
run: |
echo ${{ secrets.DOCKER_HUB_TOKEN }} | docker login -u ${{ secrets.DOCKER_USER }} --password-stdin
make docker-publish
# google chat notification about release
notification:
name: Google chat notification about release and published version
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 }}
# deploy documentation only on release
deploy-docs:
name: Deploy docs (on release only)
needs: [
docs-build-test
]
runs-on: ubuntu-latest
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags')
steps:
- name: checkout source
uses: actions/checkout@v1
with:
fetch-depth: 1
- name: install dependencies
run: |
python -m pip install --upgrade pip
pip install -r docs/requirements.txt
npm install --global typedoc
sudo apt-get install graphviz
- name: deploy docs
uses: mhausenblas/mkdocs-deploy-gh-pages@1.16
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
CUSTOM_DOMAIN: docs-api.dasch.swiss
REQUIREMENTS: docs/requirements.txt