#!/usr/bin/env bash # ci-ubuntu.sh -- CI entrypoint for the de-nix build path. # # Designed to run inside a bare Ubuntu 24.04 container (the same baseline # customers use); the dependency install mirrors DEPS.md exactly. Local # developers who already have the deps can skip straight to the build step. # # Usage: scripts/ci-ubuntu.sh [--deps-only | --build-only] set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" DO_DEPS=1; DO_BUILD=1 case "${1:-}" in --deps-only) DO_BUILD=0 ;; --build-only) DO_DEPS=0 ;; esac if [ "$DO_DEPS" = 1 ]; then echo "=== Installing build toolchain + system libraries (DEPS.md) ===" export DEBIAN_FRONTEND=noninteractive apt-get update -qq # toolchain apt-get install -y -qq build-essential pkg-config ninja-build python3 python3-pip python3-venv ca-certificates git # meson >= 1.5 (Ubuntu 24.04's meson is 1.3 -- pip upgrades it in-place) apt-get install -y -qq meson || true meson --version 2>/dev/null | { read v; [ "${v%%.*}" -ge 1 ] && [ "${v#*.}" -ge 5 ] || pip3 install --break-system-packages 'meson>=1.5'; } || pip3 install --break-system-packages 'meson>=1.5' # cap'n proto (schema compiler + C++ runtime for pycapnp) apt-get install -y -qq capnproto libcapnp-dev # C libraries (DEPS.md "apt 可直接安装" table) apt-get install -y -qq libuv1-dev libssl-dev libedit-dev libsqlite3-dev \ libhwloc-dev libcgroup-dev libtirpc-dev libcyaml-dev libyaml-dev \ zlib1g-dev libsystemd-dev # Go toolchain (Ubuntu golang-go is fine for the vendored modules) command -v go >/dev/null 2>&1 || apt-get install -y -qq golang-go echo "=== deps installed ===" fi if [ "$DO_BUILD" = 1 ]; then echo "=== Building all components (asan profile: build + unit tests) ===" bash "$REPO_ROOT/src/tools/xce-build.sh" all asan echo "=== Building release profile (packaging prerequisite) ===" bash "$REPO_ROOT/src/tools/xce-build.sh" all release echo "=== Smoke: package a tarball ===" bash "$REPO_ROOT/src/tools/xce-package.sh" "$REPO_ROOT/src/build.release" "$REPO_ROOT/src/dist" echo "=== CI OK ===" fi