Skip to content

Commit 8190a30

Browse files
wip
1 parent 66df8f5 commit 8190a30

File tree

1 file changed

+174
-174
lines changed

1 file changed

+174
-174
lines changed

.github/workflows/osrm-backend.yml

Lines changed: 174 additions & 174 deletions
Original file line numberDiff line numberDiff line change
@@ -23,154 +23,154 @@ concurrency:
2323
cancel-in-progress: true
2424

2525
jobs:
26-
# windows-release-node:
27-
# #needs: format-taginfo-docs
28-
# runs-on: windows-2022
29-
# continue-on-error: false
30-
# env:
31-
# BUILD_TYPE: Release
32-
# steps:
33-
# - uses: actions/checkout@v4
34-
# - run: cmake --version
35-
# - uses: actions/setup-node@v4
36-
# with:
37-
# node-version: 18
38-
# - run: node --version
39-
# - run: npm --version
40-
# - name: Prepare environment
41-
# shell: bash
42-
# run: |
43-
# PACKAGE_JSON_VERSION=$(node -e "console.log(require('./package.json').version)")
44-
# echo PUBLISH=$([[ "${GITHUB_REF:-}" == "refs/tags/v${PACKAGE_JSON_VERSION}" ]] && echo "On" || echo "Off") >> $GITHUB_ENV
45-
# - run: npm install --ignore-scripts
46-
# - run: npm link --ignore-scripts
47-
# - name: Build
48-
# shell: bash
49-
# run: |
50-
# mkdir build
51-
# cd build
52-
53-
# python3 -m venv .venv
54-
55-
# source .venv/Scripts/Activate
56-
57-
# python3 -m pip install conan==2.7.1
58-
59-
# conan profile detect --force
60-
61-
# conan install .. --output-folder=. --build=missing --settings compiler.cppstd=20
62-
63-
# ls -la
64-
65-
# cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_CONAN=ON -DENABLE_NODE_BINDINGS=ON -DCMAKE_TOOLCHAIN_FILE=./conan_toolchain.cmake ..
66-
# cmake --build . --config Release
26+
windows-release-node:
27+
#needs: format-taginfo-docs
28+
runs-on: windows-2022
29+
continue-on-error: false
30+
env:
31+
BUILD_TYPE: Release
32+
steps:
33+
- uses: actions/checkout@v4
34+
- run: cmake --version
35+
- uses: actions/setup-node@v4
36+
with:
37+
node-version: 18
38+
- run: node --version
39+
- run: npm --version
40+
- name: Prepare environment
41+
shell: bash
42+
run: |
43+
PACKAGE_JSON_VERSION=$(node -e "console.log(require('./package.json').version)")
44+
echo PUBLISH=$([[ "${GITHUB_REF:-}" == "refs/tags/v${PACKAGE_JSON_VERSION}" ]] && echo "On" || echo "Off") >> $GITHUB_ENV
45+
- run: npm install --ignore-scripts
46+
- run: npm link --ignore-scripts
47+
- name: Build
48+
shell: bash
49+
run: |
50+
mkdir build
51+
cd build
52+
53+
python3 -m venv .venv
54+
55+
source .venv/Scripts/Activate
56+
57+
python3 -m pip install conan==2.7.1
58+
59+
conan profile detect --force
60+
61+
# conan install .. --output-folder=. --build=missing --settings compiler.cppstd=20
62+
63+
# ls -la
64+
65+
cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_CONAN=ON -DENABLE_NODE_BINDINGS=ON ..
66+
cmake --build . --config Release
6767
68-
# # TODO: MSVC goes out of memory when building our tests
69-
# # - name: Run tests
70-
# # shell: bash
71-
# # run: |
72-
# # cd build
73-
# # cmake --build . --config Release --target tests
74-
# # # TODO: run tests
75-
# # - name: Run node tests
76-
# # shell: bash
77-
# # run: |
78-
# # ./lib/binding/osrm-extract.exe -p profiles/car.lua test/data/monaco.osm.pbf
79-
80-
# # mkdir -p test/data/ch
81-
# # cp test/data/monaco.osrm* test/data/ch/
82-
# # ./lib/binding/osrm-contract.exe test/data/ch/monaco.osrm
83-
84-
# # ./lib/binding/osrm-datastore.exe test/data/ch/monaco.osrm
85-
# # node test/nodejs/index.js
86-
# - name: Build Node package
87-
# shell: bash
88-
# run: ./scripts/ci/node_package.sh
89-
# - name: Publish Node package
90-
# if: ${{ env.PUBLISH == 'On' }}
91-
# uses: ncipollo/release-action@v1
92-
# with:
93-
# allowUpdates: true
94-
# artifactErrorsFailBuild: true
95-
# artifacts: build/stage/**/*.tar.gz
96-
# omitBody: true
97-
# omitBodyDuringUpdate: true
98-
# omitName: true
99-
# omitNameDuringUpdate: true
100-
# replacesArtifacts: true
101-
# token: ${{ secrets.GITHUB_TOKEN }}
102-
103-
# format-taginfo-docs:
104-
# runs-on: ubuntu-22.04
105-
# steps:
106-
# - uses: actions/checkout@v4
107-
# - name: Use Node.js
108-
# uses: actions/setup-node@v4
109-
# with:
110-
# node-version: 18
111-
# - name: Enable Node.js cache
112-
# uses: actions/cache@v4
113-
# with:
114-
# path: ~/.npm
115-
# key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
116-
# restore-keys: |
117-
# ${{ runner.os }}-node-
118-
# - name: Prepare environment
119-
# run: |
120-
# npm ci --ignore-scripts
121-
# clang-format-15 --version
122-
# - name: Run checks
123-
# run: |
124-
# ./scripts/check_taginfo.py taginfo.json profiles/car.lua
125-
# ./scripts/format.sh && ./scripts/error_on_dirty.sh
126-
# node ./scripts/validate_changelog.js
127-
# npm run docs && ./scripts/error_on_dirty.sh
128-
# npm audit --production
129-
130-
# docker-image-matrix:
131-
# strategy:
132-
# matrix:
133-
# docker-base-image: ["debian", "alpine"]
134-
# needs: format-taginfo-docs
135-
# runs-on: ubuntu-22.04
136-
# continue-on-error: false
137-
# steps:
138-
# - name: Check out the repo
139-
# uses: actions/checkout@v4
140-
# - name: Enable osm.pbf cache
141-
# uses: actions/cache@v4
142-
# with:
143-
# path: berlin-latest.osm.pbf
144-
# key: v1-berlin-osm-pbf
145-
# restore-keys: |
146-
# v1-berlin-osm-pbf
147-
# - name: Docker build
148-
# run: |
149-
# docker build -t osrm-backend-local -f docker/Dockerfile-${{ matrix.docker-base-image }} .
150-
# - name: Test Docker image
151-
# run: |
152-
# if [ ! -f "${PWD}/berlin-latest.osm.pbf" ]; then
153-
# wget http://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf
154-
# fi
155-
# TAG=osrm-backend-local
156-
# # when `--memory-swap` value equals `--memory` it means container won't use swap
157-
# # see https://docs.docker.com/config/containers/resource_constraints/#--memory-swap-details
158-
# MEMORY_ARGS="--memory=1g --memory-swap=1g"
159-
# docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-extract --dump-nbg-graph -p /opt/car.lua /data/berlin-latest.osm.pbf
160-
# docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-components /data/berlin-latest.osrm.nbg /data/berlin-latest.geojson
161-
# if [ ! -s "${PWD}/berlin-latest.geojson" ]
162-
# then
163-
# >&2 echo "No berlin-latest.geojson found"
164-
# exit 1
165-
# fi
166-
# # removing `.osrm.nbg` to check that whole pipeline works without it
167-
# rm -rf "${PWD}/berlin-latest.osrm.nbg"
68+
# TODO: MSVC goes out of memory when building our tests
69+
# - name: Run tests
70+
# shell: bash
71+
# run: |
72+
# cd build
73+
# cmake --build . --config Release --target tests
74+
# # TODO: run tests
75+
# - name: Run node tests
76+
# shell: bash
77+
# run: |
78+
# ./lib/binding/osrm-extract.exe -p profiles/car.lua test/data/monaco.osm.pbf
16879

