Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/scripts/build_cmake_test_shell.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
# Only the legacy JS test client is built by SCons; never build/install a SCons server here.
set -euo pipefail
source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
shell_build_dir=${1:?usage: $0 shell-build-dir shell-install-prefix}
shell_install_prefix=${2:?usage: $0 shell-build-dir shell-install-prefix}
runtime_env
setup_python2
cd "$ELOQDOC_BASE_PATH"
run_with_heartbeat "SCons legacy JavaScript test shell" \
python2 scripts/buildscripts/scons.py --silent \
MONGO_VERSION=4.0.3 VARIANT_DIR="${SCONS_VARIANT_DIR:-RelWithDebInfo}" \
CC="${CC:-gcc}" CXX="${CXX:-g++}" \
CFLAGS="-isystem ${ELOQ_THIRD_PARTY_PREFIX}/include -Wno-nonnull" \
CXXFLAGS="-isystem ${ELOQ_THIRD_PARTY_PREFIX}/include -Wno-nonnull -Wno-class-memaccess -Wno-interference-size -Wno-redundant-move" \
CPPDEFINES="ELOQ_MODULE_ENABLED EXT_TX_PROC_ENABLED" \
LIBPATH="${shell_install_prefix}/lib ${ELOQ_THIRD_PARTY_PREFIX}/lib ${ELOQ_THIRD_PARTY_PREFIX}/lib64" \
--build-dir="$shell_build_dir" --prefix="$shell_install_prefix" \
--allocator=system --link-model=dynamic --install-mode=hygienic \
--disable-warnings-as-errors --jlink=1 -j"$BUILD_JOBS" install-shell
"${shell_install_prefix}/bin/eloqdoc-cli" --version
70 changes: 70 additions & 0 deletions .github/scripts/cmake_ci_runtime.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#!/usr/bin/env bash
# One disposable server and S3 fixture per test phase. No build work runs here.
set -euo pipefail
source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
build_dir=$(realpath "${1:?usage: $0 cmake-build-dir integration|jstests|tpcc}")
phase=${2:?usage: $0 cmake-build-dir integration|jstests|tpcc}
cd "$ELOQDOC_BASE_PATH"
runtime_env

# Read the actual configured backend; never silently test a different storage engine.
cache_value() { sed -n "s/^$1:[^=]*=//p" "$build_dir/CMakeCache.txt"; }
data_store=$(cache_value WITH_DATA_STORE)
log_state=$(cache_value WITH_LOG_STATE)
port=27017
case "$phase" in
integration)
if [ "$(cache_value ELOQDOC_REGISTER_INTEGRATION_TESTS)" != ON ]; then
echo "Configure with -DELOQDOC_REGISTER_INTEGRATION_TESTS=ON first" >&2
exit 1
fi
connection_string=$(cache_value ELOQDOC_TEST_CONNECTION_STRING)
if [[ ! "$connection_string" =~ ^(localhost|127\.0\.0\.1):([0-9]+)$ ]]; then
echo "The managed integration fixture requires a localhost:port connection string" >&2
exit 1
fi
port=${BASH_REMATCH[2]}
# These suites share failpoints and global server parameters; keep them serial.
command=(ctest --test-dir "$build_dir" -L '^integration$' --no-tests=error
--output-on-failure -j1)
phase_timeout=${INTEGRATION_TIMEOUT_SECONDS:-4800}
;;
jstests)
setup_python2
test_shell=${ELOQDOC_TEST_SHELL:?Set ELOQDOC_TEST_SHELL to eloqdoc-cli}
test_shell=$(realpath "$test_shell")
export PATH="$(dirname "$test_shell"):$PATH"
command=(python2 scripts/buildscripts/resmoke.py --mongo="$test_shell"
--suites=eloq_basic,eloq_core '--shellPort={port}' --jobs=1
--continueOnFailure '--dbpathPrefix={fixture}/resmoke-data'
"--reportFile=$build_dir/jstests-results.json")
phase_timeout=${JSTEST_TIMEOUT_SECONDS:-7200}
;;
tpcc)
# Reuse exactly the SCons CI workload (two warehouses, transactional driver).
command=(bash -c 'source "$1/.github/scripts/common.sh"; run_tpcc "$2"'
bash "$ELOQDOC_BASE_PATH" "$build_dir/tpcc-client")
phase_timeout=${TPCC_PHASE_TIMEOUT_SECONDS:-2400}
;;
*) echo "Unknown runtime phase: $phase" >&2; exit 1 ;;
esac

