fix CI build pipeline

This commit is contained in:
Logan Rawlins committed 2026-11-01 14:27:34 -07:00
1 parent b60e18fe6b
commit c19cd28de8
9 files changed
+99 -17

No files matched your search

+1
View File
@@ -1,5 +1,6 @@
{
"ubuntu": "ubuntu:24.04@sha256:fe81560990fae86dc4743202b2cb4d3df98d0bcf949173cecef15ce1127ef852",
"glibc": "2.39",
"flutter": {
"version": "3.47.4",
"url": "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.47.4-stable.tar.xz",
+2 -2
View File
@@ -5,8 +5,8 @@ ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates clang cmake ninja-build pkg-config libgtk-3-dev \
librsvg2-dev libgirepository1.0-dev libgdk-pixbuf-2.0-dev libgtk-3-bin \
libgdk-pixbuf2.0-bin libgdk-pixbuf2.0-dev binutils patchelf curl jq \
file desktop-file-utils xdg-user-dirs git rsync unzip xz-utils make g++ \
libgdk-pixbuf2.0-bin binutils patchelf curl jq \
file desktop-file-utils xdg-user-dirs git rsync unzip xz-utils make g++ dpkg-dev \
libssl-dev libunwind-dev libvulkan-dev libgl1-mesa-dev libglu1-mesa-dev \
libasound2-dev libsecret-1-dev \
&& rm -rf /var/lib/apt/lists/*
+56
View File
@@ -50,4 +50,60 @@ assert_fails download_verified "file://$temporary/input" \
printf 'corruption\n' >> "$temporary/cache/tool"
assert_fails download_verified "file://$temporary/input" "$checksum" "$temporary/cache/tool"
mkdir -p "$temporary/project/scripts/appimage"
touch "$temporary/project/pubspec.lock"
cp "$project/scripts/appimage/Dockerfile" "$temporary/project/scripts/appimage/"
# shellcheck disable=SC2329
podman() {
case "$1" in
info) [[ "$mock_engine" == podman ]] ;;
image) return 0 ;;
run) printf '%s\n' "$@" > "$temporary/container-arguments" ;;
*) return 1 ;;
esac
}
# shellcheck disable=SC2329
docker() {
case "$1" in
info|image) return 0 ;;
run) printf '%s\n' "$@" > "$temporary/container-arguments" ;;
*) return 1 ;;
esac
}
mock_engine=podman
package_container "$temporary/project" "$temporary/output" \
"$project/scripts/appimage-tools.json" "$temporary/container-cache"
grep -Fxq -- '--userns=keep-id' "$temporary/container-arguments"
grep -Fxq -- "$(id -u):$(id -g)" "$temporary/container-arguments"
mock_engine=docker
package_container "$temporary/project" "$temporary/output" \
"$project/scripts/appimage-tools.json" "$temporary/container-cache"
assert_fails grep -Fxq -- '--userns=keep-id' "$temporary/container-arguments"
grep -Fxq -- "$(id -u):$(id -g)" "$temporary/container-arguments"
unset -f podman docker
# shellcheck disable=SC2329
readelf() {
printf '%s\n' "$mock_interpreter"
}
# shellcheck disable=SC2329
getconf() {
printf 'glibc %s\n' "$mock_glibc"
}
mock_interpreter=/lib64/ld-linux-x86-64.so.2
mock_glibc=2.39
assert_fails requires_container_rebuild "$temporary/bundle/meshcore_open" 2.39
mock_glibc=2.43
requires_container_rebuild "$temporary/bundle/meshcore_open" 2.39
mock_interpreter=/nix/store/glibc/lib/ld-linux-x86-64.so.2
mock_glibc=2.39
requires_container_rebuild "$temporary/bundle/meshcore_open" 2.39
unset -f readelf getconf
printf 'AppImage packaging contract tests passed\n'
+23 -3
View File
@@ -240,7 +240,7 @@ package_container() {
mkdir -p "$cache" "$cache/pub"
pin="$(sha256sum "$manifest" "$project/scripts/appimage/Dockerfile" | sha256sum)"
image="meshcore-open-appimage:${pin:0:16}"
printf 'AppImage: rebuilding in Ubuntu with %s (Flutter %s); native Nix bundle is unchanged\n' \
printf 'AppImage: rebuilding in Ubuntu with %s (Flutter %s); original native bundle is unchanged\n' \
"$engine" "$(jq -r '.flutter.version' "$manifest")"
if ! "$engine" image inspect "$image" >/dev/null 2>&1; then
"$engine" build --target build --platform linux/amd64 --tag "$image" \
@@ -252,13 +252,33 @@ package_container() {
for key in FLUTTER_TARGET DART_DEFINES DART_OBFUSCATION SPLIT_DEBUG_INFO TREE_SHAKE_ICONS; do
environment+=(--env "MESHCORE_APPIMAGE_$key")
done
"$engine" run --rm --platform linux/amd64 --user "$(id -u):$(id -g)" \
local user_namespace=()
if [[ "$engine" == podman ]]; then
user_namespace+=(--userns=keep-id)
fi
"$engine" run --rm --platform linux/amd64 "${user_namespace[@]}" --user "$(id -u):$(id -g)" \
"${environment[@]}" --mount "type=bind,source=$(realpath "$project"),target=/source,readonly" \
--mount "type=bind,source=$output,target=/output" \
--mount "type=bind,source=$cache,target=/cache" \
"$image" bash /source/scripts/build_appimage.sh --container-build
}
requires_container_rebuild() {
local executable="$1" baseline="$2" host_glibc host_major host_minor baseline_major baseline_minor
if [[ "$(readelf -l "$executable")" == *'/nix/store/'* ]]; then
return 0
fi
host_glibc="$(getconf GNU_LIBC_VERSION)" || return 0
host_glibc="${host_glibc#glibc }"
host_major="${host_glibc%%.*}"
host_minor="${host_glibc#*.}"
host_minor="${host_minor%%.*}"
baseline_major="${baseline%%.*}"
baseline_minor="${baseline#*.}"
[[ "$host_major" =~ ^[0-9]+$ && "$host_minor" =~ ^[0-9]+$ ]] || return 0
(( host_major > baseline_major || (host_major == baseline_major && host_minor > baseline_minor) ))
}
main() {
[[ $# == 5 ]] || { fail 'Expected: project bundle output configuration architecture'; return 1; }
local project="$1" bundle="$2" output="$3" configuration="$4" architecture="$5"
@@ -276,7 +296,7 @@ main() {
pin="$(sha256sum "$manifest")"
pin="${pin%% *}"
cache="${XDG_CACHE_HOME:-$HOME/.cache}/meshcore-open/appimage/$pin/x86_64"
if [[ "$(readelf -l "$bundle/meshcore_open")" == *'/nix/store/'* ]]; then
if requires_container_rebuild "$bundle/meshcore_open" "$(jq -er '.glibc' "$manifest")"; then
package_container "$project" "$output" "$manifest" "$cache"
else
package_direct "$project" "$bundle" "$output" "$manifest" "$cache"