From 870a493080bfb692c0202c9b0e66529a512fb0c5 Mon Sep 17 00:00:00 2001 From: Siarhei Fedartsou Date: Fri, 19 Aug 2022 12:32:55 +0200 Subject: [PATCH] Add smoke test for Docker image (#6313) * Add smoke test for Docker image --- .github/workflows/osrm-backend.yml | 28 +++++++++++++++++++++++++--- CHANGELOG.md | 1 + CMakeLists.txt | 1 + 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/.github/workflows/osrm-backend.yml b/.github/workflows/osrm-backend.yml index c1102484fb1..c5a36712659 100644 --- a/.github/workflows/osrm-backend.yml +++ b/.github/workflows/osrm-backend.yml @@ -55,9 +55,31 @@ jobs: steps: - name: Check out the repo uses: actions/checkout@v3 + - name: Enable osm.pbf cache + uses: actions/cache@v2 + with: + path: berlin-latest.osm.pbf + key: v1-berlin-osm-pbf + restore-keys: | + v1-berlin-osm-pbf - name: Docker build run: | - docker build -f docker/Dockerfile . + docker build -t osrm-backend-local -f docker/Dockerfile . + - name: Test Docker image + run: | + if [ ! -f "${PWD}/berlin-latest.osm.pbf" ]; then + wget http://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf + fi + TAG=osrm-backend-local + # when `--memory-swap` value equals `--memory` it means container won't use swap + # see https://docs.docker.com/config/containers/resource_constraints/#--memory-swap-details + MEMORY_ARGS="--memory=1g --memory-swap=1g" + docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-extract -p /opt/car.lua /data/berlin-latest.osm.pbf + docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-partition /data/berlin-latest.osrm + docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-customize /data/berlin-latest.osrm + docker run $MEMORY_ARGS --name=osrm-container -t -p 5000:5000 -v "${PWD}:/data" "${TAG}" osrm-routed --algorithm mld /data/berlin-latest.osrm & + curl --retry-delay 3 --retry 10 --retry-all-errors "http://127.0.0.1:5000/route/v1/driving/13.388860,52.517037;13.385983,52.496891?steps=true" + docker stop osrm-container build-test-publish: needs: format-taginfo-docs @@ -422,9 +444,9 @@ jobs: uses: actions/cache@v2 with: path: ~/.conan - key: conan-${{ matrix.name }}-${{ github.sha }} + key: v2-conan-${{ matrix.name }}-${{ github.sha }} restore-keys: | - conan-${{ matrix.name }}- + v2-conan-${{ matrix.name }}- - name: Enable test cache uses: actions/cache@v2 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index f3f0c15abbe..8a2b8508aa2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - FIXED: Fix bug with reading Set values from Lua scripts. [#6285](https://github.com/Project-OSRM/osrm-backend/pull/6285) - FIXED: Bug in bicycle profile that caused exceptions if there is a highway=bicycle in the data. [#6296](https://github.com/Project-OSRM/osrm-backend/pull/6296) - Build: + - ADDED: Add smoke test for Docker image. [#6313](https://github.com/Project-OSRM/osrm-backend/pull/6313) - CHANGED: Update libosmium to version 2.18.0. [#6303](https://github.com/Project-OSRM/osrm-backend/pull/6303) - CHANGED: Remove EXACT from find_package if using Conan. [#6299](https://github.com/Project-OSRM/osrm-backend/pull/6299) - CHANGED: Configure Undefined Behaviour Sanitizer. [#6290](https://github.com/Project-OSRM/osrm-backend/pull/6290) diff --git a/CMakeLists.txt b/CMakeLists.txt index 32c7a5735c5..f611794fa87 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -474,6 +474,7 @@ if(ENABLE_CONAN) GENERATORS cmake_find_package KEEP_RPATHS NO_OUTPUT_DIRS + OPTIONS boost:filesystem_version=3 # https://stackoverflow.com/questions/73392648/error-with-boost-filesystem-version-in-cmake ) add_dependency_includes(${CONAN_INCLUDE_DIRS_BOOST})