finish_runtime() {
local status=$?
if [ "$status" -ne 0 ] && [ -n "${RUSTFS_RUN_DIR:-}" ] && [ -f /tmp/rustfs.log ]; then
mkdir -p "$build_dir/runtime-diagnostics"
cp /tmp/rustfs.log "$build_dir/runtime-diagnostics/rustfs-${phase}.log"
fi
stop_rustfs
exit "$status"
}
trap finish_runtime EXIT
if needs_s3 "$data_store" "$log_state"; then
start_rustfs "$S3_ENDPOINT" "$S3_ACCESS_KEY" "$S3_SECRET_KEY"
fi
"${CMAKE_TEST_PYTHON:-/usr/bin/python3}" cmake/tests/server_fixture.py \
--server "$build_dir/eloqdoc" --data-store "$data_store" --log-state "$log_state" \
--label "$phase" --timeout "$phase_timeout" \
--port "$port" \
--memory-limit-mb "${NODE_MEMORY_LIMIT_MB:-4000}" \
--diagnostics-dir "$build_dir/runtime-diagnostics" -- "${command[@]}"
5 changes: 4 additions & 1 deletion .github/scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ fi
export ELOQ_THIRD_PARTY_REQUIRED="${ELOQ_THIRD_PARTY_REQUIRED:-ON}"
export BUILD_JOBS="${BUILD_JOBS:-$(nproc)}"
[ "${BUILD_JOBS}" -lt 1 ] && BUILD_JOBS=1
[ "${BUILD_JOBS}" -gt 8 ] && BUILD_JOBS=8
export CMAKE_BUILD_TIMEOUT_SECONDS="${CMAKE_BUILD_TIMEOUT_SECONDS:-3600}"
export SCONS_BUILD_TIMEOUT_SECONDS="${SCONS_BUILD_TIMEOUT_SECONDS:-7200}"
export TPCC_TIMEOUT_SECONDS="${TPCC_TIMEOUT_SECONDS:-1200}"
Expand Down Expand Up @@ -278,7 +279,9 @@ build_eloqdoc() {
aarch64|arm64) scons_arch_flags="-march=armv8-a+crc" ;;
esac

local scons_third_party_include="-idirafter ${ELOQ_THIRD_PARTY_PREFIX}/include"
# Keep MongoDB's explicit -I paths first, but prefer the selected dependency
# prefix over unrelated copies installed in the compiler's default paths.
local scons_third_party_include="-isystem ${ELOQ_THIRD_PARTY_PREFIX}/include"
local scons_cflags="${scons_third_party_include} ${scons_arch_flags} -Wno-nonnull"
local scons_cxxflags="${scons_third_party_include} ${scons_arch_flags} -Wno-nonnull -Wno-class-memaccess -Wno-interference-size -Wno-redundant-move"
local scons_libpath="${ELOQ_THIRD_PARTY_PREFIX}/lib ${ELOQ_THIRD_PARTY_PREFIX}/lib64"
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ jobs:
VARIANT_ID: ${{ matrix.id }}
DATA_STORE_TYPE: ${{ matrix.data_store }}
WITH_LOG_STATE: ${{ matrix.log_state }}
# This release job uses the historical SCons packaging path. Pin Python 2 explicitly even
# though the compatibility installer currently enables it by default.
ELOQ_INSTALL_LEGACY_SCONS: 1

steps:
- name: Bootstrap checkout tools
Expand Down
193 changes: 179 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,8 @@ concurrency:

