aman/scripts/ci_portable_smoke.sh
Thales Maciel dd2813340b Align CI with the validated Ubuntu support floor
Stop implying that one Ubuntu 3.11 unit lane validates the full Linux support surface Aman documents.\n\nSplit CI into an Ubuntu CPython 3.10/3.11/3.12 unit-package matrix, a portable install plus doctor smoke lane, and a packaging lane gated on both. Add a reproducible ci_portable_smoke.sh helper with fake systemctl coverage, and force the installer onto /usr/bin/python3 so the smoke path uses the distro-provided GI and X11 Python packages it is meant to validate.\n\nUpdate the README, release/distribution docs, and Debian metadata to distinguish the automated Ubuntu CI floor from broader manual GA signoff families, and add the missing AppIndicator introspection package to the Ubuntu/Debian dependency lists.\n\nValidate with python3 -m unittest discover -s tests -p 'test_*.py', python3 -m py_compile src/*.py tests/*.py, and bash -n scripts/ci_portable_smoke.sh. The full xvfb-backed smoke could not be run locally in this sandbox because xvfb-run is unavailable.
2026-03-14 15:45:21 -03:00

136 lines
3.4 KiB
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
source "${SCRIPT_DIR}/package_common.sh"
require_command mktemp
require_command tar
require_command xvfb-run
DISTRO_PYTHON="${AMAN_CI_SYSTEM_PYTHON:-/usr/bin/python3}"
require_command "${DISTRO_PYTHON}"
LOG_DIR="${BUILD_DIR}/ci-smoke"
RUN_DIR="${LOG_DIR}/run"
HOME_DIR="${RUN_DIR}/home"
FAKE_BIN_DIR="${RUN_DIR}/fake-bin"
EXTRACT_DIR="${RUN_DIR}/bundle"
RUNTIME_DIR="${RUN_DIR}/xdg-runtime"
COMMAND_LOG="${LOG_DIR}/commands.log"
SYSTEMCTL_LOG="${LOG_DIR}/systemctl.log"
dump_logs() {
local path
for path in "${COMMAND_LOG}" "${SYSTEMCTL_LOG}" "${LOG_DIR}"/*.stdout.log "${LOG_DIR}"/*.stderr.log; do
if [[ -f "${path}" ]]; then
echo "=== ${path#${ROOT_DIR}/} ==="
cat "${path}"
fi
done
}
on_exit() {
local status="$1"
if [[ "${status}" -ne 0 ]]; then
dump_logs
fi
}
trap 'on_exit $?' EXIT
run_logged() {
local name="$1"
shift
local stdout_log="${LOG_DIR}/${name}.stdout.log"
local stderr_log="${LOG_DIR}/${name}.stderr.log"
{
printf "+"
printf " %q" "$@"
printf "\n"
} >>"${COMMAND_LOG}"
"$@" >"${stdout_log}" 2>"${stderr_log}"
}
rm -rf "${LOG_DIR}"
mkdir -p "${HOME_DIR}" "${FAKE_BIN_DIR}" "${EXTRACT_DIR}" "${RUNTIME_DIR}"
: >"${COMMAND_LOG}"
: >"${SYSTEMCTL_LOG}"
cat >"${FAKE_BIN_DIR}/systemctl" <<'EOF'
#!/usr/bin/env bash
set -euo pipefail
log_path="${SYSTEMCTL_LOG:?}"
if [[ "${1:-}" == "--user" ]]; then
shift
fi
printf '%s\n' "$*" >>"${log_path}"
case "$*" in
"daemon-reload")
;;
"enable --now aman")
;;
"stop aman")
;;
"disable --now aman")
;;
"is-system-running")
printf 'running\n'
;;
"show aman --property=FragmentPath --value")
printf '%s\n' "${AMAN_CI_SERVICE_PATH:?}"
;;
"is-enabled aman")
printf 'enabled\n'
;;
"is-active aman")
printf 'active\n'
;;
*)
echo "unexpected systemctl command: $*" >&2
exit 1
;;
esac
EOF
chmod 0755 "${FAKE_BIN_DIR}/systemctl"
run_logged package-portable bash "${SCRIPT_DIR}/package_portable.sh"
VERSION="$(project_version)"
PACKAGE_NAME="$(project_name)"
PORTABLE_TARBALL="${DIST_DIR}/${PACKAGE_NAME}-x11-linux-${VERSION}.tar.gz"
BUNDLE_DIR="${EXTRACT_DIR}/${PACKAGE_NAME}-x11-linux-${VERSION}"
run_logged extract tar -C "${EXTRACT_DIR}" -xzf "${PORTABLE_TARBALL}"
export HOME="${HOME_DIR}"
export PATH="${FAKE_BIN_DIR}:${HOME_DIR}/.local/bin:${PATH}"
export SYSTEMCTL_LOG
export AMAN_CI_SERVICE_PATH="${HOME_DIR}/.config/systemd/user/aman.service"
run_logged distro-python "${DISTRO_PYTHON}" --version
(
cd "${BUNDLE_DIR}"
run_logged install env \
PATH="${FAKE_BIN_DIR}:${HOME_DIR}/.local/bin:$(dirname "${DISTRO_PYTHON}"):${PATH}" \
./install.sh
)
run_logged version "${HOME_DIR}/.local/bin/aman" version
run_logged init "${HOME_DIR}/.local/bin/aman" init --config "${HOME_DIR}/.config/aman/config.json"
run_logged doctor xvfb-run -a env \
HOME="${HOME_DIR}" \
PATH="${PATH}" \
SYSTEMCTL_LOG="${SYSTEMCTL_LOG}" \
AMAN_CI_SERVICE_PATH="${AMAN_CI_SERVICE_PATH}" \
XDG_RUNTIME_DIR="${RUNTIME_DIR}" \
XDG_SESSION_TYPE="x11" \
"${HOME_DIR}/.local/bin/aman" doctor --config "${HOME_DIR}/.config/aman/config.json"
run_logged uninstall "${HOME_DIR}/.local/share/aman/current/uninstall.sh" --purge
echo "portable smoke passed"
echo "logs: ${LOG_DIR}"
cat "${LOG_DIR}/doctor.stdout.log"