-
Notifications
You must be signed in to change notification settings - Fork 14
290 lines (252 loc) · 9.83 KB
/
ci.yaml
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
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
name: LIPAS CI
on: [push]
env:
AUTH_KEY: ${{ vars.AUTH_KEY }}
ADMIN_PASSWORD: ${{ vars.ADMIN_PASSWORD }}
SMTP_HOST: ${{ vars.SMTP_HOST }}
SMTP_USER: ${{ vars.SMTP_USER }}
SMTP_FROM: ${{ vars.SMTP_FROM }}
SMTP_PASS: ${{ vars.SMTP_PASS }}
SEARCH_HOST: ${{ vars.SEARCH_HOST }}
SEARCH_USER: ${{ vars.SEARCH_USER }}
SEARCH_PASS: ${{ vars.SEARCH_PASS}}
ES_JAVA_OPTS: ${{ vars.ES_JAVA_OPTS }}
DB_NAME: ${{ vars.DB_NAME }}
DB_HOST: ${{ vars.DB_HOST }}
DB_PORT: ${{ vars.DB_PORT }}
DB_SUPERUSER: ${{ vars.DB_SUPERUSER }}
DB_SUPERUSER_PASSWORD: ${{ vars.DB_SUPERUSER_PASSWORD }}
DB_USER: ${{ vars.DB_USER }}
DB_PASSWORD: ${{ vars.DB_PASSWORD }}
MML_AUTH: ${{ vars.MML_AUTH }}
OLD_LIPAS_URL: ${{ vars.OLD_LIPAS_URL }}
OLD_LIPAS_USER: ${{ vars.OLD_LIPAS_USER }}
OLD_LIPAS_PASS: ${{ vars.OLD_LIPAS_PASS }}
ACCESSIBILITY_REGISTER_BASE_URL: ${{ vars.ACCESSIBILITY_REGISTER_BASE_URL }}
ACCESSIBILITY_REGISTER_SYSTEM_ID: ${{ vars.ACCESSIBILITY_REGISTER_SYSTEM_ID }}
ACCESSIBILITY_REGISTER_SECRET_KEY: ${{ vars.ACCESSIBILITY_REGISTER_SECRET_KEY }}
LEGACY_DB_URL: ${{ vars.LEGACY_DB_URL }}
LEGACY_DB_USER: ${{ vars.LEGACY_DB_USER }}
LEGACY_DB_PASS: ${{ vars.LEGACY_DB_PASS }}
GEOSERVER_ADMIN_USER: ${{ vars.GEOSERVER_ADMIN_USER }}
GEOSERVER_ADMIN_PASSWORD: ${{ vars.GEOSERVER_ADMIN_PASSWORD }}
GEOSERVER_INITIAL_MEMORY: ${{ vars.GEOSERVER_INITIAL_MEMORY }}
GEOSERVER_MAX_MEMORY: ${{ vars.GEOSERVER_MAX_MEMORY}}
OSRM_CAR_URL: ${{ vars.OSRM_CAR_URL }}
OSRM_BICYCLE_URL: ${{ vars.OSRM_BICYCLE_URL }}
OSRM_FOOT_URL: ${{ vars.OSRM_FOOT_URL }}
MAILCHIMP_CAMPAIGN_FOLDER_ID: ${{ vars.MAILCHIMP_CAMPAIGN_FOLDER_ID }}
MAILCHIMP_LIST_ID: ${{ vars.MAILCHIMP_LIST_ID }}
MAILCHIMP_NEWSLETTER_INTEREST_ID: ${{ vars.MAILCHIMP_NEWSLETTER_INTEREST_ID }}
MAILCHIMP_API_URL: ${{ vars.MAILCHIMP_API_URL }}
MAILCHIMP_API_KEY: ${{ vars.MAILCHIMP_API_KEY }}
DIGITRANSIT_SUBSCRIPTION_KEY: ${{ vars.DIGITRANSIT_SUBSCRIPTION_KEY }}
MML_COVERAGE_URL: ${{ vars.MML_COVERAGE_URL }}
MML_API_KEY: ${{ vars.MML_API_KEY }}
AWS_ACCESS_KEY_ID: lol
AWS_SECRET_ACCESS_KEY: lol
AWS_REGION: 'eu-north-1'
AWS_S3_BUCKET: lol
AWS_S3_BUCKET_PREFIX: lol
LEIN_SILENT: true
UTP_CMS_API_URL: "https://luontoon-fi-cms-test.druid.fi/fi/jsonapi"
UTP_CMS_API_USER: lipas-developer
UTP_CMS_API_PASS: password
UTP_WEBHOOK_SOURCE_ENV: ${{ vars.UTP_WEBHOOK_SOURCE_ENV }}
UTP_WEBHOOK_URL: ${{ vars.UTP_WEBHOOK_URL }}
UTP_WEBHOOK_SUBSCRIPTION_KEY: ${{ vars.UTP_WEBHOOK_SUBSCRIPTION_KEY }}
UTP_WEBHOOK_TOKEN_CLIENT_ID: ${{ vars.UTP_WEBHOOK_TOKEN_CLIENT_ID }}
UTP_WEBHOOK_TOKEN_CLIENT_SECRET: ${{ vars.UTP_WEBHOOK_TOKEN_CLIENT_SECRET }}
UTP_WEBHOOK_TOKEN_URL: ${{ vars.UTP_WEBHOOK_TOKEN_URL }}
PTV_API_URL: "https://api.palvelutietovaranto.trn.suomi.fi/api"
PTV_TOKEN_URL: "https://palvelutietovaranto.trn.suomi.fi/api/auth/api-login"
PTV_SERVICE_URL: "https://api.palvelutietovaranto.trn.suomi.fi/api/v11/Service"
PTV_SERVICE_LOCATION_URL: "https://api.palvelutietovaranto.trn.suomi.fi/api/v11/ServiceChannel/ServiceLocation"
PTV_ORG_ID: "52e0f6dc-ec1f-48d5-a0a2-7a4d8b657d53"
PTV_API_USERNAME: ${{ vars.PTV_API_USERNAME }}
PTV_API_PASSWORD: ${{ vars.PTV_API_PASSWORD }}
OPEN_AI_API_KEY: ${{ vars.OPEN_AI_API_KEY }}
jobs:
utp-schema-gen:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Install clojure tools
uses: DeLaGuardo/setup-clojure@11.0
with:
lein: latest
- name: Cache clojure dependencies
uses: actions/cache@v3
with:
path: |
~/.m2/repository
~/.gitlibs
~/.deps.clj
# List all files containing dependencies:
# key: cljdeps-${{ hashFiles('deps.edn') }}
# key: cljdeps-${{ hashFiles('deps.edn', 'bb.edn') }}
key: cljdeps-${{ hashFiles('webapp/project.clj') }}
# key: cljdeps-${{ hashFiles('build.boot') }}
restore-keys: cljdeps-
- name: Check if there are changes
id: changed-files
uses: tj-actions/changed-files@v41
with:
files: |
webapp/src/cljc/lipas/data/activities.cljc
- name: Generate JSON schema
if: steps.changed-files.outputs.any_changed == 'true'
run: lein run -m lipas.data.activities > utp-schema.json
working-directory: ./webapp
- name: Generate CSV
if: steps.changed-files.outputs.any_changed == 'true'
run: lein run -m lipas.data.activities csv > utp-schema.csv
working-directory: ./webapp
- name: Deploy JSON schema to Gist
if: steps.changed-files.outputs.any_changed == 'true'
uses: exuanbo/actions-deploy-gist@v1.1.4
with:
token: ${{ secrets.UTP_SCHEMA_GIST_TOKEN }}
gist_id: ace43a7f66f7b14c526baab0f29c91d9
file_path: webapp/utp-schema.json
file_type: text
- name: Deploy CSV to Gist
if: steps.changed-files.outputs.any_changed == 'true'
uses: exuanbo/actions-deploy-gist@v1.1.4
with:
token: ${{ secrets.UTP_SCHEMA_GIST_TOKEN }}
gist_id: 557991b8d68186e5ec4e88388a1c1741
file_path: webapp/utp-schema.csv
file_type: text
loi-schema-gen:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Install clojure tools
uses: DeLaGuardo/setup-clojure@11.0
with:
lein: latest
- name: Cache clojure dependencies
uses: actions/cache@v3
with:
path: |
~/.m2/repository
~/.gitlibs
~/.deps.clj
# List all files containing dependencies:
# key: cljdeps-${{ hashFiles('deps.edn') }}
# key: cljdeps-${{ hashFiles('deps.edn', 'bb.edn') }}
key: cljdeps-${{ hashFiles('webapp/project.clj') }}
# key: cljdeps-${{ hashFiles('build.boot') }}
restore-keys: cljdeps-
- name: Check if there are changes
id: changed-files
uses: tj-actions/changed-files@v41
with:
files: |
webapp/src/cljc/lipas/data/loi.cljc
- name: Generate JSON schema
if: steps.changed-files.outputs.any_changed == 'true'
run: lein run -m lipas.data.loi > loi-schema.json
working-directory: ./webapp
- name: Generate CSV
if: steps.changed-files.outputs.any_changed == 'true'
run: lein run -m lipas.data.loi csv > loi-schema.csv
working-directory: ./webapp
- name: Deploy JSON schema to Gist
if: steps.changed-files.outputs.any_changed == 'true'
uses: exuanbo/actions-deploy-gist@v1.1.4
with:
token: ${{ secrets.UTP_SCHEMA_GIST_TOKEN }}
gist_id: d531983de8b935dcff838b1d5403a5f1
file_path: webapp/loi-schema.json
file_type: text
- name: Deploy CSV to Gist
if: steps.changed-files.outputs.any_changed == 'true'
uses: exuanbo/actions-deploy-gist@v1.1.4
with:
token: ${{ secrets.UTP_SCHEMA_GIST_TOKEN }}
gist_id: 1cf16b04329482559ea72815f894833a
file_path: webapp/loi-schema.csv
file_type: text
ci:
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Install clojure tools
uses: DeLaGuardo/setup-clojure@11.0
with:
# cli: latest
lein: latest
- name: Cache clojure dependencies
uses: actions/cache@v3
with:
path: |
~/.m2/repository
~/.gitlibs
~/.deps.clj
# List all files containing dependencies:
# key: cljdeps-${{ hashFiles('deps.edn') }}
# key: cljdeps-${{ hashFiles('deps.edn', 'bb.edn') }}
key: cljdeps-${{ hashFiles('webapp/project.clj') }}
# key: cljdeps-${{ hashFiles('build.boot') }}
restore-keys: cljdeps-
- name: Install node
uses: actions/setup-node@v3
with:
node-version: 18
cache: npm
cache-dependency-path: webapp/package-lock.json
# TODO: Drop docker compose in CI config
- name: Run backend tests
run: docker compose run --rm backend-tests
- name: Build backend jar
run: docker compose run --rm backend-build
- name: Build frontend
run: |
npm install --quiet
npx shadow-cljs release app
working-directory: ./webapp
# - name: Install npm dependencies
# run: docker compose run --rm frontend-npm-deps
# - name: Build frontend
# run: docker compose run --rm frontend-build
# - name: Run backend migrations
# run: docker compose run --rm backend-migrate
# - name: Seed backend data to db
# run: docker compose run --rm backend-seed
# - name: Index backend data to ES
# run: docker compose run --rm backend-index-search
# - name: Generate self-sigend SSL-certificate
# run: |
# openssl req -new -newkey rsa:2048 -days 365 -nodes -x509 \
# -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" \
# -keyout certs/server.key -out certs/server.crt
# - name: Run integration tests
# run: docker compose run --rm integration-tests
- name: docker logs
if: ${{ failure() }}
run: docker compose logs