Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
6ab6564d42 | |||
513966056b | |||
2c91c0c259 | |||
|
c59ad69d6a | ||
|
61464fc2bd | ||
|
6f235cca15 | ||
|
3614af7f64 |
65
.gitea/workflows/publish-container.yaml
Normal file
65
.gitea/workflows/publish-container.yaml
Normal file
@ -0,0 +1,65 @@
|
||||
name: Build and Publish Docker Image
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published, prereleased]
|
||||
|
||||
env:
|
||||
IMAGE_NAME: openharbor/osrm-backend
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
strategy:
|
||||
matrix:
|
||||
docker-base-image: ["debian", "alpine"]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: ${{ env.IMAGE_NAME }}
|
||||
|
||||
- name: Docker meta - debug
|
||||
id: metadebug
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: ${{ env.IMAGE_NAME }}
|
||||
flavor: |
|
||||
latest=true
|
||||
suffix=-debug,onlatest=true
|
||||
|
||||
- name: Log in to DockerHub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
|
||||
|
||||
- name: Build and push debug image
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/riscv64
|
||||
file: ./docker/Dockerfile-${{ matrix.docker-base-image }}
|
||||
tags: ${{ steps.metadebug.outputs.tags }}
|
||||
build-args: |
|
||||
DOCKER_TAG=${{ join(steps.metadebug.outputs.tags) }}-${{ matrix.docker-base-image }}
|
||||
|
||||
- name: Build and push normal image
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/riscv64
|
||||
file: ./docker/Dockerfile-${{ matrix.docker-base-image }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
build-args: |
|
||||
DOCKER_TAG=${{ join(steps.meta.outputs.tags) }}-${{ matrix.docker-base-image }}
|
10
.github/workflows/osrm-backend.yml
vendored
10
.github/workflows/osrm-backend.yml
vendored
@ -446,14 +446,14 @@ jobs:
|
||||
if: steps.cache-boost.outputs.cache-hit != 'true' && runner.os == 'Linux' && matrix.ENABLE_CONAN != 'ON'
|
||||
run: |
|
||||
BOOST_VERSION="1.85.0"
|
||||
BOOST_VERSION_UNDERSCORE="${BOOST_VERSION//./_}"
|
||||
wget -q https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION}/source/boost_${BOOST_VERSION_UNDERSCORE}.tar.gz
|
||||
tar xzf boost_${BOOST_VERSION_UNDERSCORE}.tar.gz
|
||||
cd boost_${BOOST_VERSION_UNDERSCORE}
|
||||
BOOST_VERSION_FLAVOR="${BOOST_VERSION}-b2-nodocs"
|
||||
wget -q https://github.com/boostorg/boost/releases/download/boost-${BOOST_VERSION}/boost-${BOOST_VERSION_FLAVOR}.tar.gz
|
||||
tar xzf boost-${BOOST_VERSION_FLAVOR}.tar.gz
|
||||
cd boost-${BOOST_VERSION}
|
||||
sudo ./bootstrap.sh
|
||||
sudo ./b2 install
|
||||
cd ..
|
||||
sudo rm -rf boost_${BOOST_VERSION_UNDERSCORE}*
|
||||
sudo rm -rf boost-${BOOST_VERSION}*
|
||||
|
||||
- name: Install dev dependencies
|
||||
run: |
|
||||
|
@ -25,6 +25,7 @@
|
||||
- NodeJS:
|
||||
- CHANGED: Use node-api instead of NAN. [#6452](https://github.com/Project-OSRM/osrm-backend/pull/6452)
|
||||
- Misc:
|
||||
- CHANGED: Use std::string_view for key type in json::Object. [#7062](https://github.com/Project-OSRM/osrm-backend/pull/7062)
|
||||
- CHANGED: Use thread_local instead of boost::thread_specific_ptr. [#6991](https://github.com/Project-OSRM/osrm-backend/pull/6991)
|
||||
- CHANGED: Bump flatbuffers to v24.3.25 version. [#6988](https://github.com/Project-OSRM/osrm-backend/pull/6988)
|
||||
- CHANGED: Add .reserve(...) to assembleGeometry function. [#6983](https://github.com/Project-OSRM/osrm-backend/pull/6983)
|
||||
|
@ -56,6 +56,9 @@ endif()
|
||||
if (POLICY CMP0074)
|
||||
cmake_policy(SET CMP0074 NEW)
|
||||
endif()
|
||||
if (POLICY CMP0167)
|
||||
cmake_policy(SET CMP0167 NEW)
|
||||
endif()
|
||||
project(OSRM C CXX)
|
||||
|
||||
|
||||
|
@ -1,20 +1,34 @@
|
||||
FROM alpine:3.20.0 as alpine-mimalloc
|
||||
FROM alpine:3.21.2 AS alpine-mimalloc
|
||||
|
||||
RUN apk add --no-cache mimalloc
|
||||
RUN apk update && \
|
||||
apk upgrade && \
|
||||
apk add --no-cache \
|
||||
boost-iostreams \
|
||||
boost-program_options \
|
||||
boost-thread \
|
||||
mimalloc
|
||||
|
||||
ENV LD_PRELOAD=/usr/lib/libmimalloc.so.2
|
||||
ENV MIMALLOC_LARGE_OS_PAGES=1
|
||||
|
||||
|
||||
FROM alpine-mimalloc as builder
|
||||
FROM alpine-mimalloc AS builder
|
||||
ARG DOCKER_TAG
|
||||
ARG BUILD_CONCURRENCY
|
||||
RUN mkdir -p /src && mkdir -p /opt
|
||||
|
||||
RUN apk add --no-cache \
|
||||
cmake make git clang libbz2 libxml2 \
|
||||
boost-dev boost-program_options boost-filesystem boost-iostreams boost-thread \
|
||||
lua5.4-dev onetbb-dev expat-dev
|
||||
RUN mkdir -p /src /opt && \
|
||||
apk add --no-cache \
|
||||
boost-dev \
|
||||
boost-filesystem \
|
||||
clang \
|
||||
cmake \
|
||||
expat-dev \
|
||||
git \
|
||||
libbz2 \
|
||||
libxml2 \
|
||||
lua5.4-dev \
|
||||
make \
|
||||
onetbb-dev
|
||||
|
||||
COPY . /src
|
||||
WORKDIR /src
|
||||
@ -39,16 +53,18 @@ RUN NPROC=${BUILD_CONCURRENCY:-$(nproc)} && \
|
||||
rm -rf /src
|
||||
|
||||
|
||||
# Multistage build to reduce image size - https://docs.docker.com/engine/userguide/eng-image/multistage-build/#use-multi-stage-builds
|
||||
# Multistage build to reduce image size - https://docs.docker.com/build/building/multi-stage/#use-multi-stage-builds
|
||||
# Only the content below ends up in the image, this helps remove /src from the image (which is large)
|
||||
FROM alpine-mimalloc as runstage
|
||||
FROM alpine-mimalloc AS runstage
|
||||
|
||||
COPY --from=builder /usr/local /usr/local
|
||||
COPY --from=builder /opt /opt
|
||||
|
||||
RUN apk add --no-cache \
|
||||
boost-program_options boost-date_time boost-iostreams boost-thread \
|
||||
expat lua5.4 onetbb && \
|
||||
boost-date_time \
|
||||
expat \
|
||||
lua5.4 \
|
||||
onetbb && \
|
||||
ldconfig /usr/local/lib
|
||||
|
||||
RUN /usr/local/bin/osrm-extract --help && \
|
||||
@ -60,3 +76,4 @@ RUN /usr/local/bin/osrm-extract --help && \
|
||||
WORKDIR /opt
|
||||
|
||||
EXPOSE 5000
|
||||
|
||||
|
@ -1,21 +1,24 @@
|
||||
FROM debian:bookworm-slim as builder
|
||||
FROM debian:bookworm-slim AS builder
|
||||
ARG DOCKER_TAG
|
||||
ARG BUILD_CONCURRENCY
|
||||
RUN mkdir -p /src && mkdir -p /opt
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get -y --no-install-recommends install ca-certificates cmake make git gcc g++ libbz2-dev libxml2-dev wget \
|
||||
libzip-dev libboost1.81-all-dev lua5.4 liblua5.4-dev pkg-config -o APT::Install-Suggests=0 -o APT::Install-Recommends=0
|
||||
|
||||
RUN NPROC=${BUILD_CONCURRENCY:-$(nproc)} && \
|
||||
ldconfig /usr/local/lib && \
|
||||
git clone --branch v2021.12.0 --single-branch https://github.com/oneapi-src/oneTBB.git && \
|
||||
cd oneTBB && \
|
||||
mkdir build && \
|
||||
cd build && \
|
||||
cmake -DTBB_TEST=OFF -DCMAKE_BUILD_TYPE=Release .. && \
|
||||
cmake --build . && \
|
||||
cmake --install .
|
||||
RUN mkdir -p /src /opt && \
|
||||
apt-get update && \
|
||||
apt-get -y --no-install-recommends --no-install-suggests install \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
g++ \
|
||||
gcc \
|
||||
git \
|
||||
libboost1.81-all-dev \
|
||||
libbz2-dev \
|
||||
liblua5.4-dev \
|
||||
libtbb-dev \
|
||||
libxml2-dev \
|
||||
libzip-dev \
|
||||
lua5.4 \
|
||||
make \
|
||||
pkg-config
|
||||
|
||||
COPY . /src
|
||||
WORKDIR /src
|
||||
@ -41,19 +44,24 @@ RUN NPROC=${BUILD_CONCURRENCY:-$(nproc)} && \
|
||||
rm -rf /src
|
||||
|
||||
|
||||
# Multistage build to reduce image size - https://docs.docker.com/engine/userguide/eng-image/multistage-build/#use-multi-stage-builds
|
||||
# Multistage build to reduce image size - https://docs.docker.com/build/building/multi-stage/#use-multi-stage-builds
|
||||
# Only the content below ends up in the image, this helps remove /src from the image (which is large)
|
||||
FROM debian:bookworm-slim as runstage
|
||||
FROM debian:bookworm-slim AS runstage
|
||||
|
||||
COPY --from=builder /usr/local /usr/local
|
||||
COPY --from=builder /opt /opt
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
libboost-program-options1.81.0 libboost-date-time1.81.0 libboost-iostreams1.81.0 libboost-thread1.81.0 \
|
||||
expat liblua5.4-0 && \
|
||||
apt-get install -y --no-install-recommends --no-install-suggests \
|
||||
expat \
|
||||
libboost-date-time1.81.0 \
|
||||
libboost-iostreams1.81.0 \
|
||||
libboost-program-options1.81.0 \
|
||||
libboost-thread1.81.0 \
|
||||
liblua5.4-0 \
|
||||
libtbb12 && \
|
||||
rm -rf /var/lib/apt/lists/* && \
|
||||
# add /usr/local/lib to ldconfig to allow loading libraries from there
|
||||
# Add /usr/local/lib to ldconfig to allow loading libraries from there
|
||||
ldconfig /usr/local/lib
|
||||
|
||||
RUN /usr/local/bin/osrm-extract --help && \
|
||||
@ -65,3 +73,4 @@ RUN /usr/local/bin/osrm-extract --help && \
|
||||
WORKDIR /opt
|
||||
|
||||
EXPOSE 5000
|
||||
|
||||
|
@ -30,7 +30,7 @@ struct V8Renderer
|
||||
{
|
||||
Napi::Value child;
|
||||
std::visit(V8Renderer(env, child), keyValue.second);
|
||||
obj.Set(keyValue.first, child);
|
||||
obj.Set(keyValue.first.data(), child);
|
||||
}
|
||||
out = obj;
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ using Value = std::variant<String, Number, Object, Array, True, False, Null>;
|
||||
*/
|
||||
struct Object
|
||||
{
|
||||
std::unordered_map<std::string, Value> values;
|
||||
std::unordered_map<std::string_view, Value> values;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -44,13 +44,13 @@ struct Comparator
|
||||
|
||||
bool operator()(const Object &lhs, const Object &rhs) const
|
||||
{
|
||||
std::set<std::string> lhs_keys;
|
||||
std::set<std::string_view> lhs_keys;
|
||||
for (const auto &key_value : lhs.values)
|
||||
{
|
||||
lhs_keys.insert(key_value.first);
|
||||
}
|
||||
|
||||
std::set<std::string> rhs_keys;
|
||||
std::set<std::string_view> rhs_keys;
|
||||
for (const auto &key_value : rhs.values)
|
||||
{
|
||||
rhs_keys.insert(key_value.first);
|
||||
@ -60,7 +60,7 @@ struct Comparator
|
||||
{
|
||||
if (rhs_keys.find(key) == rhs_keys.end())
|
||||
{
|
||||
reason = rhs_path + " doesn't have key \"" + key + "\"";
|
||||
reason = rhs_path + " doesn't have key \"" + std::string(key) + "\"";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -69,7 +69,7 @@ struct Comparator
|
||||
{
|
||||
if (lhs_keys.find(key) == lhs_keys.end())
|
||||
{
|
||||
reason = lhs_path + " doesn't have key \"" + key + "\"";
|
||||
reason = lhs_path + " doesn't have key \"" + std::string(key) + "\"";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -81,10 +81,11 @@ struct Comparator
|
||||
|
||||
const auto &rhs_child = rhs.values.find(key)->second;
|
||||
const auto &lhs_child = lhs.values.find(key)->second;
|
||||
auto is_same =
|
||||
std::visit(Comparator(reason, lhs_path + "." + key, rhs_path + "." + key),
|
||||
lhs_child,
|
||||
rhs_child);
|
||||
auto is_same = std::visit(Comparator(reason,
|
||||
lhs_path + "." + std::string(key),
|
||||
rhs_path + "." + std::string(key)),
|
||||
lhs_child,
|
||||
rhs_child);
|
||||
if (!is_same)
|
||||
{
|
||||
return false;
|
||||
|
@ -97,7 +97,7 @@ template <typename Out> struct Renderer
|
||||
void operator()(const Null &) { write<>("null"); }
|
||||
|
||||
private:
|
||||
void write(const std::string &str);
|
||||
void write(std::string_view str);
|
||||
void write(const char *str, size_t size);
|
||||
void write(char ch);
|
||||
|
||||
@ -110,7 +110,7 @@ template <typename Out> struct Renderer
|
||||
Out &out;
|
||||
};
|
||||
|
||||
template <> void Renderer<std::vector<char>>::write(const std::string &str)
|
||||
template <> void Renderer<std::vector<char>>::write(std::string_view str)
|
||||
{
|
||||
out.insert(out.end(), str.begin(), str.end());
|
||||
}
|
||||
@ -122,7 +122,7 @@ template <> void Renderer<std::vector<char>>::write(const char *str, size_t size
|
||||
|
||||
template <> void Renderer<std::vector<char>>::write(char ch) { out.push_back(ch); }
|
||||
|
||||
template <> void Renderer<std::ostream>::write(const std::string &str) { out << str; }
|
||||
template <> void Renderer<std::ostream>::write(std::string_view str) { out << str; }
|
||||
|
||||
template <> void Renderer<std::ostream>::write(const char *str, size_t size)
|
||||
{
|
||||
@ -131,7 +131,7 @@ template <> void Renderer<std::ostream>::write(const char *str, size_t size)
|
||||
|
||||
template <> void Renderer<std::ostream>::write(char ch) { out << ch; }
|
||||
|
||||
template <> void Renderer<std::string>::write(const std::string &str) { out += str; }
|
||||
template <> void Renderer<std::string>::write(std::string_view str) { out += str; }
|
||||
|
||||
template <> void Renderer<std::string>::write(const char *str, size_t size)
|
||||
{
|
||||
|
@ -93,7 +93,7 @@ function run_benchmarks_for_folder {
|
||||
echo "Took: ${DIFF}s"
|
||||
done
|
||||
done
|
||||
|
||||
|
||||
for ALGORITHM in ch mld; do
|
||||
for BENCH in nearest table trip route match; do
|
||||
echo "Running random $BENCH $ALGORITHM"
|
||||
|
@ -9,12 +9,17 @@
|
||||
#include <rapidjson/document.h>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <unordered_set>
|
||||
|
||||
using namespace osrm;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
// we use std::string_view as a key in the object, so since here we have dynamic keys we have to
|
||||
// "hold" them somewhere okay for tests...
|
||||
static std::unordered_set<std::string> gKeysHolder;
|
||||
|
||||
void convert(const rapidjson::Value &value, json::Value &result)
|
||||
{
|
||||
if (value.IsString())
|
||||
@ -32,7 +37,8 @@ void convert(const rapidjson::Value &value, json::Value &result)
|
||||
{
|
||||
json::Value member;
|
||||
convert(itr->value, member);
|
||||
object.values.emplace(itr->name.GetString(), std::move(member));
|
||||
auto keyItr = gKeysHolder.emplace(itr->name.GetString()).first;
|
||||
object.values.emplace(*keyItr, std::move(member));
|
||||
}
|
||||
result = std::move(object);
|
||||
}
|
||||
@ -122,6 +128,7 @@ int main(int argc, char **argv)
|
||||
|
||||
if (std::string{out_vec.begin(), out_vec.end()} != out_str || out_str != out_ss_str)
|
||||
{
|
||||
std::cerr << "Vector/string results are not equal\n";
|
||||
throw std::logic_error("Vector/stringstream/string results are not equal");
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
|
3
third_party/sol2/include/sol/sol.hpp
vendored
3
third_party/sol2/include/sol/sol.hpp
vendored
@ -6752,7 +6752,8 @@ namespace sol {
|
||||
static_assert(std::is_constructible<T, Args&&...>::value, "T must be constructible with Args");
|
||||
|
||||
*this = nullopt;
|
||||
this->construct(std::forward<Args>(args)...);
|
||||
new (static_cast<void*>(this)) optional(std::in_place, std::forward<Args>(args)...);
|
||||
return **this;
|
||||
}
|
||||
|
||||
/// Swaps this optional with the other.
|
||||
|
Loading…
Reference in New Issue
Block a user