Combine Base and Deps workflows.

Add workflow arguments for verbosity.

Add missing ldap to full features.

Superpose --all-features as backstop for unlisted features.

Fix hardened_malloc requiring gcc

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk
2025-05-03 02:32:49 +00:00
parent 09680fc86b
commit 481b67f1f9
15 changed files with 147 additions and 190 deletions

View File

@@ -9,6 +9,7 @@ ARG CARGO_TARGET
ARG CARGO_TARGET_DIR
ARG cargo_profile
ARG cargo_features
ARG cargo_spec_features
ARG cargo_cmd
ARG cargo_args=""
@@ -27,7 +28,7 @@ RUN \
cargo ${cargo_cmd} \
--frozen \
--workspace \
--no-default-features \
"${cargo_spec_features}" \
--features "${cargo_features}" \
--profile "${cargo_profile}" \
--target "${CARGO_TARGET}" \

View File

@@ -9,6 +9,7 @@ ARG CARGO_TARGET
ARG CARGO_TARGET_DIR
ARG cargo_profile
ARG cargo_features
ARG cargo_spec_features
ARG cook_args
ARG git_checkout
@@ -29,7 +30,7 @@ RUN \
cargo chef cook ${cook_args} \
--frozen \
--workspace \
--no-default-features \
"${cargo_spec_features}" \
--features "${cargo_features}" \
--profile "${cargo_profile}" \
--target "${CARGO_TARGET}" \

View File

@@ -9,6 +9,7 @@ ARG CARGO_TARGET
ARG CARGO_TARGET_DIR
ARG cargo_profile
ARG cargo_features
ARG cargo_spec_features
ARG cargo_args=""
ARG crate_path="src/main"
ARG crate_ident=""
@@ -37,7 +38,7 @@ RUN \
cargo install \
--locked \
--no-track \
--no-default-features \
"${cargo_spec_features}" \
--features "${cargo_features}" \
--profile "${cargo_profile}" \
--target "${CARGO_TARGET}" \

View File

@@ -5,7 +5,6 @@ ARG var_cache
ARG var_lib_apt
ARG packages
ENV DEBIAN_FRONTEND="noninteractive"
ENV packages="\
bzip2 \
ca-certificates \

View File