169-
# docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-partition /data/berlin-latest.osrm
170-
# docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-customize /data/berlin-latest.osrm
171-
# docker run $MEMORY_ARGS --name=osrm-container -t -p 5000:5000 -v "${PWD}:/data" "${TAG}" osrm-routed --algorithm mld /data/berlin-latest.osrm &
172-
# 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"
173-
# docker stop osrm-container
80+
# mkdir -p test/data/ch
81+
# cp test/data/monaco.osrm* test/data/ch/
82+
# ./lib/binding/osrm-contract.exe test/data/ch/monaco.osrm
83+
84+
# ./lib/binding/osrm-datastore.exe test/data/ch/monaco.osrm
85+
# node test/nodejs/index.js
86+
- name: Build Node package
87+
shell: bash
88+
run: ./scripts/ci/node_package.sh
89+
- name: Publish Node package
90+
if: ${{ env.PUBLISH == 'On' }}
91+
uses: ncipollo/release-action@v1
92+
with:
93+
allowUpdates: true
94+
artifactErrorsFailBuild: true
95+
artifacts: build/stage/**/*.tar.gz
96+
omitBody: true
97+
omitBodyDuringUpdate: true
98+
omitName: true
99+
omitNameDuringUpdate: true
100+
replacesArtifacts: true
101+
token: ${{ secrets.GITHUB_TOKEN }}
102+
103+
format-taginfo-docs:
104+
runs-on: ubuntu-22.04
105+
steps:
106+
- uses: actions/checkout@v4
107+
- name: Use Node.js
108+
uses: actions/setup-node@v4
109+
with:
110+
node-version: 18
111+
- name: Enable Node.js cache
112+
uses: actions/cache@v4
113+
with:
114+
path: ~/.npm
115+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
116+
restore-keys: |
117+
${{ runner.os }}-node-
118+
- name: Prepare environment
119+
run: |
120+
npm ci --ignore-scripts
121+
clang-format-15 --version
122+
- name: Run checks
123+
run: |
124+
./scripts/check_taginfo.py taginfo.json profiles/car.lua
125+
./scripts/format.sh && ./scripts/error_on_dirty.sh
126+
node ./scripts/validate_changelog.js
127+
npm run docs && ./scripts/error_on_dirty.sh
128+
npm audit --production
129+
130+
docker-image-matrix:
131+
strategy:
132+
matrix:
133+
docker-base-image: ["debian", "alpine"]
134+
needs: format-taginfo-docs
135+
runs-on: ubuntu-22.04
136+
continue-on-error: false
137+
steps:
138+
- name: Check out the repo
139+
uses: actions/checkout@v4
140+
- name: Enable osm.pbf cache
141+
uses: actions/cache@v4
142+
with:
143+
path: berlin-latest.osm.pbf
144+
key: v1-berlin-osm-pbf
145+
restore-keys: |
146+
v1-berlin-osm-pbf
147+
- name: Docker build
148+
run: |
149+
docker build -t osrm-backend-local -f docker/Dockerfile-${{ matrix.docker-base-image }} .
150+
- name: Test Docker image
151+
run: |
152+
if [ ! -f "${PWD}/berlin-latest.osm.pbf" ]; then
153+
wget http://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf
154+
fi
155+
TAG=osrm-backend-local
156+
# when `--memory-swap` value equals `--memory` it means container won't use swap
157+
# see https://docs.docker.com/config/containers/resource_constraints/#--memory-swap-details
158+
MEMORY_ARGS="--memory=1g --memory-swap=1g"
159+
docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-extract --dump-nbg-graph -p /opt/car.lua /data/berlin-latest.osm.pbf
160+
docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-components /data/berlin-latest.osrm.nbg /data/berlin-latest.geojson
161+
if [ ! -s "${PWD}/berlin-latest.geojson" ]
162+
then
163+
>&2 echo "No berlin-latest.geojson found"
164+
exit 1
165+
fi
166+
# removing `.osrm.nbg` to check that whole pipeline works without it
167+
rm -rf "${PWD}/berlin-latest.osrm.nbg"
168+
169+
docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-partition /data/berlin-latest.osrm
170+
docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-customize /data/berlin-latest.osrm
171+
docker run $MEMORY_ARGS --name=osrm-container -t -p 5000:5000 -v "${PWD}:/data" "${TAG}" osrm-routed --algorithm mld /data/berlin-latest.osrm &
172+
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"
173+
docker stop osrm-container
174174
175175
build-test-publish:
176176
#needs: format-taginfo-docs
@@ -387,34 +387,34 @@ jobs:
387387
uses: actions/setup-node@v4
388388
with:
389389
node-version: ${{ matrix.node }}
390-
# - name: Enable Node.js cache
391-
# uses: actions/cache@v4
392-
# with:
393-
# path: ~/.npm
394-
# key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
395-
# restore-keys: |
396-
# ${{ runner.os }}-node-
397-
# - name: Enable compiler cache
398-
# uses: actions/cache@v4
399-
# with:
400-
# path: ~/.ccache
401-
# key: ccache-${{ matrix.name }}-${{ github.sha }}
402-
# restore-keys: |
403-
# ccache-${{ matrix.name }}-
404-
# - name: Enable Conan cache
405-
# uses: actions/cache@v4
406-
# with:
407-
# path: ~/.conan2
408-
# key: v10-conan-${{ matrix.name }}-${{ github.sha }}
409-
# restore-keys: |
410-
# v10-conan-${{ matrix.name }}-
411-
# - name: Enable test cache
412-
# uses: actions/cache@v4
413-
# with:
414-
# path: ${{github.workspace}}/test/cache
415-
# key: v4-test-${{ matrix.name }}-${{ github.sha }}
416-
# restore-keys: |
417-
# v4-test-${{ matrix.name }}-
390+
- name: Enable Node.js cache
391+
uses: actions/cache@v4
392+
with:
393+
path: ~/.npm
394+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
395+
restore-keys: |
396+
${{ runner.os }}-node-
397+
- name: Enable compiler cache
398+
uses: actions/cache@v4
399+
with:
400+
path: ~/.ccache
401+
key: ccache-${{ matrix.name }}-${{ github.sha }}
402+
restore-keys: |
403+
ccache-${{ matrix.name }}-
404+
- name: Enable Conan cache
405+
uses: actions/cache@v4
406+
with:
407+
path: ~/.conan2
408+
key: v10-conan-${{ matrix.name }}-${{ github.sha }}
409+
restore-keys: |
410+
v10-conan-${{ matrix.name }}-
411+
- name: Enable test cache
412+
uses: actions/cache@v4
413+
with:
414+
path: ${{github.workspace}}/test/cache
415+
key: v4-test-${{ matrix.name }}-${{ github.sha }}
416+
restore-keys: |
417+
v4-test-${{ matrix.name }}-
418418
- name: Prepare environment
419419
run: |
420420
echo "CCACHE_DIR=$HOME/.ccache" >> $GITHUB_ENV

0 commit comments

Comments
 (0)