-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
feat: integrate https://github.com/nilsnolde/osrm-bindings #7485
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7458ee1
d4e62f9
9fe055b
77de8bd
a752d92
e16b525
54ec941
0dd6b0d
91855bc
cfa1065
3f3e452
3713f44
2493aeb
d2f5e1a
a3d2ef7
da8e068
ab38ab8
3c5770f
062c020
216bc0d
7dbde9a
427b420
a1209b0
89b2322
636123b
f932c2e
1a6c95a
a964f66
74a9b4d
63c50f1
e203d40
5f713d0
4ccad42
25d54d4
f26f848
1f3c201
c958bf5
b57cd7b
54b9347
7eed6d3
ddd0a44
ee44b63
a1ba443
17174d1
e5a1e6c
6bacda3
b08cf08
d58f146
f86e062
b361809
9ab861d
5b8412d
2bcb003
b65c287
760b656
75d1b9c
0e5dac4
89e2d35
ccf96bb
a6ade64
c7fcf89
246dddb
38d3d78
7294070
5717e5e
307b0a5
708670d
8a08909
f9f54a6
bdaa43d
e926d2b
4ed0a95
1920ce0
b22002b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,10 +30,13 @@ concurrency: | |
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| vcpkg-windows-release-node: | ||
| vcpkg-windows-release-bindings: | ||
| needs: format-taginfo-docs | ||
| strategy: | ||
| matrix: | ||
| os: [windows-2025] | ||
| runs-on: ${{ matrix.os }} | ||
| if: github.repository == 'Project-OSRM/osrm-backend' | ||
| runs-on: windows-2025 | ||
| continue-on-error: false | ||
| env: | ||
| BUILD_TYPE: Release | ||
|
|
@@ -49,9 +52,9 @@ jobs: | |
| uses: actions/cache@v5 | ||
| with: | ||
| path: ${{ github.workspace }}/.vcpkg-bincache | ||
| key: vcpkg-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('vcpkg.json', 'vcpkg-configuration.json', 'vcpkg-overlay-ports/**') }} | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. was copy/paste error I guess |
||
| key: vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json', 'vcpkg-configuration.json', 'vcpkg-overlay-ports/**') }} | ||
| restore-keys: | | ||
| vcpkg-${{ runner.os }}-${{ runner.arch }}- | ||
| vcpkg-${{ runner.os }}- | ||
| - name: Setup vcpkg | ||
| uses: lukka/run-vcpkg@v11 | ||
| with: | ||
|
|
@@ -64,9 +67,17 @@ jobs: | |
| 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 | ||
| # cibuildwheel parses [tool.cibuildwheel.windows].environment in | ||
| # pyproject.toml as bash export statements. lukka/run-vcpkg sets | ||
| # VCPKG_ROOT with native backslashes (D:\a\...), and bash eats those | ||
| # as escapes during $VAR expansion, mangling CMAKE_TOOLCHAIN_FILE | ||
| # into "D:aosrm-backend...". Rewrite with forward slashes — CMake | ||
| # accepts both separators on Windows. | ||
| echo "VCPKG_ROOT=${VCPKG_ROOT//\\//}" >> "$GITHUB_ENV" | ||
| - run: npm install --ignore-scripts | ||
| - run: npm link --ignore-scripts | ||
| - name: Build | ||
| id: build | ||
| shell: bash | ||
| run: | | ||
| cmake --preset ci-windows -DENABLE_NODE_BINDINGS=ON | ||
|
|
@@ -106,6 +117,22 @@ jobs: | |
| omitNameDuringUpdate: true | ||
| replacesArtifacts: true | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Run CIBuildWheel | ||
| if: github.event_name != 'pull_request' | ||
| uses: pypa/cibuildwheel@v3.4.0 | ||
| with: | ||
| output-dir: dist | ||
| # The wheel-build CMAKE_ARGS (vcpkg toolchain + triplet) and the | ||
| # delvewheel --add-path for vcpkg-installed runtime DLLs live in | ||
| # [tool.cibuildwheel.windows] in pyproject.toml. VCPKG_ROOT is | ||
| # exported by lukka/run-vcpkg above and inherited by cibuildwheel. | ||
| - name: Upload Windows wheel | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. release-monthly.yml publishes the wheels |
||
| if: startsWith(github.ref, 'refs/tags/v') | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: wheels-windows | ||
| path: dist/*.whl | ||
| if-no-files-found: error | ||
|
|
||
| format-taginfo-docs: | ||
| if: github.repository == 'Project-OSRM/osrm-backend' | ||
|
|
@@ -129,6 +156,11 @@ jobs: | |
| sudo apt-get install -y clang-format-18 | ||
| npm ci --ignore-scripts | ||
| clang-format-18 --version | ||
| - uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: '3.12' | ||
|
DennisOSRM marked this conversation as resolved.
|
||
| - name: Run `pre-commit` | ||
| uses: pre-commit/action@v3.0.1 | ||
| - name: Run checks | ||
| run: | | ||
| ./scripts/check_taginfo.py taginfo.json profiles/car.lua | ||
|
|
@@ -314,8 +346,8 @@ jobs: | |
| CXXCOMPILER: g++-12 | ||
| CXXFLAGS: '-Wno-array-bounds -Wno-uninitialized' | ||
|
|
||
| - name: vcpkg-linux-release-node | ||
| build_node_package: true | ||
| - name: vcpkg-linux-release-bindings | ||
| build_bindings: true | ||
| continue-on-error: false | ||
| node: 24 | ||
| runs-on: ubuntu-24.04 | ||
|
|
@@ -324,8 +356,7 @@ jobs: | |
| CXXCOMPILER: clang++-16 | ||
| NODE_PACKAGE_TESTS_ONLY: ON | ||
|
|
||
| - name: vcpkg-linux-debug-node | ||
| build_node_package: true | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is there a reason why debug was used to build the node package?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure. Might have been an oversight |
||
| - name: vcpkg-linux-debug | ||
| continue-on-error: false | ||
| node: 24 | ||
| runs-on: ubuntu-24.04 | ||
|
|
@@ -343,8 +374,7 @@ jobs: | |
| CXXCOMPILER: clang++-18 | ||
| ENABLE_LTO: OFF | ||
|
|
||
| - name: vcpkg-macos-x64-release-node | ||
| build_node_package: true | ||
| - name: vcpkg-macos-x64-release | ||
| continue-on-error: true | ||
| node: 24 | ||
| runs-on: macos-26-intel # x86_64 | ||
|
|
@@ -353,8 +383,7 @@ jobs: | |
| CXXCOMPILER: clang++ | ||
| ENABLE_ASSERTIONS: ON | ||
|
|
||
| - name: vcpkg-macos-arm64-release-node | ||
| build_node_package: true | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. both node & python packages are now built on lower macos-15. for python it's kinda necessary for ABI compat, not sure about node, but it can't hurt either. |
||
| - name: vcpkg-macos-arm64-release | ||
| continue-on-error: true | ||
| node: 24 | ||
| runs-on: macos-26 # arm64 | ||
|
|
@@ -363,6 +392,27 @@ jobs: | |
| CXXCOMPILER: clang++ | ||
| ENABLE_ASSERTIONS: ON | ||
|
|
||
| # only for python & nodeJS release, needs a low macos version | ||
| - name: vcpkg-macos-x64-release-bindings | ||
| build_bindings: true | ||
| continue-on-error: true | ||
| node: 24 | ||
| runs-on: macos-15-intel # x86_64 | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the python bindings (and the node ones as well maybe? didn't look) prefer the oldest OS version we can build on, so the widest range of OSs are compatible (same story for linux, where we build on glibc 2.28, current 2.43). should I create a new job for macos-26 so we cover both min & max? (also creates more CI tension for concurrent branches)
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should probably need an additional job for this |
||
| BUILD_TYPE: Release | ||
| CCOMPILER: clang | ||
| CXXCOMPILER: clang++ | ||
| ENABLE_ASSERTIONS: ON | ||
|
|
||
| - name: vcpkg-macos-arm64-release-bindings | ||
| build_bindings: true | ||
| continue-on-error: true | ||
| node: 24 | ||
| runs-on: macos-15 # arm64 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. similarly the macos-26 job should stay unchanged |
||
| BUILD_TYPE: Release | ||
| CCOMPILER: clang | ||
| CXXCOMPILER: clang++ | ||
| ENABLE_ASSERTIONS: ON | ||
|
|
||
| name: ${{ matrix.name}} | ||
| continue-on-error: ${{ matrix.continue-on-error }} | ||
| runs-on: ${{ matrix.runs-on }} | ||
|
|
@@ -382,8 +432,11 @@ jobs: | |
| OSRM_CONNECTION_RETRIES: ${{ matrix.OSRM_CONNECTION_RETRIES }} | ||
| OSRM_CONNECTION_EXP_BACKOFF_COEF: ${{ matrix.OSRM_CONNECTION_EXP_BACKOFF_COEF }} | ||
| ENABLE_LTO: ${{ matrix.ENABLE_LTO }} | ||
| BUILD_BINDINGS: ${{ matrix.build_bindings }} | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| fetch-tags: true | ||
| - name: Build machine architecture | ||
| run: uname -m | ||
| - name: Use Node.js | ||
|
|
@@ -397,8 +450,9 @@ jobs: | |
| key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-node- | ||
| - name: Enable compiler cache | ||
| uses: actions/cache@v5 | ||
| - name: Restore compiler cache | ||
| id: ccache-restore | ||
| uses: actions/cache/restore@v5 | ||
|
Comment on lines
-400
to
+455
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I split these up into restore/save to have more control which cache doesn't get uploaded (unsuccessful build stage) |
||
| with: | ||
| path: ~/.ccache | ||
| key: ccache-${{ matrix.name }}-${{ github.sha }} | ||
|
|
@@ -467,16 +521,15 @@ jobs: | |
| fi | ||
| echo "CC=${CCOMPILER}" >> $GITHUB_ENV | ||
| echo "CXX=${CXXCOMPILER}" >> $GITHUB_ENV | ||
| if [[ "${RUNNER_OS}" == "macOS" ]]; then | ||
| # missing from GCC path, needed when vcpkg builds libiconv, etc. | ||
| sudo xcode-select --switch /Library/Developer/CommandLineTools | ||
| echo "LIBRARY_PATH=${LIBRARY_PATH}:/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib" >> $GITHUB_ENV | ||
| echo "CPATH=${CPATH}:/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include" >> $GITHUB_ENV | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this created all kinds of problems with reproducible tool chain setups. I tried removing it and the problems went away. |
||
| fi | ||
|
|
||
| - name: Build and install OSRM | ||
| id: build | ||
| run: | | ||
| echo "Using ${JOBS} jobs" | ||
| # so vcpkg's bincache is consistent with cibuildwheel (python bindings) | ||
| if [[ "${RUNNER_OS}" == "macOS" && "${BUILD_BINDINGS}" == "true" ]]; then | ||
| export MACOSX_DEPLOYMENT_TARGET=15.0 | ||
| fi | ||
| pushd ${OSRM_BUILD_DIR} | ||
|
|
||
| ccache --zero-stats | ||
|
|
@@ -562,10 +615,10 @@ jobs: | |
| path: test/logs/ | ||
|
|
||
| - name: Build Node package | ||
| if: ${{ matrix.build_node_package }} | ||
| if: ${{ env.BUILD_BINDINGS }} | ||
| run: ./scripts/ci/node_package.sh | ||
| - name: Publish Node package | ||
| if: ${{ matrix.build_node_package && env.PUBLISH == 'On' }} | ||
| if: ${{ env.BUILD_BINDINGS && env.PUBLISH == 'On' }} | ||
| uses: ncipollo/release-action@v1 | ||
| with: | ||
| allowUpdates: true | ||
|
|
@@ -577,14 +630,116 @@ jobs: | |
| omitNameDuringUpdate: true | ||
| replacesArtifacts: true | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| # Python bindings | ||
|
|
||
| - name: Set up Python | ||
| if: ${{ env.BUILD_BINDINGS }} | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.12" | ||
|
|
||
| - name: Build sdist | ||
| if: ${{ env.BUILD_BINDINGS && runner.os == 'Linux' }} | ||
| run: | | ||
| python -m pip install build | ||
| python -m build --sdist | ||
|
|
||
| - name: Locate sdist | ||
| if: ${{ env.BUILD_BINDINGS && runner.os == 'Linux' }} | ||
| id: sdist | ||
| shell: bash | ||
| run: echo "path=$(ls dist/*.tar.gz | head -n1)" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Run cibuildwheel | ||
| uses: pypa/cibuildwheel@v3.4.1 | ||
| if: ${{ env.BUILD_BINDINGS }} | ||
| with: | ||
| # for linux build the wheel from the sdist | ||
| package-dir: ${{ runner.os == 'Linux' && steps.sdist.outputs.path || '.' }} | ||
| output-dir: dist | ||
| env: | ||
| # The full Linux env (LD_LIBRARY_PATH, CCACHE_DIR, CMAKE_ARGS for the | ||
| # vcpkg toolchain) lives in [tool.cibuildwheel.linux].environment in | ||
| # pyproject.toml. Setting CIBW_ENVIRONMENT_LINUX here would *replace* | ||
| # that whole block (cibuildwheel doesn't merge), so we don't. | ||
| CIBW_CONTAINER_ENGINE: "docker; create_args: --volume /home/runner/.ccache:/ccache" | ||
| CIBW_CONFIG_SETTINGS_MACOS: "cmake.define.CMAKE_CXX_COMPILER_LAUNCHER=ccache cmake.define.CMAKE_C_COMPILER_LAUNCHER=ccache" | ||
|
|
||
| - name: Upload wheels and sdist | ||
| if: ${{ env.BUILD_BINDINGS && env.PUBLISH == 'On' }} | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: wheels-${{ matrix.name }} | ||
| path: | | ||
| dist/*.whl | ||
| dist/*.tar.gz | ||
| if-no-files-found: error | ||
|
|
||
| - name: Upload Linux wheel for stub check | ||
| if: ${{ env.BUILD_BINDINGS && runner.os == 'Linux' && github.event_name == 'pull_request' }} | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: wheel-linux-stub-check | ||
| path: dist/*.whl | ||
| if-no-files-found: error | ||
| retention-days: 1 | ||
|
|
||
| - name: Show CCache statistics | ||
| run: | | ||
| ccache -p | ||
| ccache -s | ||
|
|
||
| # Verify that committed .pyi stubs match the actual C++ bindings when Python | ||
| # C++ sources changed. Installs the Linux wheel built by build-matrix, | ||
| # regenerates stubs via nanobind, ruff-formats them, and diffs against the repo. | ||
| check-python-stubs: | ||
| name: Check Python stubs are up to date | ||
| needs: build-matrix | ||
| if: github.event_name == 'pull_request' | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - uses: dorny/paths-filter@v3 | ||
| id: changes | ||
| with: | ||
| filters: | | ||
| python_cpp: | ||
| - 'src/python/src/**' | ||
| - 'src/python/include/**' | ||
| - 'src/python/CMakeLists.txt' | ||
| - uses: actions/setup-python@v6 | ||
|
Comment on lines
+707
to
+711
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. only run the actual check if this file filter is true for changed files |
||
| if: steps.changes.outputs.python_cpp == 'true' | ||
| with: | ||
| python-version: '3.12' | ||
| - uses: actions/download-artifact@v4 | ||
| if: steps.changes.outputs.python_cpp == 'true' | ||
| with: | ||
| name: wheel-linux-stub-check | ||
| path: wheelhouse | ||
| - name: Install wheel and regenerate stubs | ||
| if: steps.changes.outputs.python_cpp == 'true' | ||
| run: | | ||
| pip install nanobind ruff | ||
| pip install wheelhouse/*.whl | ||
| python -m nanobind.stubgen -m osrm.osrm_ext -o src/python/osrm/osrm_ext.pyi | ||
| ruff format src/python/osrm/osrm_ext.pyi | ||
| - name: Check for differences | ||
| if: steps.changes.outputs.python_cpp == 'true' | ||
| run: | | ||
| git diff --exit-code src/python/osrm/osrm_ext.pyi \ | ||
| || (echo "::error::Stubs are out of date. Rebuild locally and commit the updated .pyi file." && exit 1) | ||
|
|
||
| ci-complete: | ||
| runs-on: ubuntu-latest | ||
| <<<<<<< HEAD | ||
| needs: [build-matrix, vcpkg-windows-release-bindings, docker-image-matrix, check-python-stubs] | ||
| ======= | ||
| needs: [build-matrix, vcpkg-windows-release-node, docker-image-matrix] | ||
| if: github.repository == 'Project-OSRM/osrm-backend' | ||
| >>>>>>> origin/master | ||
| steps: | ||
| - name: Fail if any dependency failed | ||
| if: ${{ contains(needs.*.result, 'failure') }} | ||
| run: exit 1 | ||
| - run: echo "CI complete" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,6 +28,10 @@ jobs: | |
| contents: write | ||
| id-token: write | ||
| actions: write | ||
| outputs: | ||
| tag: ${{ steps.version.outputs.tag }} | ||
| version: ${{ steps.version.outputs.version }} | ||
| run_id: ${{ steps.wait_ci.outputs.run_id }} | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
|
|
@@ -178,6 +182,7 @@ jobs: | |
| prerelease: false | ||
|
|
||
| - name: Wait for CI to complete | ||
| id: wait_ci | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: | | ||
|
|
@@ -210,6 +215,7 @@ jobs: | |
| if [ "$STATUS" = "completed" ]; then | ||
| if [ "$CONCLUSION" = "success" ]; then | ||
| echo "✓ CI workflow completed successfully, proceeding with npm publish" | ||
| echo "run_id=$RUN_ID" >> "$GITHUB_OUTPUT" | ||
| exit 0 | ||
| else | ||
| echo "✗ CI workflow completed with conclusion=$CONCLUSION (expected success)" | ||
|
|
@@ -229,9 +235,42 @@ jobs: | |
| echo "✗ Timed out waiting for CI workflow to complete for tag $TAG" | ||
| exit 1 | ||
|
|
||
|
|
||
| publish: | ||
| needs: release | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| ref: ${{ needs.release.outputs.tag }} | ||
|
|
||
| - uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: 24 | ||
| registry-url: 'https://registry.npmjs.org' | ||
|
|
||
| - name: Install dependencies (skip native build scripts) | ||
| run: npm ci --ignore-scripts | ||
|
|
||
| - name: Publish to npm | ||
| run: npm publish | ||
|
|
||
| - name: Download wheels from CI run | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| pattern: wheels-* | ||
| path: dist | ||
| merge-multiple: true | ||
| run-id: ${{ needs.release.outputs.run_id }} | ||
| github-token: ${{ github.token }} | ||
|
|
||
| - name: Publish to PyPI | ||
| uses: pypa/gh-action-pypi-publish@v1.13.0 | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this action only works on a linux runner, so it's another job syncing the wheel artifacts from the osrm-backend.yml run's upload |
||
| with: | ||
| skip-existing: true | ||
| verbose: true | ||
| # repository-url: https://test.pypi.org/legacy/ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just so we can use
${{ matrix.os }}in the cache key, for when we update the runner OS