From 2066b7a1ca1ecd39870f6473899f53e21e6be4c0 Mon Sep 17 00:00:00 2001 From: Julian Psotta Date: Tue, 30 Jan 2024 11:30:27 +0100 Subject: [PATCH 1/2] feat(config): Add workflow for the automatic config conversion The workflow is triggered on PRs for main and releases/** branches if the PR is set for review or synchronized. --- ...config_rewrite.sh => config_conversion.sh} | 0 .../config-conversion-automation.yml | 56 +++++++++++++++++++ 2 files changed, 56 insertions(+) rename .github/utils/{config_rewrite.sh => config_conversion.sh} (100%) create mode 100644 .github/workflows/config-conversion-automation.yml diff --git a/.github/utils/config_rewrite.sh b/.github/utils/config_conversion.sh similarity index 100% rename from .github/utils/config_rewrite.sh rename to .github/utils/config_conversion.sh diff --git a/.github/workflows/config-conversion-automation.yml b/.github/workflows/config-conversion-automation.yml new file mode 100644 index 0000000000..2b8abb765d --- /dev/null +++ b/.github/workflows/config-conversion-automation.yml @@ -0,0 +1,56 @@ +name: Automatic conversion of application.yml to ors-config.yml +on: + pull_request: + branches: + - main + - releases/** + types: [ edited, opened, ready_for_review, review_requested, reopened, synchronize ] + workflow_dispatch: + + +jobs: + detect_config_change: + name: Detect and commit config changes + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + - name: Check PR state is ready_for_review + run: | + if [ "${{ github.event_name }}" == "pull_request" ]; then + pr_state=$(gh pr view --json state --jq .state) + pr_is_draft=$(gh pr view --json isDraft --jq .isDraft) + echo "pr_state=$pr_state" >> $GITHUB_ENV + echo "pr_is_draft=$pr_is_draft" >> $GITHUB_ENV + else + echo "This action is only intended to be run on pull requests." + exit 1 + fi + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Convert application.yml to ors-config.yml + run: | + .github/utils/config_conversion.sh ors-api/src/main/resources/application.yml ors-api/ors-config.yml + - name: Check with git if ors-api/ors-config.yml has changed + id: git-check + if: env.pr_state == 'OPEN' && env.pr_is_draft == 'false' + run: | + # Don't fail on exit code 1 (diff found) + set +e + git diff --exit-code --name-only ors-api/ors-config.yml + exit_value=$? + echo Found exit code $exit_value + # Write out the exit code using environment file + if [ $exit_value == 1 ]; then + echo "config_has_changed=true" >> $GITHUB_ENV + else + echo "Config hasn't changed. Skipping commit." + fi + - uses: MichaelsJP/git-auto-commit-action@v5 + if: env.pr_state == 'OPEN' && env.pr_is_draft == 'false' && env.config_has_changed == 'true' + with: + commit_message: 'chore(config): automatic conversion of application.yml to ors-config.yml' From ed4358a3361184144123dcd8948caac8340f66d7 Mon Sep 17 00:00:00 2001 From: MichaelsJP Date: Tue, 30 Jan 2024 11:57:34 +0000 Subject: [PATCH 2/2] chore(config): automatic conversion of application.yml to ors-config.yml --- ors-api/ors-config.yml | 325 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 308 insertions(+), 17 deletions(-) diff --git a/ors-api/ors-config.yml b/ors-api/ors-config.yml index b26920429d..f71d2601ac 100644 --- a/ors-api/ors-config.yml +++ b/ors-api/ors-config.yml @@ -1,32 +1,323 @@ ##### openrouteservice settings file ##### # This file contains parameters for openrouteservice. -# For a full list of possible parameters see https://giscience.github.io/openrouteservice/, below are some examples. -### uncomment the following line to turn on debug output -#logging.level.org.heigit: DEBUG +##### General server settings ##### +#server: +# port: 8082 +# error: +# whitelabel: +# enabled: false + # Keep the context-path at / else the war file run with tomcat will have the context-path of /ors/v2 as well. +# servlet: +# context-path: /ors +#spring: +# profiles: +# active: default +# mvc: +# servlet: +# path: / + +##### Settings related to springdoc ##### +#springdoc: +# swagger-ui: +# enabled: true +# path: /swagger-ui +# tryItOutEnabled: true +# filter: false +# syntaxHighlight: +# activated: true +# showExtensions: true +# api-docs: +# path: /v2/api-docs +# version: OPENAPI_3_0 +# packages-to-scan: org.heigit.ors +# pathsToMatch: /v2/** + +##### Logging settings ##### +#logging: +# level: +# root: WARN +# org.heigit: INFO + +##### openrouteservice specific settings ##### ors: - ### uncomment the following lines to change CORS settings. # cors: # allowed_origins: "*" # allowed_headers: Content-Type, X-Requested-With, accept, Origin, Access-Control-Request-Method, Access-Control-Request-Headers, Authorization # preflight_max_age: 600 - engine: - ### use the following line to enable mmap mode -# graphs_data_access: MMAP +# messages: - ### use the following lines for development setup using test OSM file for Heidelberg -# source_file: ./ors-api/src/test/files/heidelberg.osm.gz -# elevation: -# cache_path: ./ors-api/src/test/files/elevation - ### instead of the following 3 lines: - source_file: ./ors-core/data/osm_file.pbf - elevation: - cache_path: ./ors-core/data/elevation_cache + ##### ORS endpoints settings ##### +# endpoints: +# routing: +# enabled: true +# attribution: openrouteservice.org, OpenStreetMap contributors, tmc - BASt +# gpx_name: ORSRouting +# gpx_description: This is a directions instructions file as GPX, generated from openrouteservice +# gpx_base_url: https://openrouteservice.org/ +# gpx_support_mail: support@openrouteservice.org +# gpx_author: openrouteservice +# gpx_content_licence: LGPL 3.0 +# maximum_avoid_polygon_area: 200000000 +# maximum_avoid_polygon_extent: 20000 +# maximum_alternative_routes: 3 +# matrix: +# enabled: true +# attribution: openrouteservice.org, OpenStreetMap contributors +# maximum_routes: 2500 +# maximum_routes_flexible: 25 +# maximum_visited_nodes: 100000 +# maximum_search_radius: 2000 +# u_turn_costs: -1 +# isochrone: +# enabled: true +# attribution: openrouteservice.org, OpenStreetMap contributors +# maximum_locations: 2 +# maximum_intervals: 1 +# allow_compute_area: true +# maximum_range_distance_default: 50000 +# maximum_range_distance: +# - profiles: driving-car, driving-hgv +# value: 100000 +# maximum_range_time_default: 18000 +# maximum_range_time: +# - profiles: driving-car, driving-hgv +# value: 3600 +# fastisochrones: +# maximum_range_distance_default: 50000 +# maximum_range_distance: +# - profiles: driving-car, driving-hgv +# value: 500000 +# maximum_range_time_default: 18000 +# maximum_range_time: +# - profiles: driving-car, driving-hgv +# value: 10800 +# Snap: +# enabled: true +# attribution: openrouteservice.org, OpenStreetMap contributors + ##### ORS engine settings ##### + engine: +# init_threads: 1 +# preparation_mode: false + source_file: "YOUR_FILE" +# graphs_root_path: ./graphs +# graphs_data_access: RAM_STORE +# elevation: +# preprocessed: false +# data_access: MMAP +# cache_clear: false +# provider: multi +# cache_path: ./elevation_cache + profile_default: + enabled: false +# elevation: false +# elevation_smoothing: false +# encoder_flags_size: 8 +# instructions: true +# optimize: false +# traffic: false +# maximum_distance: 100000 +# maximum_distance_dynamic_weights: 100000 +# maximum_distance_avoid_areas: 100000 +# maximum_waypoints: 50 +# maximum_snapping_radius: 400 +# maximum_distance_alternative_routes: 100000 +# maximum_distance_round_trip_routes: 100000 +# maximum_speed_lower_bound: 80 +# maximum_visited_nodes: 1000000 +# location_index_resolution: 500 +# location_index_search_iterations: 4 +# force_turn_costs: false +# interpolate_bridges_and_tunnels: true +# preparation: +# min_network_size: 200 +# min_one_way_network_size: 200 +# methods: +# lm: +# enabled: true +# threads: 1 +# weightings: recommended,shortest +# landmarks: 16 +# execution: +# methods: +# lm: +# disabling_allowed: true +# active_landmarks: 8 profiles: car: - enabled: true + enabled: false +# profile: driving-car +# elevation: true +# encoder_options: +# turn_costs: true +# block_fords: false +# use_acceleration: true +# preparation: +# min_network_size: 200 +# min_one_way_network_size: 200 +# methods: +# ch: +# enabled: true +# threads: 1 +# weightings: fastest +# lm: +# enabled: false +# threads: 1 +# weightings: fastest,shortest +# landmarks: 16 +# core: +# enabled: true +# threads: 1 +# weightings: fastest,shortest +# landmarks: 64 +# lmsets: highways;allow_all +# execution: +# methods: +# ch: +# disabling_allowed: true +# lm: +# disabling_allowed: true +# active_landmarks: 6 +# core: +# disabling_allowed: true +# active_landmarks: 6 +# ext_storages: +# WayCategory: +# HeavyVehicle: +# WaySurfaceType: +# RoadAccessRestrictions: +# use_for_warnings: true hgv: - enabled: true \ No newline at end of file + enabled: false +# profile: driving-hgv +# encoder_flags_size: 8 +# encoder_options: +# turn_costs: true +# block_fords: false +# use_acceleration: true +# maximum_distance: 100000 +# elevation: true +# preparation: +# min_network_size: 200 +# min_one_way_network_size: 200 +# methods: +# ch: +# enabled: true +# threads: 1 +# weightings: recommended +# core: +# enabled: true +# threads: 1 +# weightings: recommended,shortest +# landmarks: 64 +# lmsets: highways;allow_all +# execution: +# methods: +# ch: +# disabling_allowed: true +# core: +# disabling_allowed: true +# active_landmarks: 6 +# ext_storages: +# WayCategory: +# HeavyVehicle: +# restrictions: true +# WaySurfaceType: + bike-regular: + enabled: false +# profile: cycling-regular +# encoder_options: +# consider_elevation: true +# turn_costs: true +# block_fords: false +# elevation: true +# ext_storages: +# WayCategory: +# WaySurfaceType: +# HillIndex: +# TrailDifficulty: + bike-mountain: + enabled: false +# profile: cycling-mountain +# encoder_options: +# consider_elevation: true +# turn_costs: true +# block_fords: false +# elevation: true +# ext_storages: +# WayCategory: +# WaySurfaceType: +# HillIndex: +# TrailDifficulty: + bike-road: + enabled: false +# profile: cycling-road +# encoder_options: +# consider_elevation: true +# turn_costs: true +# block_fords: false +# elevation: true +# ext_storages: +# WayCategory: +# WaySurfaceType: +# HillIndex: +# TrailDifficulty: + bike-electric: + enabled: false +# profile: cycling-electric +# encoder_options: +# consider_elevation: true +# turn_costs: true +# block_fords: false +# elevation: true +# ext_storages: +# WayCategory: +# WaySurfaceType: +# HillIndex: +# TrailDifficulty: + walking: + enabled: false +# profile: foot-walking +# encoder_options: +# block_fords: false +# elevation: true +# ext_storages: +# WayCategory: +# WaySurfaceType: +# HillIndex: +# TrailDifficulty: + hiking: + enabled: false +# profile: foot-hiking +# encoder_options: +# block_fords: false +# elevation: true +# ext_storages: +# WayCategory: +# WaySurfaceType: +# HillIndex: +# TrailDifficulty: +# wheelchair: +# enabled: false +# profile: wheelchair +# encoder_options: +# block_fords: true +# elevation: true +# maximum_snapping_radius: 50 +# ext_storages: +# WayCategory: +# WaySurfaceType: +# Wheelchair: +# KerbsOnCrossings: true +# OsmId: + public-transport: + enabled: false +# profile: public-transport +# encoder_options: +# block_fords: false +# elevation: true +# maximum_visited_nodes: 1000000 +# gtfs_file: ./src/test/files/vrn_gtfs_cut.zip