-
Notifications
You must be signed in to change notification settings - Fork 8
270 lines (232 loc) · 11.2 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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
name: nightly CI/CD
on:
push:
workflow_dispatch:
schedule:
# every night at 3am
- cron: '0 3 * * *'
env:
PROJECT_NAME: "odh-mentor-otp"
API_HOST: http://localhost
API_PATH: /otp/routers/openmove
API_PORT: 8080
DOCKER_IMAGE_OTP: ghcr.io/${{ github.repository }}/odh-mentor-otp
DOCKER_IMAGE_OTP_REACT: ghcr.io/${{ github.repository }}/odh-mentor-otp-react
DOCKER_IMAGE_JOURNEY: ghcr.io/${{ github.repository }}/odh-mentor-otp-journey
DOCKER_IMAGE_GBFS: ghcr.io/${{ github.repository }}/odh-mentor-otp-gbfs
DOCKER_IMAGE_GEOCODER: ghcr.io/${{ github.repository }}/odh-mentor-otp-geocoder
DOCKER_IMAGE_CARSHARING: ghcr.io/${{ github.repository }}/odh-mentor-otp-carsharing
DOCKER_IMAGE_PARKING: ghcr.io/${{ github.repository }}/odh-mentor-otp-parking
DOCKER_IMAGE_ECHARGING: ghcr.io/${{ github.repository }}/odh-mentor-otp-echarging
DOCKER_IMAGE_DRT: ghcr.io/${{ github.repository }}/odh-mentor-otp-drt
DOCKER_IMAGE_TRAFFIC: ghcr.io/${{ github.repository }}/odh-mentor-otp-traffic
DOCKER_IMAGE_AMARILLO: ghcr.io/${{ github.repository }}/odh-mentor-otp-amarillo
jobs:
deploy-test:
runs-on: ubuntu-22.04
concurrency: deploy-test
env:
API_HOST: "https://otp.opendatahub.testingmachine.eu"
API_PORT: "443"
API_PATH: "/otp/routers/openmove"
GEOCODER_BASEURL: "https://geocoder.otp.opendatahub.testingmachine.eu"
PARKING_BASEURL: "https://parking.otp.opendatahub.testingmachine.eu"
DRT_BASEURL: "https://drt.otp.opendatahub.testingmachine.eu"
CHARGER_BASEURL: "https://charger.otp.opendatahub.testingmachine.eu"
CARSHARING_BASEURL: "https://carsharing.otp.opendatahub.testingmachine.eu"
TRAFFIC_BASEURL: "https://traffic.otp.opendatahub.testingmachine.eu"
AMARILLO_BASEURL: "https://amarillo.otp.opendatahub.testingmachine.eu"
MATOMO_BASE_URL: "https://digital.matomo.cloud/"
MATOMO_SITE_ID: 20
DOCKER_TAG: ${{ github.sha }}-test
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Create .env file
uses: noi-techpark/github-actions/env-file@v2
env:
X_COMPOSE_PROJECT_NAME: ${{ env.PROJECT_NAME }}
X_DOCKER_IMAGE_OTP: ${{ env.DOCKER_IMAGE_OTP }}
X_DOCKER_IMAGE_OTP_REACT: ${{ env.DOCKER_IMAGE_OTP_REACT }}
X_DOCKER_IMAGE_JOURNEY: ${{ env.DOCKER_IMAGE_JOURNEY }}
X_DOCKER_IMAGE_GBFS: ${{ env.DOCKER_IMAGE_GBFS }}
X_DOCKER_IMAGE_GEOCODER: ${{ env.DOCKER_IMAGE_GEOCODER }}
X_DOCKER_IMAGE_CARSHARING: ${{ env.DOCKER_IMAGE_CARSHARING }}
X_DOCKER_IMAGE_PARKING: ${{ env.DOCKER_IMAGE_PARKING }}
X_DOCKER_IMAGE_ECHARGING: ${{ env.DOCKER_IMAGE_ECHARGING }}
X_DOCKER_IMAGE_DRT: ${{ env.DOCKER_IMAGE_DRT }}
X_DOCKER_IMAGE_TRAFFIC: ${{ env.DOCKER_IMAGE_TRAFFIC }}
X_DOCKER_IMAGE_AMARILLO: ${{ env.DOCKER_IMAGE_AMARILLO }}
X_DOCKER_TAG: ${{ env.DOCKER_TAG }}
X_SERVER_PORT_OTP: 1080
X_SERVER_PORT_JOURNEY: 1081
X_SERVER_PORT_OTP_REACT: 1079
X_GBFS_HOST : "https://gbfs.otp.opendatahub.testingmachine.eu/"
X_DOCKER_GBFS_PORT: 1082
X_DOCKER_GEOCODER_PORT: 1083
X_DOCKER_CARSHARING_PORT: 1084
X_DOCKER_PARKING_PORT: 1085
X_DOCKER_DRT_PORT: 1086
X_DOCKER_ECHARGING_PORT: 1087
X_DOCKER_TRAFFIC_PORT: 1088
X_DOCKER_AMARILLO_PORT: 1092
X_JAVA_MX: "14G"
X_API_HOST: ${{ env.API_HOST }}
X_API_PORT: ${{ env.API_PORT }}
X_API_PATH: ${{ env.API_PATH }}
X_HERE_APPID: ${{ secrets.HERE_APPID_TEST }}
X_HERE_APPCODE: ${{ secrets.HERE_APPCODE_TEST }}
X_HERE_APIKEY: ${{ secrets.HERE_APIKEY_TEST }}
X_GEOCODER_BASEURL: ${{ env.GEOCODER_BASEURL }}
X_PARKING_BASEURL: ${{ env.PARKING_BASEURL }}
X_DRT_BASEURL: ${{ env.DRT_BASEURL }}
X_CHARGER_BASEURL: ${{ env.CHARGER_BASEURL }}
X_CARSHARING_BASEURL: ${{ env.CARSHARING_BASEURL }}
X_TRAFFIC_BASEURL: ${{ env.TRAFFIC_BASEURL }}
X_AMARILLO_BASEURL: ${{ env.AMARILLO_BASEURL }}
X_GBFS_VERSION: 1
X_CARSHARING_HOST: "https://carsharing.otp.opendatahub.testingmachine.eu/"
X_PARKING_HOST: "https://parking.otp.opendatahub.testingmachine.eu/"
X_DRT_HOST: "https://drt.otp.opendatahub.testingmachine.eu/"
X_CHARGER_HOST: "https://charger.otp.opendatahub.testingmachine.eu/"
X_ADMIN_TOKEN: ${{ secrets.AMARILLO_ADMIN_TOKEN }}
# disable in test
# X_MATOMO_BASE_URL: ${{ env.MATOMO_BASE_URL }}
# X_MATOMO_SITE_ID: ${{ env.MATOMO_SITE_ID }}
- name: use mobility.api.opendatahub.testingmachine.eu for testing
run: sed -i 's/mobility.api.opendatahub.com/mobility.api.opendatahub.testingmachine.eu/' */config.yml
# elevation data does not change so we cache it forever
- name: Cache elevation data
uses: actions/cache@v4
with:
path: |
data/srtm*
key: elevation
# OSM data changes every day, so we cache a monthly download and apply the daily updates to it
# ideally we also put the updated file back into the cache but Github CI doesn't allow you to
# do that without jumping through many hoops.
# Therefore, we take the version from the beginning of the month and apply more and more daily
# updates until the next month triggers a complete download.
- name: Set variable OSM_CACHE_VERSION
run: |
echo "OSM_CACHE_VERSION=$(date +%Y-%m)" >> $GITHUB_ENV
- name: Cache OSM extract
uses: actions/cache@v4
with:
path: |
data/italy-nord-est.osm.pbf
key: osm-${{ env.OSM_CACHE_VERSION }}
- name: Build graph
# the script uses error handling with +e, so please don't run it with bash prepended in this line
run: ./build-graph.sh
- name: Build and push
if: github.repository_owner == 'noi-techpark'
uses: noi-techpark/github-actions/docker-build-and-push@v2
with:
docker-username: ${{ github.actor }}
docker-password: ${{ secrets.GITHUB_TOKEN }}
docker-compose-file: docker-compose.build.yml
- name: Deploy application
if: github.repository_owner == 'noi-techpark'
uses: noi-techpark/github-actions/docker-deploy@v2
with:
hosts: 'test'
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
docker-username: 'noi-techpark-bot'
docker-password: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
project-name: ${{ env.PROJECT_NAME }}
# execute-prod:
# runs-on: ubuntu-22.04
# needs: test
# concurrency: deploy-prod
# env:
# API_HOST: "https://otp.opendatahub.com"
# API_PORT: "443"
# API_PATH: "/otp/routers/openmove"
# GEOCODER_BASEURL: "https://geocoder.otp.opendatahub.com"
# PARKING_BASEURL: "https://parking.otp.opendatahub.com"
# DRT_BASEURL: "https://drt.otp.opendatahub.com"
# CHARGER_BASEURL: "https://charger.otp.opendatahub.com"
# CARSHARING_BASEURL: "https://carsharing.otp.opendatahub.com"
# TRAFFIC_BASEURL: "https://traffic.otp.opendatahub.com"
# MATOMO_BASE_URL: "https://digital.matomo.cloud/"
# MATOMO_SITE_ID: 20
# DOCKER_TAG: ${{ github.sha }}-prod
# steps:
# - name: Checkout source code
# uses: actions/checkout@v2
# - name: Create .env file
# uses: noi-techpark/github-actions/env-file@v2
# env:
# X_COMPOSE_PROJECT_NAME: ${{ env.PROJECT_NAME }}
# X_DOCKER_IMAGE_OTP: ${{ env.DOCKER_IMAGE_OTP }}
# X_DOCKER_IMAGE_JOURNEY: ${{ env.DOCKER_IMAGE_JOURNEY }}
# X_DOCKER_IMAGE_GBFS: ${{ env.DOCKER_IMAGE_GBFS }}
# X_DOCKER_IMAGE_GEOCODER: ${{ env.DOCKER_IMAGE_GEOCODER }}
# X_DOCKER_IMAGE_CARSHARING: ${{ env.DOCKER_IMAGE_CARSHARING }}
# X_DOCKER_IMAGE_PARKING: ${{ env.DOCKER_IMAGE_PARKING }}
# X_DOCKER_IMAGE_ECHARGING: ${{ env.DOCKER_IMAGE_ECHARGING }}
# X_DOCKER_IMAGE_DRT: ${{ env.DOCKER_IMAGE_DRT }}
# X_DOCKER_IMAGE_TRAFFIC: ${{ env.DOCKER_IMAGE_TRAFFIC }}
# X_DOCKER_TAG: ${{ env.DOCKER_TAG }}
# X_EFS_FOLDER: "/opt/odh-mentor-otp-prod/"
# X_SERVER_PORT_OTP: 1080
# X_SERVER_PORT_JOURNEY: 1081
# X_GBFS_HOST : "https://gbfs.otp.opendatahub.com/"
# X_DOCKER_GBFS_PORT: 1082
# X_DOCKER_GEOCODER_PORT: 1083
# X_DOCKER_CARSHARING_PORT: 1084
# X_DOCKER_PARKING_PORT: 1085
# X_DOCKER_DRT_PORT: 1086
# X_DOCKER_ECHARGING_PORT: 1087
# X_DOCKER_TRAFFIC_PORT: 1088
# X_JAVA_MX: "16G"
# X_BUILD_GRAPH: "False"
# X_DOWNLOAD_DATA: "False"
# X_BACKUP_GRAPH: "False"
# X_OTP_RR_BRANCH: "mentor-meran"
# X_OTP_UI_BRANCH: "master"
# X_API_HOST: ${{ env.API_HOST }}
# X_API_PORT: ${{ env.API_PORT }}
# X_API_PATH: ${{ env.API_PATH }}
# X_HERE_APPID: ${{ secrets.HERE_APPID_TEST }}
# X_HERE_APPCODE: ${{ secrets.HERE_APPCODE_TEST }}
# X_HERE_APIKEY: ${{ secrets.HERE_APIKEY_TEST }}
# X_GEOCODER_BASEURL: ${{ env.GEOCODER_BASEURL }}
# X_PARKING_BASEURL: ${{ env.PARKING_BASEURL }}
# X_DRT_BASEURL: ${{ env.DRT_BASEURL }}
# X_CHARGER_BASEURL: ${{ env.CHARGER_BASEURL }}
# X_CARSHARING_BASEURL: ${{ env.CARSHARING_BASEURL }}
# X_TRAFFIC_BASEURL: ${{ env.TRAFFIC_BASEURL }}
# X_OTP_OFFICIAL: "False"
# X_GBFS_VERSION: 1
# X_CARSHARING_HOST: "https://carsharing.otp.opendatahub.com/"
# X_PARKING_HOST: "https://parking.otp.opendatahub.com/"
# X_DRT_HOST: "https://drt.otp.opendatahub.com/"
# X_CHARGER_HOST: "https://charger.otp.opendatahub.com/"
# X_GTFS_URL: "ftp://ftp.sta.bz.it/gtfs/google_transit_shp.zip"
# X_GTFS_URL_UPDATETIME: "0 4 * * *"
# X_GTFS_WORKFLOW_AUTH_TOKEN: ${{ secrets.GH_WORKFLOW_ACCESS_TOKEN }}
# X_GTFS_WORKFLOW_DISPATCH_URL: "https://api.github.com/repos/noi-techpark/odh-mentor-otp/actions/workflows/run_calculate.yml/dispatches"
# X_GTFS_WORKFLOW_BRANCH: ${{ github.ref }}
# X_GTFS_RT_URL: "https://efa.sta.bz.it/gtfs-r/"
# X_GTFS_FEED_ID: 1
# X_MATOMO_BASE_URL: "https://digital.matomo.cloud/"
# X_MATOMO_SITE_ID: 20
# - name: Build graph
# run: sh build-graph.sh
# - name: Build and push
# uses: noi-techpark/github-actions/docker-build-and-push@v2
# with:
# docker-username: ${{ github.actor }}
# docker-password: ${{ secrets.GITHUB_TOKEN }}
# docker-compose-file: docker-compose.build.execute.yml
# - name: Deploy application
# uses: noi-techpark/github-actions/docker-deploy@v2
# with:
# hosts: 'prod'
# ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
# docker-username: 'noi-techpark-bot'
# docker-password: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
# project-name: ${{ env.PROJECT_NAME }}
# playbook-file: deploy.execute.yml