Skip to content

Use uvx for CMake and Server Toolchain for Ninja #1428

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

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
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
10 changes: 8 additions & 2 deletions .evergreen/config_generator/components/abi_stability.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from config_generator.components.funcs.install_c_driver import InstallCDriver
from config_generator.components.funcs.install_uv import InstallUV

from config_generator.etc.distros import find_large_distro
from config_generator.etc.function import Function, merge_defns
Expand Down Expand Up @@ -182,16 +183,21 @@ def task_groups():
EvgTaskGroup(
name=f'tg-{TAG}-{polyfill}-cxx{cxx_standard}',
max_hosts=-1,
setup_group_can_fail_task=True,
setup_task_can_fail_task=True,
setup_task=[
git_get_project(directory='mongo-cxx-driver'),
InstallUV.call(),
InstallCDriver.call(),
bash_exec(
command_type=EvgCommandType.SETUP,
env={
'cxx_standard': f'{cxx_standard}',
'polyfill': polyfill,
},
include_expansions_in_env=['distro_id'],
include_expansions_in_env=[
'distro_id',
'UV_INSTALL_DIR',
],
script='mongo-cxx-driver/.evergreen/scripts/abi-stability-setup.sh'
),
s3_put(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ def tasks():
tags=[TAG, distro_name],
run_on=distro.name,
commands=[
InstallCDriver.call(),
InstallUV.call(),
InstallCDriver.call(),
Compile.call(build_type='Debug', vars={'ENABLE_TESTS': 'ON'}),
TestSearchIndexHelpers.call(),
],
Expand Down
23 changes: 11 additions & 12 deletions .evergreen/config_generator/components/cmake_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
# pylint: disable=line-too-long
# fmt: off
MATRIX = [
("min", [3, 15, 4]),
("max-v3", [3, 31, 7]),
("max", [4, 0, 1]),
# As-if `cmake~=<version>` (PEP 0440).
("min", "3.15.0"),
("max-v3", "3.0" ),
("max", "4.0.0" ),
]
# fmt: on

Expand All @@ -30,20 +31,20 @@ class CMakeCompat(Function):
command_type=EvgCommandType.TEST,
working_dir='mongo-cxx-driver',
include_expansions_in_env=[
'CMAKE_MAJOR_VERSION',
'CMAKE_MINOR_VERSION',
'CMAKE_PATCH_VERSION',
'CMAKE_VERSION',
'distro_id',
'INSTALL_C_DRIVER',
'UV_INSTALL_DIR',
],
script='.evergreen/scripts/cmake-compat.sh',
),
bash_exec(
command_type=EvgCommandType.TEST,
include_expansions_in_env=[
'CMAKE_MAJOR_VERSION',
'CMAKE_MINOR_VERSION',
'CMAKE_PATCH_VERSION',
'CMAKE_VERSION',
'distro_id',
'INSTALL_C_DRIVER',
'UV_INSTALL_DIR',
],
script='mongo-cxx-driver/.evergreen/scripts/cmake-compat-check.sh',
),
Expand All @@ -69,9 +70,7 @@ def tasks():
(InstallCDriver.call() if install_c_driver else FetchCDriverSource.call()),
CMakeCompat.call(
vars={
'CMAKE_MAJOR_VERSION': version[0],
'CMAKE_MINOR_VERSION': version[1],
'CMAKE_PATCH_VERSION': version[2],
'CMAKE_VERSION': version,
'INSTALL_C_DRIVER': int(install_c_driver),
},
),
Expand Down
2 changes: 1 addition & 1 deletion .evergreen/config_generator/components/compile_only.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ def tasks():
commands = [expansions_update(updates=updates)] if updates else []
commands += [
Setup.call(),
InstallCDriver.call(),
InstallUV.call(),
InstallCDriver.call(),
Compile.call(
build_type=build_type,
compiler=compiler,
Expand Down
13 changes: 11 additions & 2 deletions .evergreen/config_generator/components/funcs/install_uv.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,29 @@ class InstallUV(Function):
set -o errexit
set -o pipefail

version="0.8.3"

if [[ ! -n "${MONGO_CXX_DRIVER_CACHE_DIR}" ]]; then
echo "MONGO_CXX_DRIVER_CACHE_DIR is not defined!" 1>&2
exit 1
fi

uv_install_dir="${MONGO_CXX_DRIVER_CACHE_DIR}/uv-0.5.14"
uv_install_dir="${MONGO_CXX_DRIVER_CACHE_DIR}/uv-$version"
mkdir -p "$uv_install_dir"

if ! command -v "$uv_install_dir/uv" 2>/dev/null; then
script="$(mktemp)"
cp -f mongo-cxx-driver/.evergreen/scripts/uv-installer.sh "$script"
chmod +x "$script"
(
. mongo-cxx-driver/.evergreen/scripts/patch-uv-installer.sh
patch_uv_installer "$script" "$version"
)
env \\
UV_INSTALL_DIR="$uv_install_dir" \\
UV_UNMANAGED_INSTALL=1 \\
INSTALLER_PRINT_VERBOSE=1 \\
mongo-cxx-driver/.evergreen/scripts/uv-installer.sh
"$script"
fi

PATH="$uv_install_dir:$PATH" command -V uv
Expand Down
32 changes: 2 additions & 30 deletions .evergreen/config_generator/components/funcs/setup.py
Original file line number Diff line number Diff line change
@@ -1,39 +1,11 @@
from config_generator.etc.function import Function
from config_generator.etc.utils import bash_exec

from shrub.v3.evg_command import EvgCommandType, git_get_project
from shrub.v3.evg_command import git_get_project


class Setup(Function):
name = 'setup'
commands = [
bash_exec(
command_type=EvgCommandType.SETUP,
script='''\
set -o errexit
set -o pipefail
rm -rf "mongo-cxx-driver"
rm -fr "mongo-c-driver"
rm -fr mongod
rm -fr drivers-evergreen-tools
'''
),
git_get_project(directory='mongo-cxx-driver'),
bash_exec(
command_type=EvgCommandType.SETUP,
script='''\
set -o errexit
set -o pipefail
cc --version || true
c++ --version || true
gcc --version || true
g++ --version || true
clang --version || true
cmake --version || true
openssl version || true
'''
),
]
commands = git_get_project(directory='mongo-cxx-driver')


def functions():
Expand Down
1 change: 1 addition & 0 deletions .evergreen/config_generator/components/funcs/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class Test(Function):
'TEST_WITH_VALGRIND',
'use_mongocryptd',
'USE_STATIC_LIBS',
'UV_INSTALL_DIR',
'VALGRIND_INSTALL_DIR',
],
working_dir='mongo-cxx-driver',
Expand Down
2 changes: 1 addition & 1 deletion .evergreen/config_generator/components/integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ def tasks():
commands += [
Setup.call(),
StartMongod.call(mongodb_version=mongodb_version, topology=topology),
InstallCDriver.call(vars=icd_vars),
InstallUV.call(),
InstallCDriver.call(vars=icd_vars),
Compile.call(polyfill=polyfill, vars=compile_vars),
FetchDET.call(),
RunKMSServers.call(),
Expand Down
4 changes: 3 additions & 1 deletion .evergreen/config_generator/components/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ class Lint(Function):
command_type=EvgCommandType.TEST,
working_dir='mongo-cxx-driver',
env={'DRYRUN': '1'},
script='${UV_INSTALL_DIR}/uv run --frozen etc/clang-format-all.sh',
script='''\
PATH="${UV_INSTALL_DIR}:$PATH" uv run --frozen etc/clang-format-all.sh
''',
)


Expand Down
6 changes: 3 additions & 3 deletions .evergreen/config_generator/components/sanitizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ def tasks():
compile_vars = {'ENABLE_TESTS': 'ON', 'RUN_DISTCHECK': 1}
test_vars = {
'MONGOCXX_TEST_TOPOLOGY': topology,
'example_projects_cc': 'clang',
'example_projects_cxx': 'clang++',
'example_projects_cc': cc_compiler,
'example_projects_cxx': cxx_compiler,
}

if link_type == 'static':
Expand Down Expand Up @@ -96,8 +96,8 @@ def tasks():
commands += [
Setup.call(),
StartMongod.call(mongodb_version=mongodb_version, topology=topology),
InstallCDriver.call(vars=icd_vars),
InstallUV.call(),
InstallCDriver.call(vars=icd_vars),
Compile.call(vars=compile_vars),
FetchDET.call(),
RunKMSServers.call(),
Expand Down
2 changes: 2 additions & 0 deletions .evergreen/config_generator/components/scan_build.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from config_generator.components.funcs.fetch_c_driver_source import FetchCDriverSource
from config_generator.components.funcs.install_uv import InstallUV
from config_generator.components.funcs.setup import Setup

from config_generator.etc.distros import find_large_distro
Expand Down Expand Up @@ -121,6 +122,7 @@ def tasks():
commands=[
Setup.call(),
FetchCDriverSource.call(),
InstallUV.call(),
RunScanBuild.call(cxx_standard, polyfill),
UploadScanArtifacts.call(),
],
Expand Down
27 changes: 24 additions & 3 deletions .evergreen/config_generator/components/uninstall_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,32 @@ class UninstallCheck(Function):
commands = bash_exec(
command_type=EvgCommandType.TEST,
working_dir='mongo-cxx-driver',
include_expansions_in_env=['distro_id'],
script='''\
set -o errexit
set -o pipefail

# lib vs. lib64 (i.e. RHEL).
if [[ "${distro_id}" == rhel* ]]; then
LIB_DIR="lib64"
else
LIB_DIR="lib"
fi

touch "build/install/$LIB_DIR/canary.txt"

ls -l "build/install/share/mongo-cxx-driver"

case "$OSTYPE" in
darwin*|linux*) .evergreen/scripts/uninstall_check.sh ;;
cygwin) cmd.exe /c ".evergreen\\\\scripts\\\\uninstall_check_windows.cmd" ;;
darwin*|linux*)
# Ninja generator.
uvx cmake --build build --target uninstall
env LIB_DIR="$LIB_DIR" .evergreen/scripts/uninstall_check.sh
;;
cygwin)
# Visual Studio generator.
uvx cmake --build build --config Debug --target uninstall
cmd.exe /c ".evergreen\\\\scripts\\\\uninstall_check_windows.cmd"
;;
esac
'''
)
Expand Down
2 changes: 1 addition & 1 deletion .evergreen/config_generator/components/valgrind.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ def tasks():
commands += [
Setup.call(),
StartMongod.call(mongodb_version=mongodb_version, topology=topology),
InstallCDriver.call(vars=icd_vars),
InstallUV.call(),
InstallCDriver.call(vars=icd_vars),
Compile.call(compiler=compiler, vars=compile_vars),
FetchDET.call(),
RunKMSServers.call(),
Expand Down
Loading