From dca35dcc8676df6fa93f491a7b157136918173d5 Mon Sep 17 00:00:00 2001 From: ijleesw Date: Fri, 12 Mar 2021 15:01:30 +0900 Subject: [PATCH 01/13] Add support for lua5.4 in FindLua.cmake --- cmake/FindLua.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/FindLua.cmake b/cmake/FindLua.cmake index 2b732ca21..237dca8e6 100644 --- a/cmake/FindLua.cmake +++ b/cmake/FindLua.cmake @@ -44,7 +44,7 @@ unset(_lua_append_versions) # this is a function only to have all the variables inside go away automatically function(_lua_set_version_vars) - set(LUA_VERSIONS5 5.3 5.2 5.1 5.0) + set(LUA_VERSIONS5 5.4 5.3 5.2 5.1 5.0) if (Lua_FIND_VERSION_EXACT) if (Lua_FIND_VERSION_COUNT GREATER 1) From 38df7d5e05ddecbb9e4f40acbcc0df06e7bd0a59 Mon Sep 17 00:00:00 2001 From: Patrick Niklaus Date: Tue, 27 Jul 2021 15:55:38 +0200 Subject: [PATCH 02/13] Fix the URL parser for special chars in profile --- src/server/api/url_parser.cpp | 12 ++++++------ unit_tests/server/url_parser.cpp | 12 +++++++++++- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/server/api/url_parser.cpp b/src/server/api/url_parser.cpp index b5da6fcce..68ce3e58d 100644 --- a/src/server/api/url_parser.cpp +++ b/src/server/api/url_parser.cpp @@ -26,15 +26,15 @@ struct URLParser final : qi::grammar { using boost::spirit::repository::qi::iter_pos; - alpha_numeral = qi::char_("a-zA-Z0-9"); + identifier = qi::char_("a-zA-Z0-9_..--~:"); percent_encoding = qi::char_('%') > qi::uint_parser()[qi::_val = qi::_1]; - polyline_chars = qi::char_("a-zA-Z0-9_.--[]{}@?|\\~`^") | percent_encoding; - all_chars = polyline_chars | qi::char_("=,;:&()."); + polyline_chars = qi::char_("a-zA-Z0-9_..--[]{}@?|\\~`^") | percent_encoding; + all_chars = polyline_chars | qi::char_("=,;:&().."); - service = +alpha_numeral; + service = +identifier; version = qi::uint_; - profile = +alpha_numeral; + profile = +identifier; query = +all_chars; // Example input: /route/v1/driving/7.416351,43.731205;7.420363,43.736189 @@ -54,7 +54,7 @@ struct URLParser final : qi::grammar qi::rule profile; qi::rule query; - qi::rule alpha_numeral; + qi::rule identifier; qi::rule all_chars; qi::rule polyline_chars; qi::rule percent_encoding; diff --git a/unit_tests/server/url_parser.cpp b/unit_tests/server/url_parser.cpp index 58f6f6496..98f050410 100644 --- a/unit_tests/server/url_parser.cpp +++ b/unit_tests/server/url_parser.cpp @@ -44,7 +44,7 @@ BOOST_AUTO_TEST_CASE(invalid_urls) BOOST_CHECK_EQUAL(testInvalidURL("/route/"), 7UL); BOOST_CHECK_EQUAL(testInvalidURL("/route/bla"), 7UL); BOOST_CHECK_EQUAL(testInvalidURL("/route/1/1,2;3;4"), 7UL); - BOOST_CHECK_EQUAL(testInvalidURL("/route/v1/pro_file/1,2;3,4"), 13UL); + BOOST_CHECK_EQUAL(testInvalidURL("/route/v1/pro[]file/1,2;3,4"), 13UL); BOOST_CHECK_EQUAL(testInvalidURL("/route/v1/profile"), 17UL); BOOST_CHECK_EQUAL(testInvalidURL("/route/v1/profile/"), 18UL); } @@ -124,6 +124,16 @@ BOOST_AUTO_TEST_CASE(valid_urls) BOOST_CHECK_EQUAL(reference_8.profile, result_8->profile); CHECK_EQUAL_RANGE(reference_8.query, result_8->query); BOOST_CHECK_EQUAL(reference_8.prefix_length, result_8->prefix_length); + + // profile with special characters + api::ParsedURL reference_9{"route", 1, "foo-bar_baz.profile", "0,1;2,3;4,5?options=value&foo=bar", 30UL}; + auto result_9 = api::parseURL("/route/v1/foo-bar_baz.profile/0,1;2,3;4,5?options=value&foo=bar"); + BOOST_CHECK(result_9); + BOOST_CHECK_EQUAL(reference_9.service, result_9->service); + BOOST_CHECK_EQUAL(reference_9.version, result_9->version); + BOOST_CHECK_EQUAL(reference_9.profile, result_9->profile); + CHECK_EQUAL_RANGE(reference_9.query, result_9->query); + BOOST_CHECK_EQUAL(reference_9.prefix_length, result_9->prefix_length); } BOOST_AUTO_TEST_SUITE_END() From ba4e7bfa111211a5170f8aa2c39b2d46e0b5d811 Mon Sep 17 00:00:00 2001 From: Patrick Niklaus Date: Tue, 27 Jul 2021 16:00:08 +0200 Subject: [PATCH 03/13] Add changelog entry --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bfa3c5dd5..83de3abf9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,7 @@ # Unreleased + - Changes from 5.25.0 + - API: + - FIXED: Allow for special characters in the profile/method as part of the HTTP URL. # 5.25.0 - Changes from 5.24.0 From 03001ff90a30df703a9890cac5ed9b2d2fb0c5c0 Mon Sep 17 00:00:00 2001 From: Patrick Niklaus Date: Fri, 27 Aug 2021 12:36:37 +0200 Subject: [PATCH 04/13] Fix ranges --- src/server/api/url_parser.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server/api/url_parser.cpp b/src/server/api/url_parser.cpp index 68ce3e58d..99435b9e5 100644 --- a/src/server/api/url_parser.cpp +++ b/src/server/api/url_parser.cpp @@ -26,10 +26,10 @@ struct URLParser final : qi::grammar { using boost::spirit::repository::qi::iter_pos; - identifier = qi::char_("a-zA-Z0-9_..--~:"); + identifier = qi::char_("a-zA-Z0-9_.~:-"); percent_encoding = qi::char_('%') > qi::uint_parser()[qi::_val = qi::_1]; - polyline_chars = qi::char_("a-zA-Z0-9_..--[]{}@?|\\~`^") | percent_encoding; + polyline_chars = qi::char_("a-zA-Z0-9_[]{}@?|\\~`^") | percent_encoding; all_chars = polyline_chars | qi::char_("=,;:&().."); service = +identifier; From 155ca8b1f1016091bd11c200531ac4ff443bfb63 Mon Sep 17 00:00:00 2001 From: Patrick Niklaus Date: Wed, 1 Sep 2021 13:14:21 +0200 Subject: [PATCH 05/13] Update src/server/api/url_parser.cpp Co-authored-by: Michael Bell --- src/server/api/url_parser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/api/url_parser.cpp b/src/server/api/url_parser.cpp index 99435b9e5..1a10f66c3 100644 --- a/src/server/api/url_parser.cpp +++ b/src/server/api/url_parser.cpp @@ -30,7 +30,7 @@ struct URLParser final : qi::grammar percent_encoding = qi::char_('%') > qi::uint_parser()[qi::_val = qi::_1]; polyline_chars = qi::char_("a-zA-Z0-9_[]{}@?|\\~`^") | percent_encoding; - all_chars = polyline_chars | qi::char_("=,;:&().."); + all_chars = polyline_chars | qi::char_("=,;:&().-"); service = +identifier; version = qi::uint_; From 8af4f700f75a76b2dacd52a7a8a3eb7915054a08 Mon Sep 17 00:00:00 2001 From: Mateusz Konieczny Date: Thu, 24 Jun 2021 20:48:32 +0200 Subject: [PATCH 06/13] fix link in the changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 83de3abf9..7a08ea1a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -120,7 +120,7 @@ ](https://github.com/Project-OSRM/osrm-backend/pull/5076/) - CHANGED: Foot profile now blacklists barriers instead of whitelisting them [#5077 ](https://github.com/Project-OSRM/osrm-backend/pull/5077/) - - CHANGED: Support maxlength and maxweight in car profile [#5101](https://github.com/Project-OSRM/osrm-backend/pull/5101] + - CHANGED: Support maxlength and maxweight in car profile [#5101](https://github.com/Project-OSRM/osrm-backend/pull/5101) - Bugfixes: - FIXED: collapsing of ExitRoundabout instructions [#5114](https://github.com/Project-OSRM/osrm-backend/issues/5114) - Misc: From eb0c089574b7bafac28b789339c3f162c753a9ab Mon Sep 17 00:00:00 2001 From: Michael Bell Date: Thu, 24 Jun 2021 18:59:15 +0100 Subject: [PATCH 07/13] Replace Travis with Github Actions for CI builds Replace Travis for continuous integration with Github Actions. The Github Actions pipeline is functionally equivalent, with all the same build permutations supported. Whilst the Github Actions offering is broadly equivalent to Travis, a few changes have been made as part of the migration. - The 'core' and 'optional' Travis stages have been consolidated into one build matrix. This is due to the current inability in Github Actions to share build steps between jobs, so this avoids having to duplicate the steps. Optional stage jobs will now run in parallel with core jobs, but they still remain optional in the sense that they don't fail the build. - A number of existing Github Action plugins are used to replace functionality provided by Travis or other tools: Node setup, caching, Codecov, publishing release artifacts. - Linux builds are updated to build on Ubuntu 18.04. MacOS builds are updated to run on 10.15. Similar to the Travis Xenial upgrade attempt, some changes are required due to underlying platform and compiler upgrades. This means some Node 10 toolchains will no longer be supported. Whilst there is opportunity to upgrade some dependencies and make the CI steps more idiomatic, I've left this for future changes and just focussed on functional replication. --- .github/workflows/osrm-backend.yml | 588 ++++++++++++++++++ .travis.yml | 585 ----------------- CHANGELOG.md | 2 + CMakeLists.txt | 4 +- .../{travis => ci}/before_install.armhf.sh | 0 scripts/{travis => ci}/before_install.i686.sh | 0 .../before_install.x86_64-asan.sh | 0 scripts/{travis => ci}/is_pr_merge.sh | 0 scripts/{travis => ci}/leaksanitizer.conf | 0 scripts/{travis => ci}/node_package.sh | 0 scripts/{travis => ci}/travis_helper.sh | 0 .../maneuver_override_relation_parser.cpp | 6 - src/extractor/restriction_parser.cpp | 17 +- unit_tests/library/json.cpp | 5 +- unit_tests/library/match.cpp | 2 +- unit_tests/library/nearest.cpp | 2 +- unit_tests/library/route.cpp | 10 +- unit_tests/library/table.cpp | 4 +- unit_tests/library/trip.cpp | 2 +- 19 files changed, 612 insertions(+), 615 deletions(-) create mode 100644 .github/workflows/osrm-backend.yml delete mode 100644 .travis.yml rename scripts/{travis => ci}/before_install.armhf.sh (100%) rename scripts/{travis => ci}/before_install.i686.sh (100%) rename scripts/{travis => ci}/before_install.x86_64-asan.sh (100%) rename scripts/{travis => ci}/is_pr_merge.sh (100%) rename scripts/{travis => ci}/leaksanitizer.conf (100%) rename scripts/{travis => ci}/node_package.sh (100%) rename scripts/{travis => ci}/travis_helper.sh (100%) diff --git a/.github/workflows/osrm-backend.yml b/.github/workflows/osrm-backend.yml new file mode 100644 index 000000000..41793473f --- /dev/null +++ b/.github/workflows/osrm-backend.yml @@ -0,0 +1,588 @@ +name: osrm-backend CI +on: + push: + branches: + - master + tags: + - v[1-9]+.[0-9]+.[0-9]+ + - v[1-9]+.[0-9]+.[0-9]+-[0-9a-zA-Z]+ + - v[1-9]+.[0-9]+-[0-9a-zA-Z]+ + pull_request: + branches: + - master + +env: + CCACHE_TEMPDIR: /tmp/.ccache-temp + CCACHE_COMPRESS: 1 + CASHER_TIME_OUT: 599 # one second less than 10m to avoid 10m timeout error: https://github.com/Project-OSRM/osrm-backend/issues/2742 + CCACHE_VERSION: 3.3.1 + CMAKE_VERSION: 3.7.2 + ENABLE_NODE_BINDINGS: "ON" + +jobs: + format-taginfo-docs: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - name: Use Node.js + uses: actions/setup-node@v2 + with: + node-version: 10 + - name: Enable Node.js cache + uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + - name: Prepare environment + run: | + npm ci --ignore-scripts + export MASON=${GITHUB_WORKSPACE}/scripts/mason.sh + ${MASON} install clang-format 10.0.0 + echo "$(${MASON} prefix clang-format 10.0.0)/bin" >> $GITHUB_PATH + - name: Run checks + run: | + ./scripts/check_taginfo.py taginfo.json profiles/car.lua + ./scripts/format.sh && ./scripts/error_on_dirty.sh + node ./scripts/validate_changelog.js + # See issue 4043 + #- npm run docs && ./scripts/error_on_dirty.sh + + build-test-publish: + needs: format-taginfo-docs + strategy: + matrix: + include: + - name: gcc-7-debug-cov + continue-on-error: false + node: 10 + runs-on: ubuntu-18.04 + BUILD_TOOLS: ON + BUILD_TYPE: Debug + CCOMPILER: gcc-7 + CUCUMBER_TIMEOUT: 20000 + CXXCOMPILER: g++-7 + ENABLE_COVERAGE: ON + + - name: gcc-7-debug-asan + continue-on-error: false + node: 10 + runs-on: ubuntu-18.04 + BUILD_TOOLS: ON + BUILD_TYPE: Debug + CCOMPILER: gcc-7 + CUCUMBER_TIMEOUT: 20000 + CXXCOMPILER: g++-7 + ENABLE_SANITIZER: ON + TARGET_ARCH: x86_64-asan + + - name: clang-5.0-debug + continue-on-error: false + node: 10 + runs-on: ubuntu-18.04 + BUILD_TOOLS: ON + BUILD_TYPE: Debug + CLANG_VERSION: 5.0.0 + CUCUMBER_TIMEOUT: 60000 + + - name: mason-linux-debug-asan + continue-on-error: false + node: 10 + runs-on: ubuntu-18.04 + BUILD_TOOLS: ON + BUILD_TYPE: Release + CLANG_VERSION: 5.0.0 + ENABLE_MASON: ON + ENABLE_SANITIZER: ON + + - name: mason-linux-release + continue-on-error: false + node: 10 + runs-on: ubuntu-18.04 + BUILD_TOOLS: ON + BUILD_TYPE: Release + CLANG_VERSION: 5.0.0 + ENABLE_MASON: ON + + - name: gcc-9-release + continue-on-error: false + node: 10 + runs-on: ubuntu-18.04 + BUILD_TOOLS: ON + BUILD_TYPE: Release + CCOMPILER: gcc-9 + CXXCOMPILER: g++-9 + CXXFLAGS: -Wno-cast-function-type + + - name: gcc-8-release + continue-on-error: false + node: 10 + runs-on: ubuntu-18.04 + BUILD_TOOLS: ON + BUILD_TYPE: Release + CCOMPILER: gcc-8 + CXXCOMPILER: g++-8 + CXXFLAGS: -Wno-cast-function-type + + - name: gcc-7-release + continue-on-error: false + node: 10 + runs-on: ubuntu-18.04 + BUILD_TOOLS: ON + BUILD_TYPE: Release + CCOMPILER: gcc-7 + CXXCOMPILER: g++-7 + + - name: gcc-7-release-i686 + continue-on-error: false + node: 10 + runs-on: ubuntu-18.04 + BUILD_TOOLS: ON + BUILD_TYPE: Release + CCOMPILER: gcc-7 + CFLAGS: "-m32 -msse2 -mfpmath=sse" + CXXCOMPILER: g++-7 + CXXFLAGS: "-m32 -msse2 -mfpmath=sse" + TARGET_ARCH: i686 + + - name: gcc-5-release + continue-on-error: false + node: 10 + runs-on: ubuntu-18.04 + BUILD_TOOLS: ON + BUILD_TYPE: Release + CCOMPILER: gcc-5 + CXXCOMPILER: g++-5 + + - name: gcc-6-release + continue-on-error: false + node: 10 + runs-on: ubuntu-18.04 + BUILD_TOOLS: ON + BUILD_TYPE: Release + CCOMPILER: gcc-6 + CXXCOMPILER: g++-6 + + - name: mason-osx-release-node-10 + build_node_package: true + continue-on-error: false + node: 10 + runs-on: macos-10.15 + BUILD_TOOLS: ON + BUILD_TYPE: Release + CCOMPILER: clang + CXXCOMPILER: clang++ + CUCUMBER_TIMEOUT: 60000 + ENABLE_ASSERTIONS: ON + ENABLE_MASON: ON + + - name: mason-osx-release-node-12 + build_node_package: true + continue-on-error: false + node: 12 + runs-on: macos-10.15 + BUILD_TOOLS: ON + BUILD_TYPE: Release + CCOMPILER: clang + CXXCOMPILER: clang++ + CUCUMBER_TIMEOUT: 60000 + ENABLE_ASSERTIONS: ON + ENABLE_MASON: ON + + - name: mason-osx-release-node-14 + build_node_package: true + continue-on-error: false + node: 14 + runs-on: macos-10.15 + BUILD_TOOLS: ON + BUILD_TYPE: Release + CCOMPILER: clang + CXXCOMPILER: clang++ + CUCUMBER_TIMEOUT: 60000 + ENABLE_ASSERTIONS: ON + ENABLE_MASON: ON + + - name: gcc-7-release-shared + continue-on-error: false + node: 10 + runs-on: ubuntu-18.04 + BUILD_TOOLS: ON + BUILD_TYPE: Release + BUILD_SHARED_LIBS: ON + CCOMPILER: gcc-7 + CXXCOMPILER: g++-7 + + - name: node-14-mason-linux-release + build_node_package: true + continue-on-error: false + node: 14 + runs-on: ubuntu-18.04 + BUILD_TYPE: Release + CLANG_VERSION: 5.0.0 + ENABLE_GLIBC_WORKAROUND: ON + ENABLE_MASON: ON + NODE_PACKAGE_TESTS_ONLY: ON + + - name: node-14-mason-linux-debug + build_node_package: true + continue-on-error: false + node: 14 + runs-on: ubuntu-18.04 + BUILD_TYPE: Debug + CLANG_VERSION: 5.0.0 + ENABLE_GLIBC_WORKAROUND: ON + ENABLE_MASON: ON + NODE_PACKAGE_TESTS_ONLY: ON + + - name: node-12-mason-linux-release + build_node_package: true + continue-on-error: false + node: 12 + runs-on: ubuntu-18.04 + BUILD_TYPE: Release + CLANG_VERSION: 5.0.0 + ENABLE_GLIBC_WORKAROUND: ON + ENABLE_MASON: ON + NODE_PACKAGE_TESTS_ONLY: ON + + - name: node-12-mason-linux-debug + build_node_package: true + continue-on-error: false + node: 12 + runs-on: ubuntu-18.04 + BUILD_TYPE: Debug + CLANG_VERSION: 5.0.0 + ENABLE_GLIBC_WORKAROUND: ON + ENABLE_MASON: ON + NODE_PACKAGE_TESTS_ONLY: ON + + - name: node-10-mason-linux-release + build_node_package: true + continue-on-error: false + node: 10 + runs-on: ubuntu-18.04 + BUILD_TYPE: Release + CLANG_VERSION: 5.0.0 + ENABLE_GLIBC_WORKAROUND: ON + ENABLE_MASON: ON + NODE_PACKAGE_TESTS_ONLY: ON + + - name: node-10-mason-linux-debug + build_node_package: true + continue-on-error: false + node: 10 + runs-on: ubuntu-18.04 + BUILD_TYPE: Debug + CLANG_VERSION: 5.0.0 + ENABLE_GLIBC_WORKAROUND: ON + ENABLE_MASON: ON + NODE_PACKAGE_TESTS_ONLY: ON + + - name: mason-osx-release-node-latest + build_node_package: true + continue-on-error: true + # TODO: Use node 'latest' once supported: https://github.com/actions/setup-node/issues/257 + node: 16 + runs-on: macos-10.15 + BUILD_TYPE: Release + CCOMPILER: clang + CXXCOMPILER: clang++ + CUCUMBER_TIMEOUT: 60000 + ENABLE_ASSERTIONS: ON + ENABLE_MASON: ON + + - name: node-latest-mason-linux-release + build_node_package: true + continue-on-error: true + # TODO: Use node 'latest' once supported: https://github.com/actions/setup-node/issues/257 + node: 16 + runs-on: ubuntu-18.04 + BUILD_TYPE: Release + CLANG_VERSION: 5.0.0 + ENABLE_GLIBC_WORKAROUND: ON + ENABLE_MASON: ON + NODE_PACKAGE_TESTS_ONLY: ON + + - name: node-latest-mason-linux-debug + build_node_package: true + continue-on-error: true + # TODO: Use node 'latest' once supported: https://github.com/actions/setup-node/issues/257 + node: 16 + runs-on: ubuntu-18.04 + BUILD_TYPE: Debug + CLANG_VERSION: 5.0.0 + ENABLE_GLIBC_WORKAROUND: ON + ENABLE_MASON: ON + NODE_PACKAGE_TESTS_ONLY: ON + + - name: mason-osx-release-node-lts + build_node_package: true + continue-on-error: true + node: "lts/*" + runs-on: macos-10.15 + BUILD_TYPE: Release + CCOMPILER: clang + CXXCOMPILER: clang++ + CUCUMBER_TIMEOUT: 60000 + ENABLE_ASSERTIONS: ON + ENABLE_MASON: ON + + - name: node-lts-mason-linux-release + build_node_package: true + continue-on-error: true + node: "lts/*" + runs-on: ubuntu-18.04 + BUILD_TYPE: Release + CLANG_VERSION: 5.0.0 + ENABLE_GLIBC_WORKAROUND: ON + ENABLE_MASON: ON + NODE_PACKAGE_TESTS_ONLY: ON + + - name: node-lts-mason-linux-debug + build_node_package: true + continue-on-error: true + node: "lts/*" + runs-on: ubuntu-18.04 + BUILD_TYPE: Debug + CLANG_VERSION: 5.0.0 + ENABLE_GLIBC_WORKAROUND: ON + ENABLE_MASON: ON + NODE_PACKAGE_TESTS_ONLY: ON + + + name: ${{ matrix.name}} + continue-on-error: ${{ matrix.continue-on-error }} + runs-on: ${{ matrix.runs-on }} + env: + BUILD_TOOLS: ${{ matrix.BUILD_TOOLS }} + BUILD_TYPE: ${{ matrix.BUILD_TYPE }} + BUILD_SHARED_LIBS: ${{ matrix.BUILD_SHARED_LIBS }} + CCOMPILER: ${{ matrix.CCOMPILER }} + CFLAGS: ${{ matrix.CFLAGS }} + CLANG_VERSION: ${{ matrix.CLANG_VERSION }} + CUCUMBER_TIMEOUT: ${{ matrix.CUCUMBER_TIMEOUT }} + CXXCOMPILER: ${{ matrix.CXXCOMPILER }} + CXXFLAGS: ${{ matrix.CXXFLAGS }} + ENABLE_ASSERTIONS: ${{ matrix.ENABLE_ASSERTIONS }} + ENABLE_COVERAGE: ${{ matrix.ENABLE_COVERAGE }} + ENABLE_GLIBC_WORKAROUND: ${{ matrix.ENABLE_GLIBC_WORKAROUND }} + ENABLE_MASON: ${{ matrix.ENABLE_MASON }} + ENABLE_SANITIZER: ${{ matrix.ENABLE_SANITIZER }} + NODE_PACKAGE_TESTS_ONLY: ${{ matrix.NODE_PACKAGE_TESTS_ONLY }} + TARGET_ARCH: ${{ matrix.TARGET_ARCH }} + steps: + - uses: actions/checkout@v2 + + - name: Use Node.js + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node }} + - name: Enable Node.js cache + uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + - name: Enable compiler cache + uses: actions/cache@v2 + with: + path: ~/.ccache + key: ccache-${{ matrix.name }}-${{ github.sha }} + restore-keys: | + ccache-${{ matrix.name }}- + - name: Enable test cache + uses: actions/cache@v2 + with: + path: ${{github.workspace}}/test/cache + key: test-${{ matrix.name }}-${{ github.sha }} + restore-keys: | + test-${{ matrix.name }}- + + - name: Prepare environment + run: | + PACKAGE_JSON_VERSION=$(node -e "console.log(require('./package.json').version)") + echo PUBLISH=$([[ "${GITHUB_REF:-}" == "refs/tags/v${PACKAGE_JSON_VERSION}" ]] && echo "On" || echo "Off") >> $GITHUB_ENV + + echo "OSRM_INSTALL_DIR=${GITHUB_WORKSPACE}/install-osrm" >> $GITHUB_ENV + echo "OSRM_BUILD_DIR=${GITHUB_WORKSPACE}/build-osrm" >> $GITHUB_ENV + + if [[ "$ENABLE_SANITIZER" == 'ON' ]]; then + # We can only set this after checkout once we know the workspace directory + echo "LSAN_OPTIONS=suppressions=${GITHUB_WORKSPACE}/scripts/ci/leaksanitizer.conf" >> $GITHUB_ENV + fi + + if [[ "${RUNNER_OS}" == "Linux" ]]; then + echo "JOBS=$((`nproc` + 1))" >> $GITHUB_ENV + export MASON_OS=linux + elif [[ "${RUNNER_OS}" == "macOS" ]]; then + echo "JOBS=$((`sysctl -n hw.ncpu` + 1))" >> $GITHUB_ENV + sudo mdutil -i off / + export MASON_OS=osx + fi + + echo "MASON=${GITHUB_WORKSPACE}/scripts/mason.sh" >> $GITHUB_ENV + echo "CMAKE_URL=https://mason-binaries.s3.amazonaws.com/${MASON_OS}-x86_64/cmake/${CMAKE_VERSION}.tar.gz" >> $GITHUB_ENV + echo "CMAKE_DIR=mason_packages/${MASON_OS}-x86_64/cmake/${CMAKE_VERSION}}" >> $GITHUB_ENV + + + - name: Install dev dependencies + run: | + # CMake + mkdir -p ${CMAKE_DIR} + wget --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C ${CMAKE_DIR} + echo "${CMAKE_DIR}/bin" >> $GITHUB_PATH + + # TBB + ${MASON} install tbb 2017_U7 + echo "LD_LIBRARY_PATH=$(${MASON} prefix tbb 2017_U7)/lib/:${LD_LIBRARY_PATH}" >> $GITHUB_ENV + + # ccache + ${MASON} install ccache ${CCACHE_VERSION} + echo "$(${MASON} prefix ccache ${CCACHE_VERSION})/bin" >> $GITHUB_PATH + + # clang + if [[ -n ${CLANG_VERSION} ]]; then + echo "CCOMPILER=clang" >> $GITHUB_ENV + echo "CXXCOMPILER=clang++" >> $GITHUB_ENV + ${MASON} install clang++ ${CLANG_VERSION} + echo "$(${MASON} prefix clang++ ${CLANG_VERSION})/bin" >> $GITHUB_PATH + # we only enable lto for release builds + # and therefore don't need to us ld.gold or llvm tools for linking + # for debug builds + if [[ ${BUILD_TYPE} == 'Release' ]]; then + ${MASON} install binutils 2.27 + echo "$(${MASON} prefix binutils 2.27)/bin" >> $GITHUB_PATH + fi + fi + + # Linux dev packages + if [ "${TARGET_ARCH}" != "i686" ] && [ "${ENABLE_MASON}" != "ON" ]; then + sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y + sudo apt-get update -y + sudo apt-get install -y libbz2-dev libxml2-dev libzip-dev liblua5.2-dev libtbb-dev libboost-all-dev + if [[ -z "${CLANG_VERSION}" ]]; then + sudo apt-get install -y ${CXXCOMPILER} + fi + if [[ "${ENABLE_COVERAGE}" == "ON" ]]; then + sudo apt-get install -y lcov + fi + elif [[ $TARGET_ARCH == "i686" ]]; then + source ./scripts/ci/before_install.${TARGET_ARCH}.sh + fi + + - name: Prepare build + run: | + mkdir ${OSRM_BUILD_DIR} + ccache --max-size=256M + npm ci --ignore-scripts + if [[ "${ENABLE_COVERAGE}" == "ON" ]]; then + lcov --directory . --zerocounters # clean cached files + fi + echo "CC=${CCOMPILER}" >> $GITHUB_ENV + echo "CXX=${CXXCOMPILER}" >> $GITHUB_ENV + + - name: Build and install OSRM + run: | + echo "Using ${JOBS} jobs" + pushd ${OSRM_BUILD_DIR} + cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ + -DENABLE_MASON=${ENABLE_MASON:-OFF} \ + -DENABLE_ASSERTIONS=${ENABLE_ASSERTIONS:-OFF}} \ + -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS:-OFF} \ + -DENABLE_COVERAGE=${ENABLE_COVERAGE:-OFF} \ + -DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \ + -DENABLE_SANITIZER=${ENABLE_SANITIZER:-OFF} \ + -DBUILD_TOOLS=${BUILD_TOOLS:-OFF} \ + -DENABLE_CCACHE=ON \ + -DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \ + -DENABLE_GLIBC_WORKAROUND=${ENABLE_GLIBC_WORKAROUND:-OFF} + make --jobs=${JOBS} + + if [[ "${NODE_PACKAGE_TESTS_ONLY}" != "ON" ]]; then + make tests --jobs=${JOBS} + make benchmarks --jobs=${JOBS} + ccache -s + sudo make install + if [[ "${RUNNER_OS}" == "Linux" ]]; then + echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${OSRM_INSTALL_DIR}/lib" >> $GITHUB_ENV + fi + echo "PKG_CONFIG_PATH=${OSRM_INSTALL_DIR}/lib/pkgconfig" >> $GITHUB_ENV + fi + popd + - name: Build example + if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY != 'ON' }} + run: | + mkdir example/build && pushd example/build + cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} + make --jobs=${JOBS} + popd + + - name: Run all tests + if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY != 'ON' }} + run: | + make -C test/data benchmark + + # macOS SIP strips the linker path. Reset this inside the running shell + export LD_LIBRARY_PATH=${{ env.LD_LIBRARY_PATH }} + ./example/build/osrm-example test/data/mld/monaco.osrm + + # All tests assume to be run from the build directory + pushd ${OSRM_BUILD_DIR} + ./unit_tests/library-tests + ./unit_tests/extractor-tests + ./unit_tests/contractor-tests + ./unit_tests/engine-tests + ./unit_tests/util-tests + ./unit_tests/server-tests + ./unit_tests/partitioner-tests + ./unit_tests/customizer-tests + if [ -z "${ENABLE_SANITIZER}" ] && [ "$TARGET_ARCH" != "i686" ]; then + npm run nodejs-tests + fi + popd + npm test + - name: Run Node package tests only + if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY == 'ON' }} + run: | + npm run nodejs-tests + + - name: Generate code coverage + if: ${{ matrix.ENABLE_COVERAGE == 'ON' }} + run: | + lcov --directory . --capture --output-file coverage.info # capture coverage info + lcov --remove coverage.info '/usr/*' --output-file coverage.info # filter out system + lcov --list coverage.info #debug info + # Uploading report to CodeCov + - name: Upload code coverage + if: ${{ matrix.ENABLE_COVERAGE == 'ON' }} + uses: codecov/codecov-action@v1 + with: + files: coverage.info + name: codecov-osrm-backend + fail_ci_if_error: true + verbose: true + + - name: Build Node package + if: ${{ matrix.build_node_package && env.PUBLISH == 'On' }} + run: ./scripts/ci/node_package.sh + - name: Publish Node package + if: ${{ matrix.build_node_package && env.PUBLISH == 'On' }} + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + artifactErrorsFailBuild: true + artifacts: build/stage/**/*.tar.gz + omitBody: true + omitBodyDuringUpdate: true + omitName: true + omitNameDuringUpdate: true + replacesArtifacts: true + token: ${{ secrets.GITHUB_TOKEN }} + + ci-complete: + runs-on: ubuntu-18.04 + needs: build-test-publish + steps: + - run: echo "CI complete" diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 33cbdeeba..000000000 --- a/.travis.yml +++ /dev/null @@ -1,585 +0,0 @@ -language: cpp - -git: - depth: 10 - -# sudo:required is needed for trusty images -sudo: required -dist: trusty - -notifications: - email: false - -branches: - only: - - master - # enable building tags - - /^v\d+\.\d+(\.\d+)?(-\S*)?$/ - -cache: - npm: true - ccache: true - apt: true - directories: - - test/cache - -env: - global: - - CCACHE_TEMPDIR=/tmp/.ccache-temp - - CCACHE_COMPRESS=1 - - CASHER_TIME_OUT=599 # one second less than 10m to avoid 10m timeout error: https://github.com/Project-OSRM/osrm-backend/issues/2742 - - CCACHE_VERSION=3.3.1 - - CMAKE_VERSION=3.7.2 - - MASON="$(pwd)/scripts/mason.sh" - - ENABLE_NODE_BINDINGS=On - - NODE="10" - -stages: - - core - - optional - -matrix: - fast_finish: true - - # We override the compiler names here to yield better ccache behavior, which uses this as key - include: - - # Debug Builds - - stage: core - os: linux - compiler: "format-taginfo-docs" - env: NODE=10 - sudo: false - before_install: - install: - - curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash - - source $NVM_DIR/nvm.sh - - nvm install $NODE - - nvm use $NODE - - npm --version - - npm ci --ignore-scripts - script: - - ./scripts/check_taginfo.py taginfo.json profiles/car.lua - - ${MASON} install clang-format 10.0.0 - - PATH=$(${MASON} prefix clang-format 10.0.0)/bin:${PATH} ./scripts/format.sh && ./scripts/error_on_dirty.sh - - node ./scripts/validate_changelog.js - # See issue 4043 - #- npm run docs && ./scripts/error_on_dirty.sh - after_success: - - - os: linux - compiler: "gcc-7-debug-cov" - addons: &gcc7 - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-7', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev', 'lcov'] - env: CCOMPILER='gcc-7' CXXCOMPILER='g++-7' BUILD_TYPE='Debug' ENABLE_COVERAGE=ON CUCUMBER_TIMEOUT=20000 - before_script: - - cd ${TRAVIS_BUILD_DIR} - - lcov --directory . --zerocounters # clean cached da files - after_success: - # Creating report - - cd ${TRAVIS_BUILD_DIR} - - lcov --directory . --capture --output-file coverage.info # capture coverage info - - lcov --remove coverage.info '/usr/*' --output-file coverage.info # filter out system - - lcov --list coverage.info #debug info - # Uploading report to CodeCov - - bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports" - - - os: linux - compiler: "gcc-7-debug-asan" - addons: &gcc7 - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-7', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev'] - env: CCOMPILER='gcc-7' CXXCOMPILER='g++-7' BUILD_TYPE='Debug' TARGET_ARCH='x86_64-asan' ENABLE_SANITIZER=ON CUCUMBER_TIMEOUT=20000 LSAN_OPTIONS="suppressions=$TRAVIS_BUILD_DIR/scripts/travis/leaksanitizer.conf" - - - os: linux - compiler: "clang-5.0-debug" - addons: &clang50 - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['libstdc++-5-dev', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev'] - env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' CUCUMBER_TIMEOUT=60000 - - - os: linux - compiler: "mason-linux-debug-asan" - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['libstdc++-4.9-dev'] - env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_SANITIZER=ON LSAN_OPTIONS="suppressions=$TRAVIS_BUILD_DIR/scripts/travis/leaksanitizer.conf" - - # Release Builds - - os: linux - compiler: "mason-linux-release" - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['libstdc++-4.9-dev'] - env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON RUN_CLANG_FORMAT=ON ENABLE_LTO=ON - - - os: linux - compiler: "gcc-9-release" - addons: &gcc9 - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-9', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev'] - env: CCOMPILER='gcc-9' CXXCOMPILER='g++-9' BUILD_TYPE='Release' CXXFLAGS='-Wno-cast-function-type' - - - os: linux - compiler: "gcc-8-release" - addons: &gcc8 - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-8', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev'] - env: CCOMPILER='gcc-8' CXXCOMPILER='g++-8' BUILD_TYPE='Release' CXXFLAGS='-Wno-cast-function-type' - - - os: linux - compiler: "gcc-7-release" - addons: &gcc7 - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-7', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev'] - env: CCOMPILER='gcc-7' CXXCOMPILER='g++-7' BUILD_TYPE='Release' - - - os: linux - compiler: "gcc-7-release-i686" - env: > - TARGET_ARCH='i686' CCOMPILER='gcc-7' CXXCOMPILER='g++-7' BUILD_TYPE='Release' - CFLAGS='-m32 -msse2 -mfpmath=sse' CXXFLAGS='-m32 -msse2 -mfpmath=sse' - - - os: linux - compiler: "gcc-5-release" - addons: &gcc49 - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-5', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev', 'ccache'] - env: CCOMPILER='gcc-5' CXXCOMPILER='g++-5' BUILD_TYPE='Release' - - - os: linux - compiler: "gcc-6-release" - addons: &gcc49 - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-6', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev', 'ccache'] - env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release' - - - os: osx - osx_image: xcode9.2 - compiler: "mason-osx-release-node-10" - # we use the xcode provides clang and don't install our own - env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="10" - after_success: - - ./scripts/travis/node_package.sh - - - os: osx - osx_image: xcode9.2 - compiler: "mason-osx-release-node-12" - # we use the xcode provides clang and don't install our own - env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="12" - after_success: - - ./scripts/travis/node_package.sh - - - os: osx - osx_image: xcode9.2 - compiler: "mason-osx-release-node-14" - # we use the xcode provides clang and don't install our own - env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="14" - after_success: - - ./scripts/travis/node_package.sh - - # Shared Library - - os: linux - compiler: "gcc-7-release-shared" - addons: &gcc7 - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-7', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev'] - env: CCOMPILER='gcc-7' CXXCOMPILER='g++-7' BUILD_TYPE='Release' BUILD_SHARED_LIBS=ON - - # Node build jobs. These skip running the tests. - - os: linux - sudo: false - compiler: "node-14-mason-linux-release" - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['libstdc++-4.9-dev'] - env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="14" - install: - - pushd ${OSRM_BUILD_DIR} - - | - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ - -DENABLE_MASON=${ENABLE_MASON:-OFF} \ - -DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \ - -DENABLE_CCACHE=ON \ - -DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \ - -DENABLE_GLIBC_WORKAROUND=ON - - make --jobs=${JOBS} - - popd - script: - - npm run nodejs-tests - after_success: - - ./scripts/travis/node_package.sh - - - os: linux - sudo: false - compiler: "node-14-mason-linux-debug" - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['libstdc++-4.9-dev'] - env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="14" - install: - - pushd ${OSRM_BUILD_DIR} - - | - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ - -DENABLE_MASON=${ENABLE_MASON:-OFF} \ - -DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \ - -DENABLE_CCACHE=ON \ - -DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \ - -DENABLE_GLIBC_WORKAROUND=ON - - make --jobs=${JOBS} - - popd - script: - - npm run nodejs-tests - after_success: - - ./scripts/travis/node_package.sh - - - os: linux - sudo: false - compiler: "node-12-mason-linux-release" - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['libstdc++-4.9-dev'] - env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="12" - install: - - pushd ${OSRM_BUILD_DIR} - - | - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ - -DENABLE_MASON=${ENABLE_MASON:-OFF} \ - -DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \ - -DENABLE_CCACHE=ON \ - -DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \ - -DENABLE_GLIBC_WORKAROUND=ON - - make --jobs=${JOBS} - - popd - script: - - npm run nodejs-tests - after_success: - - ./scripts/travis/node_package.sh - - - os: linux - sudo: false - compiler: "node-12-mason-linux-debug" - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['libstdc++-4.9-dev'] - env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="12" - install: - - pushd ${OSRM_BUILD_DIR} - - | - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ - -DENABLE_MASON=${ENABLE_MASON:-OFF} \ - -DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \ - -DENABLE_CCACHE=ON \ - -DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \ - -DENABLE_GLIBC_WORKAROUND=ON - - make --jobs=${JOBS} - - popd - script: - - npm run nodejs-tests - after_success: - - ./scripts/travis/node_package.sh - - - os: linux - sudo: false - compiler: "node-10-mason-linux-release" - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['libstdc++-4.9-dev'] - env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="10" - install: - - pushd ${OSRM_BUILD_DIR} - - | - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ - -DENABLE_MASON=${ENABLE_MASON:-OFF} \ - -DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \ - -DENABLE_CCACHE=ON \ - -DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \ - -DENABLE_GLIBC_WORKAROUND=ON - - make --jobs=${JOBS} - - popd - script: - - npm run nodejs-tests - after_success: - - ./scripts/travis/node_package.sh - - - os: linux - sudo: false - compiler: "node-10-mason-linux-debug" - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['libstdc++-4.9-dev'] - env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="10" - install: - - pushd ${OSRM_BUILD_DIR} - - | - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ - -DENABLE_MASON=${ENABLE_MASON:-OFF} \ - -DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \ - -DENABLE_CCACHE=ON \ - -DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \ - -DENABLE_GLIBC_WORKAROUND=ON - - make --jobs=${JOBS} - - popd - script: - - npm run nodejs-tests - after_success: - - ./scripts/travis/node_package.sh - - - os: osx - stage: optional - osx_image: xcode9.2 - compiler: "mason-osx-release-node-latest" - # we use the xcode provides clang and don't install our own - env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="node" - after_success: - - ./scripts/travis/node_package.sh - - - os: linux - sudo: false - compiler: "node-latest-mason-linux-release" - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['libstdc++-4.9-dev'] - env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="node" - install: - - pushd ${OSRM_BUILD_DIR} - - | - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ - -DENABLE_MASON=${ENABLE_MASON:-OFF} \ - -DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \ - -DENABLE_CCACHE=ON \ - -DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \ - -DENABLE_GLIBC_WORKAROUND=ON - - make --jobs=${JOBS} - - popd - script: - - npm run nodejs-tests - after_success: - - ./scripts/travis/node_package.sh - - - os: linux - sudo: false - compiler: "node-latest-mason-linux-debug" - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['libstdc++-4.9-dev'] - env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="node" - install: - - pushd ${OSRM_BUILD_DIR} - - | - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ - -DENABLE_MASON=${ENABLE_MASON:-OFF} \ - -DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \ - -DENABLE_CCACHE=ON \ - -DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \ - -DENABLE_GLIBC_WORKAROUND=ON - - make --jobs=${JOBS} - - popd - script: - - npm run nodejs-tests - after_success: - - ./scripts/travis/node_package.sh - - - os: osx - osx_image: xcode9.2 - compiler: "mason-osx-release-node-lts" - # we use the xcode provides clang and don't install our own - env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="--lts" - after_success: - - ./scripts/travis/node_package.sh - - - os: linux - sudo: false - compiler: "node-lts-mason-linux-release" - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['libstdc++-4.9-dev'] - env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="--lts" - install: - - pushd ${OSRM_BUILD_DIR} - - | - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ - -DENABLE_MASON=${ENABLE_MASON:-OFF} \ - -DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \ - -DENABLE_CCACHE=ON \ - -DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \ - -DENABLE_GLIBC_WORKAROUND=ON - - make --jobs=${JOBS} - - popd - script: - - npm run nodejs-tests - after_success: - - ./scripts/travis/node_package.sh - - - os: linux - sudo: false - compiler: "node-lts-mason-linux-debug" - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['libstdc++-4.9-dev'] - env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="--lts" - install: - - pushd ${OSRM_BUILD_DIR} - - | - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ - -DENABLE_MASON=${ENABLE_MASON:-OFF} \ - -DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \ - -DENABLE_CCACHE=ON \ - -DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \ - -DENABLE_GLIBC_WORKAROUND=ON - - make --jobs=${JOBS} - - popd - script: - - npm run nodejs-tests - after_success: - - ./scripts/travis/node_package.sh - - allow_failures: - - compiler: "mason-osx-release-node-latest" - env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="node" - - compiler: "node-latest-mason-linux-release" - env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="node" - - compiler: "node-latest-mason-linux-debug" - env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="node" - - compiler: "mason-osx-release-node-lts" - env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="--lts" - - compiler: "node-lts-mason-linux-release" - env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="--lts" - - compiler: "node-lts-mason-linux-debug" - env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="--lts" - -before_install: - - curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash - - source $NVM_DIR/nvm.sh - - nvm install $NODE - - nvm use $NODE - - node --version - - if [[ ! -z $TARGET_ARCH ]] ; then source ./scripts/travis/before_install.$TARGET_ARCH.sh ; fi - - | - if [[ -z $JOBS ]]; then - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then - export JOBS=$((`nproc` + 1)) - elif [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then - export JOBS=$((`sysctl -n hw.ncpu` + 1)) - fi - fi - - | - if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then - sudo mdutil -i off / - fi - - export PACKAGE_JSON_VERSION=$(node -e "console.log(require('./package.json').version)") - - export PUBLISH=$([[ "${TRAVIS_TAG:-}" == "v${PACKAGE_JSON_VERSION}" ]] && echo "On" || echo "Off") - - echo "Using ${JOBS} jobs" - - npm ci --ignore-scripts - # Bootstrap cmake to be able to run mason - - CMAKE_URL="https://mason-binaries.s3.amazonaws.com/${TRAVIS_OS_NAME}-x86_64/cmake/${CMAKE_VERSION}.tar.gz" - - CMAKE_DIR="mason_packages/${TRAVIS_OS_NAME}-x86_64/cmake/${CMAKE_VERSION}" - - mkdir -p ${CMAKE_DIR} - - travis_retry wget --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C ${CMAKE_DIR} || travis_terminate 1 - - export PATH=${CMAKE_DIR}/bin:${PATH} - - ${MASON} install tbb 2017_U7 && export LD_LIBRARY_PATH=$(${MASON} prefix tbb 2017_U7)/lib/:${LD_LIBRARY_PATH} - - ${MASON} install ccache ${CCACHE_VERSION} && export PATH=$(${MASON} prefix ccache ${CCACHE_VERSION})/bin:${PATH} - - | - if [[ ! -z ${CLANG_VERSION} ]]; then - export CCOMPILER='clang' - export CXXCOMPILER='clang++' - ${MASON} install clang++ ${CLANG_VERSION} && export PATH=$(${MASON} prefix clang++ ${CLANG_VERSION})/bin:${PATH} || travis_terminate 1 - # we only enable lto for release builds - # and therefore don't need to us ld.gold or llvm tools for linking - # for debug builds - if [[ ${BUILD_TYPE} == 'Release' ]]; then - ${MASON} install binutils 2.27 && export PATH=$(${MASON} prefix binutils 2.27)/bin:${PATH} || travis_terminate 1 - fi - fi - - ccache --max-size=256M # limiting the cache's size to roughly the previous job's object sizes - - export OSRM_INSTALL_DIR="$(pwd)/install-osrm" - - export OSRM_BUILD_DIR="$(pwd)/build-osrm" - - export CC=${CCOMPILER} CXX=${CXXCOMPILER} - - mkdir ${OSRM_BUILD_DIR} - -install: - - pushd ${OSRM_BUILD_DIR} - - | - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ - -DENABLE_MASON=${ENABLE_MASON:-OFF} \ - -DENABLE_ASSERTIONS=${ENABLE_ASSERTIONS:-OFF} \ - -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS:-OFF} \ - -DENABLE_COVERAGE=${ENABLE_COVERAGE:-OFF} \ - -DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \ - -DENABLE_SANITIZER=${ENABLE_SANITIZER:-OFF} \ - -DBUILD_TOOLS=ON \ - -DENABLE_CCACHE=ON \ - -DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \ - -DENABLE_GLIBC_WORKAROUND=${ENABLE_GLIBC_WORKAROUND:-OFF} - - echo "travis_fold:start:MAKE" - - make --jobs=${JOBS} - - make tests --jobs=${JOBS} - - make benchmarks --jobs=${JOBS} - - echo "travis_fold:end:MAKE" - - ccache -s - - sudo make install - - | - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${OSRM_INSTALL_DIR}/lib - fi - - popd - - mkdir example/build && pushd example/build - - export PKG_CONFIG_PATH=${OSRM_INSTALL_DIR}/lib/pkgconfig - - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} - - make --jobs=${JOBS} - - popd - -script: - - if [[ $TARGET_ARCH == armhf ]] ; then echo "Skip tests for $TARGET_ARCH" && exit 0 ; fi - - make -C test/data benchmark - - ./example/build/osrm-example test/data/mld/monaco.osrm - # All tests assume to be run from the build directory - - pushd ${OSRM_BUILD_DIR} - - ./unit_tests/library-tests - - ./unit_tests/extractor-tests - - ./unit_tests/contractor-tests - - ./unit_tests/engine-tests - - ./unit_tests/util-tests - - ./unit_tests/server-tests - - ./unit_tests/partitioner-tests - - ./unit_tests/customizer-tests - - | - if [ -z "${ENABLE_SANITIZER}" ] && [ "$TARGET_ARCH" != "i686" ]; then - npm run nodejs-tests - fi - - | - - popd - - npm test - -deploy: - provider: releases - api_key: - secure: "Ej7tPd+XhAlBvA0SnYghYakO6QUwUI+oOtjlkPmy0UfKtIQ4bIzoIm1BDbPwrmNiCSKB7lLZYZpKz68PBRtblfqvTjhzXSzlvFk36pyywgkuNY13N3VQZo2c5CShLCy41nx4+uLkjhLfKYOALSE3OivdJJHLZEsSwx60Csx7owU=" - skip_cleanup: true - file_glob: true - file: build/stage/**/*.tar.gz - on: - tags: true - condition: "$PUBLISH = 'On'" diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a08ea1a6..3c18315d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ - Changes from 5.25.0 - API: - FIXED: Allow for special characters in the profile/method as part of the HTTP URL. + - Build: + - CHANGED: Replace Travis with Github Actions for CI builds [#6071](https://github.com/Project-OSRM/osrm-backend/pull/6071) # 5.25.0 - Changes from 5.24.0 diff --git a/CMakeLists.txt b/CMakeLists.txt index e6feb6de9..265d27d64 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -514,7 +514,7 @@ if(ENABLE_MASON) set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${LINKER_FLAGS}") # current mason packages target -D_GLIBCXX_USE_CXX11_ABI=0 - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0") + add_dependency_defines(-D_GLIBCXX_USE_CXX11_ABI=0) # note: we avoid calling find_package(Osmium ...) here to ensure that the # expat and bzip2 are used from mason rather than the system @@ -862,4 +862,4 @@ if (ENABLE_NODE_BINDINGS) endforeach() add_library(check-headers STATIC EXCLUDE_FROM_ALL ${sources}) set_target_properties(check-headers PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${check_headers_dir}) -endif() \ No newline at end of file +endif() diff --git a/scripts/travis/before_install.armhf.sh b/scripts/ci/before_install.armhf.sh similarity index 100% rename from scripts/travis/before_install.armhf.sh rename to scripts/ci/before_install.armhf.sh diff --git a/scripts/travis/before_install.i686.sh b/scripts/ci/before_install.i686.sh similarity index 100% rename from scripts/travis/before_install.i686.sh rename to scripts/ci/before_install.i686.sh diff --git a/scripts/travis/before_install.x86_64-asan.sh b/scripts/ci/before_install.x86_64-asan.sh similarity index 100% rename from scripts/travis/before_install.x86_64-asan.sh rename to scripts/ci/before_install.x86_64-asan.sh diff --git a/scripts/travis/is_pr_merge.sh b/scripts/ci/is_pr_merge.sh similarity index 100% rename from scripts/travis/is_pr_merge.sh rename to scripts/ci/is_pr_merge.sh diff --git a/scripts/travis/leaksanitizer.conf b/scripts/ci/leaksanitizer.conf similarity index 100% rename from scripts/travis/leaksanitizer.conf rename to scripts/ci/leaksanitizer.conf diff --git a/scripts/travis/node_package.sh b/scripts/ci/node_package.sh similarity index 100% rename from scripts/travis/node_package.sh rename to scripts/ci/node_package.sh diff --git a/scripts/travis/travis_helper.sh b/scripts/ci/travis_helper.sh similarity index 100% rename from scripts/travis/travis_helper.sh rename to scripts/ci/travis_helper.sh diff --git a/src/extractor/maneuver_override_relation_parser.cpp b/src/extractor/maneuver_override_relation_parser.cpp index a414c0150..5a48adfb4 100644 --- a/src/extractor/maneuver_override_relation_parser.cpp +++ b/src/extractor/maneuver_override_relation_parser.cpp @@ -1,14 +1,8 @@ #include "extractor/maneuver_override_relation_parser.hpp" #include "extractor/maneuver_override.hpp" -#include "util/log.hpp" - -#include -#include -#include #include #include -#include #include #include diff --git a/src/extractor/restriction_parser.cpp b/src/extractor/restriction_parser.cpp index 28ff24a57..c81f4331d 100644 --- a/src/extractor/restriction_parser.cpp +++ b/src/extractor/restriction_parser.cpp @@ -5,10 +5,8 @@ #include "util/log.hpp" #include -#include #include #include -#include #include #include @@ -244,14 +242,15 @@ bool RestrictionParser::ShouldIgnoreRestriction(const std::string &except_tag_st // Be warned, this is quadratic work here, but we assume that // only a few exceptions are actually defined. - std::vector exceptions; - boost::algorithm::split_regex(exceptions, except_tag_string, boost::regex("[;][ ]*")); + const std::regex delimiter_re("[;][ ]*"); + std::sregex_token_iterator except_tags_begin( + except_tag_string.begin(), except_tag_string.end(), delimiter_re, -1); + std::sregex_token_iterator except_tags_end; - return std::any_of( - std::begin(exceptions), std::end(exceptions), [&](const std::string ¤t_string) { - return std::end(restrictions) != - std::find(std::begin(restrictions), std::end(restrictions), current_string); - }); + return std::any_of(except_tags_begin, except_tags_end, [&](const std::string ¤t_string) { + return std::end(restrictions) != + std::find(std::begin(restrictions), std::end(restrictions), current_string); + }); } } // namespace extractor } // namespace osrm diff --git a/unit_tests/library/json.cpp b/unit_tests/library/json.cpp index 537eecc94..1b0b36a86 100644 --- a/unit_tests/library/json.cpp +++ b/unit_tests/library/json.cpp @@ -6,7 +6,6 @@ #include "engine/api/json_factory.hpp" #include "osrm/coordinate.hpp" -#include #include using namespace osrm; @@ -27,7 +26,7 @@ BOOST_AUTO_TEST_CASE(test_json_linestring) const auto coords = geom.values["coordinates"].get().values; BOOST_CHECK_EQUAL(coords.size(), 3); // array of three location arrays - for (const auto each : coords) + for (const auto &each : coords) { const auto loc = each.get().values; BOOST_CHECK_EQUAL(loc.size(), 2); @@ -53,7 +52,7 @@ BOOST_AUTO_TEST_CASE(test_json_single_point) const auto coords = geom.values["coordinates"].get().values; BOOST_CHECK_EQUAL(coords.size(), 2); // array of two location arrays - for (const auto each : coords) + for (const auto &each : coords) { const auto loc = each.get().values; BOOST_CHECK_EQUAL(loc.size(), 2); diff --git a/unit_tests/library/match.cpp b/unit_tests/library/match.cpp index 2302012c7..70be34472 100644 --- a/unit_tests/library/match.cpp +++ b/unit_tests/library/match.cpp @@ -184,7 +184,7 @@ BOOST_AUTO_TEST_CASE(test_match_fb_serialization) const auto matchings = fb->routes(); const auto &number_of_matchings = matchings->size(); - for (const auto &waypoint : *waypoints) + for (const auto waypoint : *waypoints) { BOOST_CHECK(waypoint_check(waypoint)); const auto matchings_index = waypoint->matchings_index(); diff --git a/unit_tests/library/nearest.cpp b/unit_tests/library/nearest.cpp index 5ad451445..249e19387 100644 --- a/unit_tests/library/nearest.cpp +++ b/unit_tests/library/nearest.cpp @@ -202,7 +202,7 @@ BOOST_AUTO_TEST_CASE(test_nearest_fb_serialization) auto waypoints = fb->waypoints(); BOOST_CHECK(waypoints->size() > 0); // the dataset has at least one nearest coordinate - for (const auto &waypoint : *waypoints) + for (const auto waypoint : *waypoints) { BOOST_CHECK(waypoint->distance() >= 0); BOOST_CHECK(waypoint->nodes()->first() != 0); diff --git a/unit_tests/library/route.cpp b/unit_tests/library/route.cpp index 44fcb877b..0e4798523 100644 --- a/unit_tests/library/route.cpp +++ b/unit_tests/library/route.cpp @@ -263,7 +263,7 @@ void test_route_same_coordinates(bool use_json_only_api) const auto &entries = intersection_object.at("entry").get().values; BOOST_CHECK(bearings.size() == entries.size()); - for (const auto bearing : bearings) + for (const auto &bearing : bearings) BOOST_CHECK(0. <= bearing.get().value && bearing.get().value <= 360.); @@ -619,7 +619,7 @@ BOOST_AUTO_TEST_CASE(test_route_serialize_fb) const auto waypoints = fb->waypoints(); BOOST_CHECK(waypoints->size() == params.coordinates.size()); - for (const auto &waypoint : *waypoints) + for (const auto waypoint : *waypoints) { const auto longitude = waypoint->location()->longitude(); const auto latitude = waypoint->location()->latitude(); @@ -633,7 +633,7 @@ BOOST_AUTO_TEST_CASE(test_route_serialize_fb) const auto routes = fb->routes(); BOOST_REQUIRE_GT(routes->size(), 0); - for (const auto &route : *routes) + for (const auto route : *routes) { BOOST_CHECK_EQUAL(route->distance(), 0); BOOST_CHECK_EQUAL(route->duration(), 0); @@ -641,7 +641,7 @@ BOOST_AUTO_TEST_CASE(test_route_serialize_fb) const auto &legs = route->legs(); BOOST_CHECK(legs->size() > 0); - for (const auto &leg : *legs) + for (const auto leg : *legs) { BOOST_CHECK_EQUAL(leg->distance(), 0); @@ -720,7 +720,7 @@ BOOST_AUTO_TEST_CASE(test_route_serialize_fb_skip_waypoints) const auto routes = fb->routes(); BOOST_REQUIRE_GT(routes->size(), 0); - for (const auto &route : *routes) + for (const auto route : *routes) { BOOST_CHECK_EQUAL(route->distance(), 0); BOOST_CHECK_EQUAL(route->duration(), 0); diff --git a/unit_tests/library/table.cpp b/unit_tests/library/table.cpp index 74801f2c7..0fa27d9a1 100644 --- a/unit_tests/library/table.cpp +++ b/unit_tests/library/table.cpp @@ -332,14 +332,14 @@ BOOST_AUTO_TEST_CASE(test_table_serialiaze_fb) // check destinations array of waypoint objects const auto &destinations_array = fb->table()->destinations(); BOOST_CHECK_EQUAL(destinations_array->size(), params.destinations.size()); - for (const auto &destination : *destinations_array) + for (const auto destination : *destinations_array) { BOOST_CHECK(waypoint_check(destination)); } // check sources array of waypoint objects const auto &sources_array = fb->waypoints(); BOOST_CHECK_EQUAL(sources_array->size(), params.sources.size()); - for (const auto &source : *sources_array) + for (const auto source : *sources_array) { BOOST_CHECK(waypoint_check(source)); } diff --git a/unit_tests/library/trip.cpp b/unit_tests/library/trip.cpp index ba80cf542..6eb500e81 100644 --- a/unit_tests/library/trip.cpp +++ b/unit_tests/library/trip.cpp @@ -525,7 +525,7 @@ BOOST_AUTO_TEST_CASE(test_roundtrip_response_fb_serialization) const auto trips = fb->routes(); BOOST_CHECK_EQUAL(trips->size(), 1); - for (const auto &waypoint : *waypoints) + for (const auto waypoint : *waypoints) { const auto longitude = waypoint->location()->longitude(); const auto latitude = waypoint->location()->latitude(); From 971f0d3fe23ddcb85df2fd8e0aabb41ff56c7591 Mon Sep 17 00:00:00 2001 From: Michael Bell Date: Fri, 3 Sep 2021 12:42:31 +0100 Subject: [PATCH 08/13] Format unit_tests --- unit_tests/server/url_parser.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/unit_tests/server/url_parser.cpp b/unit_tests/server/url_parser.cpp index 98f050410..4ac71efa3 100644 --- a/unit_tests/server/url_parser.cpp +++ b/unit_tests/server/url_parser.cpp @@ -126,8 +126,10 @@ BOOST_AUTO_TEST_CASE(valid_urls) BOOST_CHECK_EQUAL(reference_8.prefix_length, result_8->prefix_length); // profile with special characters - api::ParsedURL reference_9{"route", 1, "foo-bar_baz.profile", "0,1;2,3;4,5?options=value&foo=bar", 30UL}; - auto result_9 = api::parseURL("/route/v1/foo-bar_baz.profile/0,1;2,3;4,5?options=value&foo=bar"); + api::ParsedURL reference_9{ + "route", 1, "foo-bar_baz.profile", "0,1;2,3;4,5?options=value&foo=bar", 30UL}; + auto result_9 = + api::parseURL("/route/v1/foo-bar_baz.profile/0,1;2,3;4,5?options=value&foo=bar"); BOOST_CHECK(result_9); BOOST_CHECK_EQUAL(reference_9.service, result_9->service); BOOST_CHECK_EQUAL(reference_9.version, result_9->version); From 091169100811ca45b7d8c13f1dbfbc912ee986d0 Mon Sep 17 00:00:00 2001 From: Michael Bell Date: Fri, 3 Sep 2021 12:45:32 +0100 Subject: [PATCH 09/13] Fix changelog entry --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c18315d0..65ebe5b80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # Unreleased - Changes from 5.25.0 - API: - - FIXED: Allow for special characters in the profile/method as part of the HTTP URL. + - FIXED: Allow for special characters in the profile/method as part of the HTTP URL. [#6090](https://github.com/Project-OSRM/osrm-backend/pull/6090) - Build: - CHANGED: Replace Travis with Github Actions for CI builds [#6071](https://github.com/Project-OSRM/osrm-backend/pull/6071) From 98846847014dfcfcca4f1a54300258184d345d7f Mon Sep 17 00:00:00 2001 From: Michael Bell Date: Sat, 17 Jul 2021 20:12:42 +0100 Subject: [PATCH 10/13] Fix generation of inefficient MLD partitions Duplicate restriction nodes in the edge-based-graph are currently not in included in a mapping (.osrm.cnbg_to_ebg) from node-based-graph edges to edge-based-graph nodes. This mapping is used by the MLD partitioner to assign EBG nodes to partitions. The omission from the mapping means all restriction nodes are included in a special 'invalid' partition. This special partition will break the geolocation properties of the multi-level hierarchy. The partition and its super levels will have a large number of border nodes and very few internal paths between them. Given the partitioner is the only consumer of the mapping, we fix the issue by including the duplicate restriction nodes in the mapping, so that they are correctly assigned to a partition. This has measurable improvement on MLD routing. For a country-sized routing network, the fix reduces routing and table request computation time by ~2% and ~6% respectively. --- CHANGELOG.md | 2 ++ src/extractor/edge_based_graph_factory.cpp | 7 +++++++ src/partitioner/partitioner.cpp | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65ebe5b80..3ebf4c56f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ - FIXED: Allow for special characters in the profile/method as part of the HTTP URL. [#6090](https://github.com/Project-OSRM/osrm-backend/pull/6090) - Build: - CHANGED: Replace Travis with Github Actions for CI builds [#6071](https://github.com/Project-OSRM/osrm-backend/pull/6071) + - Routing: + - FIXED: Fix generation of inefficient MLD partitions [#6084](https://github.com/Project-OSRM/osrm-backend/pull/6084) # 5.25.0 - Changes from 5.24.0 diff --git a/src/extractor/edge_based_graph_factory.cpp b/src/extractor/edge_based_graph_factory.cpp index 7bd359de1..edef3d589 100644 --- a/src/extractor/edge_based_graph_factory.cpp +++ b/src/extractor/edge_based_graph_factory.cpp @@ -412,6 +412,13 @@ EdgeBasedGraphFactory::GenerateEdgeExpandedNodes(const WayRestrictionMap &way_re m_edge_based_node_distances.push_back( m_edge_based_node_distances[nbe_to_ebn_mapping[eid]]); + // Include duplicate nodes in cnbg to ebg mapping. This means a + // compressed node pair (u,v) can appear multiple times in this list. + // This is needed by the MLD partition step to ensure duplicate nodes + // are also assigned to partitions (the MLD partitioner is currently + // the only consumer of this mapping). + mapping.push_back(NBGToEBG{node_u, node_v, edge_based_node_id, SPECIAL_NODEID}); + edge_based_node_id++; progress.PrintStatus(progress_counter++); } diff --git a/src/partitioner/partitioner.cpp b/src/partitioner/partitioner.cpp index 29f6395a3..f01ea966c 100644 --- a/src/partitioner/partitioner.cpp +++ b/src/partitioner/partitioner.cpp @@ -118,6 +118,10 @@ int Partitioner::Run(const PartitionerConfig &config) edge_based_partition_ids[backward_node] = node_based_partition_ids[v]; } + BOOST_ASSERT(std::none_of(edge_based_partition_ids.begin(), + edge_based_partition_ids.end(), + [](auto x) { return x == SPECIAL_NODEID; })); + std::vector partitions; std::vector level_to_num_cells; std::tie(partitions, level_to_num_cells) = From d413d0639d38ec7b3b168fd92a43c95d8c736675 Mon Sep 17 00:00:00 2001 From: Michael Bell Date: Sat, 17 Jul 2021 16:20:45 +0100 Subject: [PATCH 11/13] Fix Boost link flags in pkg-config file. In newer versions of cmake, FindBoost uses Imported Targets for library component variables, rather than file paths to the Boost libraries. cmake uses these targets when linking (e.g. target_link_library) and knows how to correctly substitute the values. However, the OSRM pkg-config file that we generate doesn't do this, and ends up writing the actual target symbols, hence the errors trying to link Boost::. To fix this for newer cmake versions, we create an intermediate configure step that references the linker files for the imported targets. This is followed by a generate step that performs the correct substitution. See this thread for more details: https://cmake.org/pipermail/cmake/2018-December/068812.html This is backwards compatible to the existing min cmake version (3.1). However, building using cmake 3.1 fails with a package.json parsing error, so this commit also bumps the min version to 3.2. --- CHANGELOG.md | 1 + CMakeLists.txt | 22 +++++++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ebf4c56f..1037c5109 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - FIXED: Allow for special characters in the profile/method as part of the HTTP URL. [#6090](https://github.com/Project-OSRM/osrm-backend/pull/6090) - Build: - CHANGED: Replace Travis with Github Actions for CI builds [#6071](https://github.com/Project-OSRM/osrm-backend/pull/6071) + - FIXED: Fixed Boost link flags in pkg-config file. [#6083](https://github.com/Project-OSRM/osrm-backend/pull/6083) - Routing: - FIXED: Fix generation of inefficient MLD partitions [#6084](https://github.com/Project-OSRM/osrm-backend/pull/6084) diff --git a/CMakeLists.txt b/CMakeLists.txt index 265d27d64..e49fac29a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.2) if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR AND NOT MSVC_IDE) message(FATAL_ERROR "In-source builds are not allowed. @@ -802,9 +802,25 @@ set(PKGCONFIG_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include") list(APPEND DEPENDENCIES_INCLUDE_DIRS "${PKGCONFIG_INCLUDE_DIR}") list(APPEND DEPENDENCIES_INCLUDE_DIRS "${PKGCONFIG_INCLUDE_DIR}/osrm") JOIN("-I${DEPENDENCIES_INCLUDE_DIRS}" " -I" PKGCONFIG_OSRM_INCLUDE_FLAGS) -JOIN("${ENGINE_LIBRARIES}" " " PKGCONFIG_OSRM_DEPENDENT_LIBRARIES) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/pkgconfig.in libosrm.pc @ONLY) +# Boost uses imported targets, we need to use a generator expression to extract +# the link libraries to be written to the pkg-config file. +foreach(engine_lib ${ENGINE_LIBRARIES}) + if("${engine_lib}" MATCHES "^Boost.*") + list(APPEND PKGCONFIG_DEPENDENT_LIBRARIES "$") + else() + list(APPEND PKGCONFIG_DEPENDENT_LIBRARIES "${engine_lib}") + endif() +endforeach(engine_lib) +JOIN("${PKGCONFIG_DEPENDENT_LIBRARIES}" " " PKGCONFIG_OSRM_DEPENDENT_LIBRARIES) + +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/pkgconfig.in pkgconfig.configured @ONLY) +file(GENERATE + OUTPUT + ${PROJECT_BINARY_DIR}/libosrm.pc + INPUT + ${PROJECT_BINARY_DIR}/pkgconfig.configured) + install(FILES ${PROJECT_BINARY_DIR}/libosrm.pc DESTINATION ${PKGCONFIG_LIBRARY_DIR}/pkgconfig) # uninstall target From f1a6056953bd990233c2f94e972d456c910bcfe9 Mon Sep 17 00:00:00 2001 From: Michael Bell Date: Sun, 29 Aug 2021 20:35:22 +0100 Subject: [PATCH 12/13] Immediately close bad connections to prevent file exhaustion osrm-routed does not immediately clean up a keep-alive connection when the client closes it. Instead it waits for five seconds of inactivity before removing. Given a setup with low file limits and clients opening and closing a lot of keep-alive connections, it's possible for osrm-routed to run out of file descriptors whilst it waits for the clean-up to trigger. Furthermore, this causes the connection acceptor loop to exit. Even after the old connections are cleaned up, new ones will not be created. Any new requests will block until the server is restarted. This commit improves the situation by: - Immediately closing connections on error. This includes EOF errors indicating that the client has closed the connection. This releases resources early (including the open file) and doesn't wait for the timer. - Log when the acceptor loop exits. Whilst this means the behaviour can still occur for reasons other than too many open files, we will at least have visibility of the cause and can investigate further. --- CHANGELOG.md | 1 + include/server/server.hpp | 4 ++++ src/server/connection.cpp | 16 +++++++++++++--- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1037c5109..0bcf36c0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ - Changes from 5.25.0 - API: - FIXED: Allow for special characters in the profile/method as part of the HTTP URL. [#6090](https://github.com/Project-OSRM/osrm-backend/pull/6090) + - FIXED: Set osrm-routed to immediately close bad connections [#6112](https://github.com/Project-OSRM/osrm-backend/pull/6112) - Build: - CHANGED: Replace Travis with Github Actions for CI builds [#6071](https://github.com/Project-OSRM/osrm-backend/pull/6071) - FIXED: Fixed Boost link flags in pkg-config file. [#6083](https://github.com/Project-OSRM/osrm-backend/pull/6083) diff --git a/include/server/server.hpp b/include/server/server.hpp index 53098fa61..06d2ec8e9 100644 --- a/include/server/server.hpp +++ b/include/server/server.hpp @@ -101,6 +101,10 @@ class Server new_connection->socket(), boost::bind(&Server::HandleAccept, this, boost::asio::placeholders::error)); } + else + { + util::Log(logERROR) << "HandleAccept error: " << e.message(); + } } unsigned thread_pool_size; diff --git a/src/server/connection.cpp b/src/server/connection.cpp index d6441977f..31fed90e8 100644 --- a/src/server/connection.cpp +++ b/src/server/connection.cpp @@ -3,13 +3,10 @@ #include "server/request_parser.hpp" #include -#include #include #include #include -#include -#include #include namespace osrm @@ -48,6 +45,12 @@ void Connection::handle_read(const boost::system::error_code &error, std::size_t { if (error) { + if (error != boost::asio::error::operation_aborted) + { + // Error not triggered by timer expiry, commence connection shutdown. + util::Log(logDEBUG) << "Connection read error: " << error.message(); + handle_shutdown(); + } return; } @@ -73,6 +76,7 @@ void Connection::handle_read(const boost::system::error_code &error, std::size_t current_request.endpoint = TCP_socket.remote_endpoint(ec).address(); if (ec) { + util::Log(logDEBUG) << "Socket remote endpoint error: " << ec.message(); handle_shutdown(); return; } @@ -165,6 +169,10 @@ void Connection::handle_write(const boost::system::error_code &error) handle_shutdown(); } } + else + { + util::Log(logDEBUG) << "Connection write error: " << error.message(); + } } /// Handle completion of a timeout timer.. @@ -183,6 +191,8 @@ void Connection::handle_timeout(boost::system::error_code ec) void Connection::handle_shutdown() { + // Cancel timer to ensure all resources are released immediately on shutdown. + timer.cancel(); // Initiate graceful connection closure. boost::system::error_code ignore_error; TCP_socket.shutdown(boost::asio::ip::tcp::socket::shutdown_both, ignore_error); From 8e100ea1a019bff099cc9b8b15c5b4c0da0d2f35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Faruk=20=C3=96zdemir?= <44067394+FarukOzderim@users.noreply.github.com> Date: Sat, 4 Sep 2021 14:33:10 +0300 Subject: [PATCH 13/13] Update api.md (#6054) * Update api.md alternatives_count was missing in this document, Copied from here: https://github.com/Project-OSRM/osrm-backend/blob/master/docs/http.md#waypoint-object --- docs/nodejs/api.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/nodejs/api.md b/docs/nodejs/api.md index 9bff3ada8..72b463f0b 100644 --- a/docs/nodejs/api.md +++ b/docs/nodejs/api.md @@ -244,9 +244,16 @@ osrm.match(options, function(err, response) { Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** containing `tracepoints` and `matchings`. **`tracepoints`** Array of [`Ẁaypoint`](#waypoint) objects representing all points of the trace in order. If the trace point was ommited by map matching because it is an outlier, the entry will be null. - Each `Waypoint` object includes two additional properties, 1) `matchings_index`: Index to the - [`Route`](#route) object in matchings the sub-trace was matched to, 2) `waypoint_index`: Index of + Each `Waypoint` object has the following additional properties, + + 1) `matchings_index`: Index to the + [`Route`](#route) object in matchings the sub-trace was matched to, + + 2) `waypoint_index`: Index of the waypoint inside the matched route. + + 3) `alternatives_count`: Number of probable alternative matchings for this trace point. A value of zero indicate that this point was matched unambiguously. Split the trace at these points for incremental map matching. + **`matchings`** is an array of [`Route`](#route) objects that assemble the trace. Each `Route` object has an additional `confidence` property, which is the confidence of the matching. float value between `0` and `1`. `1` is very confident that the matching is correct.