Skip to content

nightly CI/CD

nightly CI/CD #417

Workflow file for this run

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_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_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_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
- name: Cache OSM and elevation data
uses: actions/cache@v4
with:
path: |
data/srtm*
key: elevation
- name: Build graph
run: bash 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