Skip to content

fix(db): preload core dependencies in standalone builds #24

fix(db): preload core dependencies in standalone builds

fix(db): preload core dependencies in standalone builds #24

Workflow file for this run

name: DB Strict CI
on:
push:
branches:
- main
- master
- dev
- release/**
paths:
- ".github/workflows/db-strict-ci.yml"
- "CMakeLists.txt"
- "cmake/**"
- "include/**"
- "src/**"
- "examples/**"
- "tools/**"
- "README.md"
- "LICENSE"
- "vix.json"
pull_request:
branches:
- main
- master
- dev
- release/**
paths:
- ".github/workflows/db-strict-ci.yml"
- "CMakeLists.txt"
- "cmake/**"
- "include/**"
- "src/**"
- "examples/**"
- "tools/**"
- "README.md"
- "LICENSE"
- "vix.json"
workflow_dispatch:
permissions:
contents: read
env:
BUILD_JOBS: 2
VIX_GIT_BRANCH: dev
jobs:
build:
name: Build DB (${{ matrix.compiler }}, examples=${{ matrix.examples }}, mysql=${{ matrix.mysql }}, sqlite=${{ matrix.sqlite }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
compiler:
- gcc
- clang
examples:
- ON
- OFF
mysql:
- ON
- OFF
sqlite:
- ON
- OFF
steps:
- name: Checkout db repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential \
cmake \
ninja-build \
clang \
g++ \
pkg-config \
git \
curl \
ca-certificates \
libasio-dev \
nlohmann-json3-dev \
libspdlog-dev \
libfmt-dev \
libssl-dev \
libsqlite3-dev \
libmysqlcppconn-dev
test -f /usr/include/asio.hpp || (echo "::error::System Asio header not found"; exit 1)
- name: Select compiler
run: |
if [ "${{ matrix.compiler }}" = "clang" ]; then
echo "CC=clang" >> "$GITHUB_ENV"
echo "CXX=clang++" >> "$GITHUB_ENV"
else
echo "CC=gcc" >> "$GITHUB_ENV"
echo "CXX=g++" >> "$GITHUB_ENV"
fi
- name: Fetch sibling dependencies
run: |
set -euxo pipefail
rm -rf \
../error \
../path \
../env \
../utils \
../async \
../json \
../template \
../core
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/error.git ../error
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/path.git ../path
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/env.git ../env
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/utils.git ../utils
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" --recurse-submodules https://github.com/vixcpp/async.git ../async
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/json.git ../json
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/template.git ../template || true
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/core.git ../core
git -C ../async submodule update --init --recursive --depth 1 || true
- name: Prepare Asio for async
run: |
set -euxo pipefail
mkdir -p ../async/third_party/asio
rm -rf ../async/third_party/asio/include
mkdir -p ../async/third_party/asio/include
cp -r /usr/include/asio* ../async/third_party/asio/include/ || true
test -f ../async/third_party/asio/include/asio.hpp
- name: Verify required sibling dependencies
run: |
set -euxo pipefail
test -f ../error/CMakeLists.txt
test -f ../path/CMakeLists.txt
test -f ../env/CMakeLists.txt
test -f ../utils/CMakeLists.txt
test -f ../async/CMakeLists.txt
test -f ../json/CMakeLists.txt
test -f ../core/CMakeLists.txt
test -f ../json/include/vix/json/Simple.hpp
test -f ../async/third_party/asio/include/asio.hpp
- name: Show DB driver environment
run: |
echo "---- mysql connector ----"
ls -la /usr/lib/x86_64-linux-gnu/libmysqlcppconn* || true
ls -la /usr/include/cppconn || true
echo "---- sqlite ----"
ls -la /usr/include/sqlite3.h || true
- name: Export dependency include paths
run: |
EXTRA_PATHS="$GITHUB_WORKSPACE/../error/include"
EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../path/include"
EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../env/include"
EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../utils/include"
EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../async/include"
EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../json/include"
EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../core/include"
if [ -d "$GITHUB_WORKSPACE/../template/include" ]; then
EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../template/include"
fi
echo "CPATH=$EXTRA_PATHS${CPATH:+:$CPATH}" >> "$GITHUB_ENV"
echo "CPLUS_INCLUDE_PATH=$EXTRA_PATHS${CPLUS_INCLUDE_PATH:+:$CPLUS_INCLUDE_PATH}" >> "$GITHUB_ENV"
- name: Configure
run: |
cmake -S . -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DVIX_ENABLE_SANITIZERS=OFF \
-DVIX_DB_BUILD_EXAMPLES=${{ matrix.examples }} \
-DVIX_DB_USE_MYSQL=${{ matrix.mysql }} \
-DVIX_DB_REQUIRE_MYSQL=OFF \
-DVIX_DB_USE_SQLITE=${{ matrix.sqlite }} \
-DVIX_DB_REQUIRE_SQLITE=OFF \
-DVIX_DB_USE_POSTGRES=OFF \
-DVIX_DB_USE_REDIS=OFF \
-DVIX_CORE_WITH_OPENSSL=OFF \
-DVIX_CORE_WITH_TEMPLATE=AUTO \
-DVIX_CORE_WITH_MYSQL=OFF \
-DVIX_CORE_WITH_JSON=AUTO
- name: Build
run: |
cmake --build build -j"${BUILD_JOBS}"
- name: Print executables
run: |
find build -type f -executable | sort || true
runtime-smoke:
name: Runtime Smoke Checks
runs-on: ubuntu-latest
steps:
- name: Checkout db repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential \
cmake \
ninja-build \
g++ \
pkg-config \
git \
curl \
ca-certificates \
libasio-dev \
nlohmann-json3-dev \
libspdlog-dev \
libfmt-dev \
libssl-dev \
libsqlite3-dev \
libmysqlcppconn-dev
- name: Fetch sibling dependencies
run: |
set -euxo pipefail
rm -rf \
../error \
../path \
../env \
../utils \
../async \
../json \
../template \
../core
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/error.git ../error
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/path.git ../path
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/env.git ../env
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/utils.git ../utils
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" --recurse-submodules https://github.com/vixcpp/async.git ../async
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/json.git ../json
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/template.git ../template || true
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/core.git ../core
- name: Prepare Asio for async
run: |
set -euxo pipefail
mkdir -p ../async/third_party/asio
rm -rf ../async/third_party/asio/include
mkdir -p ../async/third_party/asio/include
cp -r /usr/include/asio* ../async/third_party/asio/include/ || true
- name: Configure runtime build
run: |
cmake -S . -B build-runtime -G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DVIX_ENABLE_SANITIZERS=OFF \
-DVIX_DB_BUILD_EXAMPLES=ON \
-DVIX_DB_USE_MYSQL=OFF \
-DVIX_DB_USE_SQLITE=ON \
-DVIX_DB_REQUIRE_SQLITE=OFF \
-DVIX_DB_USE_POSTGRES=OFF \
-DVIX_DB_USE_REDIS=OFF \
-DVIX_CORE_WITH_OPENSSL=OFF \
-DVIX_CORE_WITH_TEMPLATE=AUTO \
-DVIX_CORE_WITH_MYSQL=OFF \
-DVIX_CORE_WITH_JSON=AUTO
- name: Build runtime artifacts
run: |
cmake --build build-runtime -j"${BUILD_JOBS}"
- name: Run smoke tests on executables
shell: bash
run: |
set +e
mapfile -t CANDIDATES < <(
find build-runtime -type f -executable | while read -r exe; do
base="$(basename "$exe")"
if [[ ! "$exe" =~ /CMakeFiles/ ]] && [[ ! "$base" =~ (cmake|ctest) ]]; then
echo "$exe"
fi
done | sort -u
)
if [ ${#CANDIDATES[@]} -eq 0 ]; then
echo "No executable candidates found."
exit 0
fi
for exe in "${CANDIDATES[@]}"; do
echo "==> Smoke run: $exe"
timeout 5s "$exe" >/tmp/db_smoke.log 2>&1
STATUS=$?
cat /tmp/db_smoke.log || true
if [ $STATUS -ne 0 ] && [ $STATUS -ne 124 ]; then
echo "::warning::Non-zero exit status from $exe"
fi
done
exit 0
static-analysis:
name: Static Analysis
runs-on: ubuntu-latest
steps:
- name: Checkout db repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential \
cmake \
ninja-build \
clang \
g++ \
cppcheck \
clang-tidy \
pkg-config \
git \
curl \
ca-certificates \
libasio-dev \
nlohmann-json3-dev \
libspdlog-dev \
libfmt-dev \
libssl-dev \
libsqlite3-dev \
libmysqlcppconn-dev
- name: Fetch sibling dependencies
run: |
set -euxo pipefail
rm -rf \
../error \
../path \
../env \
../utils \
../async \
../json \
../template \
../core
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/error.git ../error
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/path.git ../path
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/env.git ../env
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/utils.git ../utils
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" --recurse-submodules https://github.com/vixcpp/async.git ../async
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/json.git ../json
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/template.git ../template || true
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/core.git ../core
- name: Prepare Asio for async
run: |
set -euxo pipefail
mkdir -p ../async/third_party/asio
rm -rf ../async/third_party/asio/include
mkdir -p ../async/third_party/asio/include
cp -r /usr/include/asio* ../async/third_party/asio/include/ || true
- name: Configure for analysis
run: |
cmake -S . -B build-analyze -G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DVIX_ENABLE_SANITIZERS=OFF \
-DVIX_DB_BUILD_EXAMPLES=ON \
-DVIX_DB_USE_MYSQL=OFF \
-DVIX_DB_USE_SQLITE=ON \
-DVIX_DB_REQUIRE_SQLITE=OFF \
-DVIX_DB_USE_POSTGRES=OFF \
-DVIX_DB_USE_REDIS=OFF \
-DVIX_CORE_WITH_OPENSSL=OFF \
-DVIX_CORE_WITH_TEMPLATE=AUTO \
-DVIX_CORE_WITH_MYSQL=OFF \
-DVIX_CORE_WITH_JSON=AUTO
- name: Run clang-tidy
run: |
set +e
find src examples tools -name '*.cpp' -print0 | xargs -0 -r -n1 -P2 clang-tidy -p build-analyze
exit 0
- name: Run cppcheck
run: |
set +e
cppcheck \
--enable=all \
--std=c++20 \
--inconclusive \
--quiet \
--suppress=missingIncludeSystem \
include/ src/ examples/ tools/
exit 0
install-check:
name: Install DB
runs-on: ubuntu-latest
steps:
- name: Checkout db repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential \
cmake \
ninja-build \
g++ \
pkg-config \
git \
curl \
ca-certificates \
libasio-dev \
nlohmann-json3-dev \
libspdlog-dev \
libfmt-dev \
libssl-dev \
libsqlite3-dev \
libmysqlcppconn-dev
- name: Fetch sibling dependencies
run: |
set -euxo pipefail
rm -rf \
../error \
../path \
../env \
../utils \
../async \
../json \
../template \
../core
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/error.git ../error
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/path.git ../path
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/env.git ../env
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/utils.git ../utils
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" --recurse-submodules https://github.com/vixcpp/async.git ../async
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/json.git ../json
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/template.git ../template || true
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/core.git ../core
- name: Prepare Asio for async
run: |
set -euxo pipefail
mkdir -p ../async/third_party/asio
rm -rf ../async/third_party/asio/include
mkdir -p ../async/third_party/asio/include
cp -r /usr/include/asio* ../async/third_party/asio/include/ || true
- name: Configure installable build
run: |
cmake -S . -B build-install -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DVIX_DB_BUILD_EXAMPLES=OFF \
-DVIX_DB_USE_MYSQL=OFF \
-DVIX_DB_USE_SQLITE=OFF \
-DVIX_DB_USE_POSTGRES=OFF \
-DVIX_DB_USE_REDIS=OFF \
-DVIX_CORE_WITH_OPENSSL=OFF \
-DVIX_CORE_WITH_TEMPLATE=AUTO \
-DVIX_CORE_WITH_MYSQL=OFF \
-DVIX_CORE_WITH_JSON=AUTO \
-DCMAKE_INSTALL_PREFIX="${PWD}/.ci-install"
- name: Build installable package
run: |
cmake --build build-install -j"${BUILD_JOBS}"
- name: Install package
run: |
cmake --install build-install
- name: Verify install tree
run: |
find .ci-install -maxdepth 8 -type f | sort
test -f .ci-install/include/vix/db/Database.hpp
test -f .ci-install/lib/libvix_db.a
config-coverage:
name: Configuration Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout db repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential \
cmake \
ninja-build \
g++ \
pkg-config \
git \
curl \
ca-certificates \
libasio-dev \
nlohmann-json3-dev \
libspdlog-dev \
libfmt-dev \
libssl-dev \
libsqlite3-dev \
libmysqlcppconn-dev
- name: Fetch sibling dependencies
run: |
set -euxo pipefail
rm -rf \
../error \
../path \
../env \
../utils \
../async \
../json \
../template \
../core
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/error.git ../error
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/path.git ../path
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/env.git ../env
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/utils.git ../utils
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" --recurse-submodules https://github.com/vixcpp/async.git ../async
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/json.git ../json
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/template.git ../template || true
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/core.git ../core
- name: Prepare Asio for async
run: |
set -euxo pipefail
mkdir -p ../async/third_party/asio
rm -rf ../async/third_party/asio/include
mkdir -p ../async/third_party/asio/include
cp -r /usr/include/asio* ../async/third_party/asio/include/ || true
- name: Configure release mode with MySQL
run: |
cmake -S . -B build-release-mysql -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DVIX_ENABLE_SANITIZERS=OFF \
-DVIX_DB_BUILD_EXAMPLES=OFF \
-DVIX_DB_USE_MYSQL=ON \
-DVIX_DB_REQUIRE_MYSQL=OFF \
-DVIX_DB_USE_SQLITE=OFF \
-DVIX_DB_USE_POSTGRES=OFF \
-DVIX_DB_USE_REDIS=OFF \
-DVIX_CORE_WITH_OPENSSL=OFF \
-DVIX_CORE_WITH_TEMPLATE=AUTO \
-DVIX_CORE_WITH_MYSQL=OFF \
-DVIX_CORE_WITH_JSON=AUTO
- name: Build release mode with MySQL
run: |
cmake --build build-release-mysql -j"${BUILD_JOBS}"
- name: Configure release mode with SQLite
run: |
cmake -S . -B build-release-sqlite -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DVIX_ENABLE_SANITIZERS=OFF \
-DVIX_DB_BUILD_EXAMPLES=OFF \
-DVIX_DB_USE_MYSQL=OFF \
-DVIX_DB_USE_SQLITE=ON \
-DVIX_DB_REQUIRE_SQLITE=OFF \
-DVIX_DB_USE_POSTGRES=OFF \
-DVIX_DB_USE_REDIS=OFF \
-DVIX_CORE_WITH_OPENSSL=OFF \
-DVIX_CORE_WITH_TEMPLATE=AUTO \
-DVIX_CORE_WITH_MYSQL=OFF \
-DVIX_CORE_WITH_JSON=AUTO
- name: Build release mode with SQLite
run: |
cmake --build build-release-sqlite -j"${BUILD_JOBS}"
- name: Configure release minimal mode
run: |
cmake -S . -B build-release-min -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DVIX_ENABLE_SANITIZERS=OFF \
-DVIX_DB_BUILD_EXAMPLES=OFF \
-DVIX_DB_USE_MYSQL=OFF \
-DVIX_DB_USE_SQLITE=OFF \
-DVIX_DB_USE_POSTGRES=OFF \
-DVIX_DB_USE_REDIS=OFF \
-DVIX_CORE_WITH_OPENSSL=OFF \
-DVIX_CORE_WITH_TEMPLATE=AUTO \
-DVIX_CORE_WITH_MYSQL=OFF \
-DVIX_CORE_WITH_JSON=AUTO
- name: Build release minimal mode
run: |
cmake --build build-release-min -j"${BUILD_JOBS}"
summary:
name: DB Strict CI Summary
needs:
- build
- runtime-smoke
- static-analysis
- install-check
- config-coverage
runs-on: ubuntu-latest
steps:
- name: Print summary
run: |
echo "DB strict CI completed."
echo "- gcc and clang builds"
echo "- examples ON and OFF builds"
echo "- mysql/sqlite/minimal configuration coverage"
echo "- runtime smoke checks"
echo "- static analysis"
echo "- install tree check"