jobs:
prime-third-party:
name: prime-third-party (${{ matrix.arch }})
strategy:
fail-fast: false
matrix:
arch: [amd64, arm64]
runs-on: ${{ matrix.arch == 'arm64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
name: prime-third-party (amd64)
runs-on: ubuntu-24.04
container:
image: eloqdata/ubuntu-dev:24.04
options: --user root
Expand All @@ -46,9 +42,180 @@ jobs:
uses: ./eloqdoc/.github/actions/setup-third-party
with:
source-dir: ${{ github.workspace }}/eloqdoc
arch: ${{ matrix.arch }}
arch: amd64
cache-scope: ubuntu-dev

cmake-build-smoke:
name: CMake/Ninja RelWithDebInfo-eloqstore_s3-amd64
needs: prime-third-party
runs-on: ubuntu-24.04
timeout-minutes: 240
container:
image: eloqdata/ubuntu-dev:24.04
options: --user root --privileged --security-opt seccomp=unconfined --ulimit memlock=-1:-1
env:
ELOQ_THIRD_PARTY_PREFIX: /opt/eloq/third_party
CMAKE_PREFIX_PATH: /opt/eloq/third_party
CMAKE_INCLUDE_PATH: /opt/eloq/third_party/include
CMAKE_LIBRARY_PATH: /opt/eloq/third_party/lib
LD_LIBRARY_PATH: /opt/eloq/third_party/lib:/opt/eloq/third_party/lib64
S3_ENDPOINT: http://127.0.0.1:9900
S3_ACCESS_KEY: rustfsadmin
S3_SECRET_KEY: rustfsadmin
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
submodules: false
path: eloqdoc
ref: ${{ github.event.pull_request.head.sha || github.sha }}

- name: Checkout product submodules
run: |
git config --global --add safe.directory '*'
cd "$GITHUB_WORKSPACE/eloqdoc"
bash scripts/checkout_product_submodules.sh

- name: Setup third-party (cached)
uses: ./eloqdoc/.github/actions/setup-third-party
with:
source-dir: ${{ github.workspace }}/eloqdoc
arch: amd64
cache-scope: ubuntu-dev

- name: Limit CMake build and test parallelism to runner capacity
run: |
jobs=$(nproc)
if [ "$jobs" -gt 8 ]; then jobs=8; fi
echo "CMAKE_BUILD_PARALLEL_LEVEL=$jobs" >> "$GITHUB_ENV"
echo "CTEST_PARALLEL_LEVEL=$jobs" >> "$GITHUB_ENV"

- name: Install Python 3 IDL compiler dependency
run: |
# The third-party cache contains C++ libraries, not Python code-generation dependencies.
apt-get update
apt-get install -y --no-install-recommends python3-yaml
/usr/bin/python3 -c 'import yaml'

- name: Prepare runtime test clients
id: cmake_clients
working-directory: eloqdoc
shell: bash
run: |
apt-get install -y --no-install-recommends python3-venv
/usr/bin/python3 -m pip install --target build/cmake-ci/python 'pymongo==4.8.0'
source .github/scripts/common.sh
setup_python2
python2 -c 'import yaml, pymongo, requests'
git clone --depth 1 --branch production \
https://github.com/eloqdata/py-tpcc.git "$PY_TPCC_PATH"

- name: Configure top-level CMake build
working-directory: eloqdoc
run: |
cmake -S . -B build/cmake-ci -G Ninja \
-DPython3_EXECUTABLE=/usr/bin/python3 \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_JOB_POOLS=link_pool=1 \
-DCMAKE_JOB_POOL_LINK=link_pool \
-DBUILD_SHARED_LIBS=ON \
-DELOQDOC_BUILD_TESTS=ON \
-DELOQDOC_REGISTER_INTEGRATION_TESTS=ON \
-DELOQDOC_TEST_CONNECTION_STRING=localhost:27017 \
-DELOQ_THIRD_PARTY_PREFIX="$ELOQ_THIRD_PARTY_PREFIX" \
-DELOQ_THIRD_PARTY_REQUIRED=ON \
-DWITH_DATA_STORE=ELOQDSS_ELOQSTORE \
-DWITH_LOG_STATE=ROCKSDB_CLOUD_S3 \
-DWITH_LOG_SERVICE=ON \
-DFORK_HM_PROCESS=ON \
-DSTATISTICS=ON

- name: Build server and all retained CMake tests
id: cmake_build
working-directory: eloqdoc
run: |
cmake --build build/cmake-ci \
--target eloqdoc eloqdoc-tests

- name: Run CMake unit and integration-startup tests
working-directory: eloqdoc
run: |
ctest --test-dir build/cmake-ci \
--label-exclude '^integration$' --no-tests=error --output-on-failure

- name: Run C++ integration suites against the CMake server
id: cmake_integration
if: ${{ !cancelled() && steps.cmake_build.outcome == 'success' && steps.cmake_clients.outcome == 'success' }}
working-directory: eloqdoc
shell: bash
run: |
PYTHONPATH="$PWD/build/cmake-ci/python" \
bash .github/scripts/cmake_ci_runtime.sh build/cmake-ci integration

- name: Build the legacy JavaScript test shell only
id: cmake_shell
if: ${{ !cancelled() && steps.cmake_build.outcome == 'success' && steps.cmake_clients.outcome == 'success' }}
working-directory: eloqdoc
shell: bash
run: |
BUILD_JOBS="$CMAKE_BUILD_PARALLEL_LEVEL" \
bash .github/scripts/build_cmake_test_shell.sh \
"$PWD/build/cmake-test-shell" "$PWD/build/cmake-test-client"

- name: Run eloq_basic and eloq_core against the CMake server
id: cmake_jstests
if: ${{ !cancelled() && steps.cmake_shell.outcome == 'success' }}
working-directory: eloqdoc
shell: bash
run: |
ELOQDOC_TEST_SHELL="$PWD/build/cmake-test-client/bin/eloqdoc-cli" \
PYTHONPATH="$PWD/build/cmake-ci/python" \
bash .github/scripts/cmake_ci_runtime.sh build/cmake-ci jstests

- name: Run TPCC against the CMake server
id: cmake_tpcc
if: ${{ !cancelled() && steps.cmake_build.outcome == 'success' && steps.cmake_clients.outcome == 'success' }}
working-directory: eloqdoc
shell: bash
run: |
PYTHONPATH="$PWD/build/cmake-ci/python" \
bash .github/scripts/cmake_ci_runtime.sh build/cmake-ci tpcc

- name: Preserve failed CMake runtime-test logs
if: ${{ failure() && (steps.cmake_integration.outcome == 'failure' || steps.cmake_jstests.outcome == 'failure' || steps.cmake_tpcc.outcome == 'failure') }}
uses: actions/upload-artifact@v4
with:
name: cmake-runtime-eloqstore-s3-amd64-${{ github.run_attempt }}
path: |
eloqdoc/build/cmake-ci/runtime-diagnostics/
eloqdoc/build/cmake-ci/jstests-results.json
eloqdoc/build/cmake-ci/Testing/Temporary/
if-no-files-found: warn
retention-days: 7

- name: Exercise the normal server over the MongoDB wire protocol
id: cmake_smoke
if: ${{ !cancelled() && steps.cmake_build.outcome == 'success' }}
working-directory: eloqdoc
shell: bash
run: |
source .github/scripts/common.sh
trap 'stop_rustfs' EXIT
start_rustfs "$S3_ENDPOINT" "$S3_ACCESS_KEY" "$S3_SECRET_KEY"
PYTHONPATH="$PWD/build/cmake-ci/python" \
cmake --build build/cmake-ci --target eloqdoc-server-smoke

- name: Preserve failed CMake smoke-test logs
if: ${{ failure() && steps.cmake_smoke.outcome == 'failure' }}
uses: actions/upload-artifact@v4
with:
name: cmake-smoke-eloqstore-s3-amd64-${{ github.run_attempt }}
path: |
eloqdoc/build/cmake-ci/smoke-diagnostics/
/tmp/rustfs.log
if-no-files-found: warn
retention-days: 7

ent-ci:
needs: prime-third-party
concurrency:
Expand All @@ -58,19 +225,16 @@ jobs:
strategy:
fail-fast: false
matrix:
build_type: [Debug, RelWithDebInfo]
arch: [amd64, arm64]
build_type: [RelWithDebInfo]
arch: [amd64]
engine:
- id: rocksdb
data_store_type: ELOQDSS_ROCKSDB
log_state: ROCKSDB
- id: rocks_s3
data_store_type: ELOQDSS_ROCKSDB_CLOUD_S3
log_state: ROCKSDB_CLOUD_S3
- id: eloqstore_s3
data_store_type: ELOQDSS_ELOQSTORE
log_state: ROCKSDB_CLOUD_S3
runs-on: ${{ matrix.arch == 'arm64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
runs-on: ubuntu-24.04
timeout-minutes: 240
container:
image: eloqdata/ubuntu-dev:24.04
Expand Down Expand Up @@ -136,7 +300,8 @@ jobs:
echo "JSTEST_TIMEOUT_SECONDS=7200" >> "$GITHUB_ENV"
fi

- name: Build (${{ matrix.build_type }}, ${{ matrix.engine.id }})
# gh_ci_entry.sh deliberately exercises the historical Python 2/SCons install-core path.
- name: Build with SCons (${{ matrix.build_type }}, ${{ matrix.engine.id }})
run: |
bash ./eloqdoc/.github/scripts/gh_ci_entry.sh \
"$S3_ENDPOINT" \
Expand Down
Loading
Loading