@@ -4,7 +4,7 @@ variable "repo" {}
cargo_feat_sets = {
none = ""
default = "brotli_compression,element_hacks,gzip_compression,io_uring,jemalloc,jemalloc_conf,media_thumbnail,release_max_log_level,systemd,url_preview,zstd_compression"
all = "blurhashing,brotli_compression,tuwunel_mods,console,default,direct_tls,element_hacks,gzip_compression,io_uring,jemalloc,jemalloc_conf,jemalloc_prof,jemalloc_stats,media_thumbnail,perf_measurements,release_max_log_level,sentry_telemetry,systemd,tokio_console,url_preview,zstd_compression"
all = "blurhashing,brotli_compression,tuwunel_mods,console,default,direct_tls,element_hacks,gzip_compression,hardened_malloc,io_uring,jemalloc,jemalloc_conf,jemalloc_prof,jemalloc_stats,ldap,media_thumbnail,perf_measurements,release_max_log_level,sentry_telemetry,systemd,tokio_console,url_preview,zstd_compression"
}
variable "cargo_features_always" {
@@ -708,7 +708,7 @@ target "audit" {
tags = [
elem_tag("audit", [cargo_profile, rust_toolchain, rust_target, feat_set, sys_name, sys_version, sys_target], "latest"),
]
target = "audit"
target = "audit"
dockerfile = "docker/Dockerfile.cargo.audit"
matrix = cargo_rust_feat_sys
inherits = [
@@ -1018,6 +1018,10 @@ target "ingredients" {
cargo_feat_sets[feat_set],
cargo_features_always,
])
cargo_spec_features = (
feat_set == "all"?
"--all-features": "--no-default-features"
)
CARGO_TARGET_DIR = "/usr/src/tuwunel/target/${sys_name}/${sys_version}/${rust_toolchain}"
CARGO_BUILD_RUSTFLAGS = (
rust_toolchain == "nightly"?
@@ -1135,10 +1139,17 @@ target "kitchen" {
}
args = {
packages = join(" ", [
"bzip2",
contains(split(",", cargo_feat_sets[feat_set]), "io_uring")? "liburing-dev": "",
contains(split(",", cargo_feat_sets[feat_set]), "zstd_compression")? "libzstd-dev": "",
contains(split(",", cargo_feat_sets[feat_set]), "jemalloc")? "libjemalloc-dev": "",
contains(split(",", cargo_feat_sets[feat_set]), "io_uring")?
"liburing-dev": "",
contains(split(",", cargo_feat_sets[feat_set]), "zstd_compression")?
"libzstd-dev": "",
contains(split(",", cargo_feat_sets[feat_set]), "jemalloc")?
"libjemalloc-dev": "",
contains(split(",", cargo_feat_sets[feat_set]), "hardened_malloc")?
"g++": "",
])
}
}

View File

@@ -1,9 +1,14 @@
#!/bin/bash
set -eo pipefail
CI="${CI:-true}"
BASEDIR=$(dirname "$0")
CI="${CI:-false}"
CI_VERBOSE="${CI_VERBOSE:-false}"
CI_VERBOSE_ENV="${CI_VERBOSE_ENV:-$CI_VERBOSE}"
CI_SILENT_BAKE="${CI_SILENT_BAKE:-false}"
CI_PRINT_BAKE="${CI_PRINT_BAKE:-$CI_VERBOSE}"
default_cargo_profiles='["test", "bench"]'
default_feat_sets='["none", "default", "all"]'
default_rust_toolchains='["nightly", "stable"]'
@@ -52,6 +57,7 @@ sys_versions="${env_sys_versions:-$default_sys_versions}"
runner_name=$(echo $RUNNER_NAME | cut -d"." -f1)
runner_num=$(echo $RUNNER_NAME | cut -d"." -f2)
builder_name="owo"
rocksdb_opt_level=3
rocksdb_portable=1
git_checkout="HEAD"
@@ -72,10 +78,9 @@ if test "$CI" = "true"; then
export BUILDKIT_PROGRESS="plain"
fi
uwu_docker_build_args=""
args="$uwu_docker_build_args"
args="$args --builder owo"
args="$args --set *.platform=${sys_platform}"
args=""
args="$args --builder ${builder_name}"
#args="$args --set *.platform=${sys_platform}"
if test ! -z "$runner_num"; then
#cpu_num=$(expr $runner_num % $(nproc))
@@ -89,12 +94,19 @@ else
:
fi
trap 'set +x; date; echo -e "\033[1;41;37mFAIL\033[0m"' ERR
env
date
if test "$CI_SILENT_BAKE" = "true"; then
args="$args --progress=quiet"
fi
arg="$args -f $BASEDIR/bake.hcl"
if test "$BUILDKIT_PROGRESS" = "plain"; then
trap 'set +x; date; echo -e "\033[1;41;37mFAIL\033[0m"' ERR
if test "$CI_VERBOSE_ENV" = "true"; then
date
env
fi
if test "$CI_PRINT_BAKE" = "true"; then
docker buildx bake --print $arg $bake_target
fi
@@ -104,8 +116,6 @@ fi
trap '' ERR
set -ux
docker buildx bake $arg $bake_target
set +x
echo -e "\033[1;42;30mPASS\033[0m"

View File

@@ -1,9 +1,12 @@
#!/bin/bash
set -eo pipefail
CI="${CI:-true}"
BASEDIR=$(dirname "$0")
CI="${CI:-false}"
CI_VERBOSE="${CI_VERBOSE_ENV:-false}"
CI_VERBOSE_ENV="${CI_VERBOSE_ENV:-$CI_VERBOSE}"
default_cargo_profile="test"
default_feat_set="all"
default_rust_toolchain="nightly"
@@ -34,11 +37,18 @@ sock="/var/run/docker.sock"
arg="--rm --name $name -v $sock:$sock --network=host $tester_image ${testee_image}"
trap 'set +x; date; echo -e "\033[1;41;37mFAIL\033[0m"' ERR
date
env
if test "$CI_VERBOSE_ENV" = "true"; then
date
env
fi
set -x -e
cid=$(docker run -d $arg)
set +x
trap 'docker container stop $cid; set +x; date; echo -e "\033[1;41;37mFAIL\033[0m"' INT
docker logs -f "$cid"
docker wait "$cid" 2>/dev/null
echo -e "\033[1;42;30mPASS\033[0m"