The Windows ARM64 release package failed to launch on startup due to missing runtime DLLs (libdbus-1-3.dll, libmd4c.dll, zlib1.dll, libzstd.dll). This failure stemmed from several architectural and CI pipeline issues: 1. CMake unconditionally linked Qt6::DBus whenever available in the sysroot, introducing an unnecessary dependency on Qt6DBus.dll and libdbus-1-3.dll on Windows, even though D-Bus portal dialogs are only used on Linux. 2. The Docker build environment installed MSYS2 ARM64 Qt packages via an unchecked shell loop against a hardcoded package list. This missed crucial transitive runtime dependencies (such as md4c, zlib-ng-compat, libb2, and ICU) and failed silently when downloads or extractions broke. 3. Windows packaging lacked PE import verification, allowing broken packages with unresolved dynamic links to be produced and published without warning. To fix these issues and make image management more accessible: - Restrict Qt6::DBus detection and linking in CMakeLists.txt to Linux only, eliminating the D-Bus dependency from Windows builds. - Introduce scripts/download-mingw-arm64-qt.py to parse the MSYS2 clangarm64 database, resolve the complete transitive dependency graph, and verify essential runtime DLLs during the Docker image build. - Introduce scripts/verify-windows-dlls.py and integrate it into packaging/package-windows.sh to validate PE imports across the executable and bundled Qt plugins, failing packaging if any non-system DLL is missing. - Expose FORCE_REBUILD_IMAGE as a typed GitLab CI pipeline input (spec: inputs) to provide an interactive dropdown when triggering manual pipelines in the UI, and trigger container rebuilds when the download script changes. - Update AGENTS.md documentation to reflect the new dependency and packaging verification workflows.
350 lines
12 KiB
YAML
350 lines
12 KiB
YAML
spec:
|
|
inputs:
|
|
FORCE_REBUILD_IMAGE:
|
|
description: "Force (true) or skip (false) building the runner image, even if files changed"
|
|
type: string
|
|
options:
|
|
- "auto"
|
|
- "true"
|
|
- "false"
|
|
default: "auto"
|
|
---
|
|
workflow:
|
|
auto_cancel:
|
|
on_new_commit: interruptible
|
|
rules:
|
|
- if: '"$[[ inputs.FORCE_REBUILD_IMAGE ]]" == "true" || $FORCE_REBUILD_IMAGE == "true"'
|
|
variables:
|
|
CI_PIPELINE_TYPE: image-rebuild
|
|
- if: '"$[[ inputs.FORCE_REBUILD_IMAGE ]]" == "false" || $FORCE_REBUILD_IMAGE == "false"'
|
|
variables:
|
|
CI_PIPELINE_TYPE: normal
|
|
- changes:
|
|
- docker/Dockerfile.build
|
|
- scripts/download-mingw-arm64-qt.py
|
|
- scripts/install-deps-ubuntu.sh
|
|
- scripts/mingw-w64-toolchain.cmake
|
|
- scripts/mingw-w64-arm64-toolchain.cmake
|
|
variables:
|
|
CI_PIPELINE_TYPE: image-rebuild
|
|
- variables:
|
|
CI_PIPELINE_TYPE: normal
|
|
|
|
stages:
|
|
- build
|
|
- test
|
|
- package
|
|
- wiki
|
|
|
|
variables:
|
|
GIT_CLEAN_FLAGS: -fdx
|
|
|
|
# ── Build the runner image and push to registry ────────────────────────────────
|
|
build-docker:
|
|
stage: build
|
|
image: docker:27
|
|
services:
|
|
- docker:27-dind
|
|
variables:
|
|
DOCKER_TLS_CERTDIR: "/certs"
|
|
DOCKER_IMAGE: "${CI_REGISTRY_IMAGE}/build-env:latest"
|
|
before_script:
|
|
- docker login -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}" "${CI_REGISTRY}"
|
|
script:
|
|
- docker build
|
|
--build-arg QT_VERSION=6.10.3
|
|
-t "${DOCKER_IMAGE}"
|
|
-f docker/Dockerfile.build .
|
|
- docker push "${DOCKER_IMAGE}"
|
|
rules:
|
|
- if: $CI_PIPELINE_TYPE == "image-rebuild"
|
|
|
|
# ── Linux native build ─────────────────────────────────────────────────────────
|
|
build-linux:
|
|
interruptible: true
|
|
tags:
|
|
- linux-qt
|
|
stage: build
|
|
script:
|
|
- cmake -B build-linux -G Ninja -DCMAKE_BUILD_TYPE=Release
|
|
-DCMAKE_PREFIX_PATH="${QT_LINUX_DIR}"
|
|
- cmake --build build-linux --target asteria-qt
|
|
artifacts:
|
|
name: "asteria-qt-linux-${CI_COMMIT_SHORT_SHA}"
|
|
paths:
|
|
- build-linux/asteria-qt
|
|
expire_in: 1 day
|
|
when: on_success
|
|
rules:
|
|
- if: $CI_PIPELINE_TYPE == "image-rebuild"
|
|
when: never
|
|
- when: on_success
|
|
|
|
# ── Windows cross-compile build (MinGW-w64 x86_64) ───────────────────────────
|
|
build-windows:
|
|
interruptible: true
|
|
tags:
|
|
- linux-qt
|
|
stage: build
|
|
script:
|
|
- PKG_CONFIG_PATH="${MINGW_SYSROOT}/lib/pkgconfig" cmake -B build-windows -G Ninja
|
|
-DCMAKE_BUILD_TYPE=Release
|
|
-DCMAKE_TOOLCHAIN_FILE="${CI_PROJECT_DIR}/scripts/mingw-w64-toolchain.cmake"
|
|
-DCMAKE_PREFIX_PATH="${QT_WINDOWS_DIR};${MINGW_SYSROOT}"
|
|
-DCMAKE_FIND_ROOT_PATH="${QT_WINDOWS_DIR};${MINGW_SYSROOT}"
|
|
-DQT_HOST_PATH="${QT_LINUX_DIR}"
|
|
- cmake --build build-windows --target asteria-qt
|
|
artifacts:
|
|
name: "asteria-qt-windows-${CI_COMMIT_SHORT_SHA}"
|
|
paths:
|
|
- build-windows/asteria-qt.exe
|
|
expire_in: 1 day
|
|
when: on_success
|
|
rules:
|
|
- if: $CI_PIPELINE_TYPE == "image-rebuild"
|
|
when: never
|
|
- when: on_success
|
|
|
|
# ── Windows cross-compile build (LLVM-MinGW ARM64) ────────────────────────────
|
|
build-windows-arm64:
|
|
interruptible: true
|
|
tags:
|
|
- linux-qt
|
|
stage: build
|
|
script:
|
|
- PKG_CONFIG_PATH="${MINGW_ARM64_SYSROOT}/lib/pkgconfig" cmake -B build-windows-arm64 -G Ninja
|
|
-DCMAKE_BUILD_TYPE=Release
|
|
-DCMAKE_TOOLCHAIN_FILE="${CI_PROJECT_DIR}/scripts/mingw-w64-arm64-toolchain.cmake"
|
|
-DCMAKE_PREFIX_PATH="${QT_WINDOWS_ARM64_DIR};${MINGW_ARM64_SYSROOT}"
|
|
-DCMAKE_FIND_ROOT_PATH="${QT_WINDOWS_ARM64_DIR};${MINGW_ARM64_SYSROOT}"
|
|
-DQT_HOST_PATH="${QT_LINUX_DIR}"
|
|
- cmake --build build-windows-arm64 --target asteria-qt
|
|
artifacts:
|
|
name: "asteria-qt-windows-arm64-${CI_COMMIT_SHORT_SHA}"
|
|
paths:
|
|
- build-windows-arm64/asteria-qt.exe
|
|
expire_in: 1 day
|
|
when: on_success
|
|
rules:
|
|
- if: $CI_PIPELINE_TYPE == "image-rebuild"
|
|
when: never
|
|
- when: on_success
|
|
|
|
# ── macOS native build ─────────────────────────────────────────────────────────
|
|
build-macos:
|
|
interruptible: true
|
|
allow_failure: true
|
|
timeout: 10m
|
|
tags:
|
|
- macos-qt
|
|
stage: build
|
|
script:
|
|
- export PATH="/opt/homebrew/bin:/usr/local/bin:${PATH}"
|
|
- export PKG_CONFIG_PATH="$(brew --prefix libarchive)/lib/pkgconfig:${PKG_CONFIG_PATH:-}"
|
|
- cmake -B build-macos -G Ninja -DCMAKE_BUILD_TYPE=Release
|
|
-DCMAKE_PREFIX_PATH="${QT_MACOS_DIR:-/opt/qt/6.10.3/macos}"
|
|
- cmake --build build-macos --target asteria-qt
|
|
artifacts:
|
|
name: "asteria-qt-macos-${CI_COMMIT_SHORT_SHA}"
|
|
paths:
|
|
- build-macos/asteria-qt.app
|
|
expire_in: 1 day
|
|
when: on_success
|
|
rules:
|
|
- if: $CI_PIPELINE_TYPE == "image-rebuild"
|
|
when: never
|
|
- when: on_success
|
|
|
|
# ── Linux tests ────────────────────────────────────────────────────────────────
|
|
test-linux:
|
|
interruptible: true
|
|
tags:
|
|
- linux-qt
|
|
stage: test
|
|
needs: []
|
|
script:
|
|
- cmake -B build-linux -G Ninja -DCMAKE_BUILD_TYPE=Release
|
|
-DCMAKE_PREFIX_PATH="${QT_LINUX_DIR}"
|
|
- cmake --build build-linux
|
|
- QT_QPA_PLATFORM=offscreen ctest --test-dir build-linux --output-on-failure
|
|
rules:
|
|
- if: $CI_PIPELINE_TYPE == "image-rebuild"
|
|
when: never
|
|
- when: on_success
|
|
|
|
# ── macOS tests ────────────────────────────────────────────────────────────────
|
|
test-macos:
|
|
interruptible: true
|
|
allow_failure: true
|
|
timeout: 10m
|
|
tags:
|
|
- macos-qt
|
|
stage: test
|
|
needs: []
|
|
script:
|
|
- export PATH="/opt/homebrew/bin:/usr/local/bin:${PATH}"
|
|
- export PKG_CONFIG_PATH="$(brew --prefix libarchive)/lib/pkgconfig:${PKG_CONFIG_PATH:-}"
|
|
- cmake -B build-macos -G Ninja -DCMAKE_BUILD_TYPE=Release
|
|
-DCMAKE_PREFIX_PATH="${QT_MACOS_DIR:-/opt/qt/6.10.3/macos}"
|
|
- cmake --build build-macos
|
|
- QT_QPA_PLATFORM=offscreen ctest --test-dir build-macos --output-on-failure
|
|
rules:
|
|
- if: $CI_PIPELINE_TYPE == "image-rebuild"
|
|
when: never
|
|
- when: on_success
|
|
|
|
# ── Package Linux as AppImage ─────────────────────────────────────────────
|
|
package-linux:
|
|
interruptible: true
|
|
tags:
|
|
- linux-qt
|
|
stage: package
|
|
needs:
|
|
- build-linux
|
|
- test-linux
|
|
script:
|
|
- chmod +x packaging/package-linux.sh
|
|
- packaging/package-linux.sh build-linux "${QT_LINUX_DIR}" .
|
|
artifacts:
|
|
name: "asteria-qt-linux-appimage-${CI_COMMIT_SHORT_SHA}"
|
|
paths:
|
|
- Asteria-x86_64.AppImage
|
|
expire_in: 1 day
|
|
when: on_success
|
|
rules:
|
|
- if: $CI_PIPELINE_TYPE == "image-rebuild"
|
|
when: never
|
|
- when: on_success
|
|
|
|
# ── Package Windows x86_64 as portable zip ───────────────────────────────────
|
|
package-windows:
|
|
interruptible: true
|
|
tags:
|
|
- linux-qt
|
|
stage: package
|
|
needs:
|
|
- build-windows
|
|
script:
|
|
- chmod +x packaging/package-windows.sh
|
|
- packaging/package-windows.sh build-windows "${QT_WINDOWS_DIR}" "${MINGW_SYSROOT}" . x86_64
|
|
artifacts:
|
|
name: "asteria-qt-windows-${CI_COMMIT_SHORT_SHA}"
|
|
paths:
|
|
- asteria-qt-windows/
|
|
expire_in: 1 day
|
|
when: on_success
|
|
rules:
|
|
- if: $CI_PIPELINE_TYPE == "image-rebuild"
|
|
when: never
|
|
- when: on_success
|
|
|
|
# ── Package Windows ARM64 as portable zip ─────────────────────────────────────
|
|
package-windows-arm64:
|
|
interruptible: true
|
|
tags:
|
|
- linux-qt
|
|
stage: package
|
|
needs:
|
|
- build-windows-arm64
|
|
script:
|
|
- chmod +x packaging/package-windows.sh
|
|
- packaging/package-windows.sh build-windows-arm64 "${QT_WINDOWS_ARM64_DIR}" "${MINGW_ARM64_SYSROOT}" . arm64
|
|
artifacts:
|
|
name: "asteria-qt-windows-arm64-${CI_COMMIT_SHORT_SHA}"
|
|
paths:
|
|
- asteria-qt-windows-arm64/
|
|
expire_in: 1 day
|
|
when: on_success
|
|
rules:
|
|
- if: $CI_PIPELINE_TYPE == "image-rebuild"
|
|
when: never
|
|
- when: on_success
|
|
|
|
# ── Package macOS as DMG ──────────────────────────────────────────────────────
|
|
package-macos:
|
|
interruptible: true
|
|
allow_failure: true
|
|
timeout: 10m
|
|
tags:
|
|
- macos-qt
|
|
stage: package
|
|
needs:
|
|
- build-macos
|
|
- test-macos
|
|
variables:
|
|
CODESIGN: "true"
|
|
script:
|
|
- export PATH="/opt/homebrew/bin:/usr/local/bin:${PATH}"
|
|
- chmod +x packaging/package-macos.sh
|
|
- packaging/package-macos.sh build-macos "${QT_MACOS_DIR:-/opt/qt/6.10.3/macos}" .
|
|
artifacts:
|
|
name: "asteria-qt-macos-dmg-${CI_COMMIT_SHORT_SHA}"
|
|
paths:
|
|
- Asteria.dmg
|
|
expire_in: 1 day
|
|
when: on_success
|
|
rules:
|
|
- if: $CI_PIPELINE_TYPE == "image-rebuild"
|
|
when: never
|
|
- when: on_success
|
|
|
|
# ── Update wiki with latest dev build links ────────────────────────────────────
|
|
update-wiki:
|
|
stage: wiki
|
|
tags:
|
|
- linux-qt
|
|
needs:
|
|
- package-linux
|
|
- package-windows
|
|
- package-windows-arm64
|
|
- job: package-macos
|
|
optional: true
|
|
script:
|
|
- |
|
|
if [ -z "${GITLAB_TOKEN}" ]; then
|
|
echo "ERROR: GITLAB_TOKEN CI/CD variable is not set"
|
|
exit 1
|
|
fi
|
|
- PROJECT_URL="https://gitlab.com/asteria-bookreader/asteria-qt"
|
|
- API_URL="https://gitlab.com/api/v4/projects/${CI_PROJECT_ID}"
|
|
- WIKI_URL="${API_URL}/wikis/home"
|
|
- ARTIFACTS_URL="${PROJECT_URL}/-/jobs/artifacts/${CI_COMMIT_REF_NAME}/download"
|
|
- LINUX_URL="${PROJECT_URL}/-/jobs/artifacts/${CI_COMMIT_REF_NAME}/raw/Asteria-x86_64.AppImage?job=package-linux"
|
|
- WINDOWS_URL="${ARTIFACTS_URL}?job=package-windows"
|
|
- WINDOWS_ARM64_URL="${ARTIFACTS_URL}?job=package-windows-arm64"
|
|
- MACOS_URL="${PROJECT_URL}/-/jobs/artifacts/${CI_COMMIT_REF_NAME}/raw/Asteria.dmg?job=package-macos"
|
|
- |
|
|
HTTP_CODE=$(curl -s -o /tmp/wiki.json -w '%{http_code}' \
|
|
--header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" \
|
|
"${WIKI_URL}")
|
|
|
|
NEW_SECTION=$(printf '## Latest dev builds\n\n> Updated automatically by pipeline [#%s](%s) from `%s` @ %s\n\n| Platform | Download |\n|----------|----------|\n| Linux (x86_64) | [AppImage](%s) |\n| Windows (x86_64) | [Portable zip](%s) |\n| Windows (ARM64) | [Portable zip](%s) |\n| macOS | [DMG](%s) |' \
|
|
"${CI_PIPELINE_ID}" "${CI_PIPELINE_URL}" "${CI_COMMIT_REF_NAME}" "${CI_COMMIT_SHORT_SHA}" \
|
|
"${LINUX_URL}" "${WINDOWS_URL}" "${WINDOWS_ARM64_URL}" "${MACOS_URL}")
|
|
|
|
if [ "${HTTP_CODE}" = "200" ]; then
|
|
WIKI_CONTENT=$(jq -r '.content' /tmp/wiki.json)
|
|
if printf '%s' "${WIKI_CONTENT}" | grep -q '^## Latest dev builds'; then
|
|
UPDATED=$(printf '%s' "${WIKI_CONTENT}" | awk -v new="${NEW_SECTION}" '
|
|
/^## Latest dev builds/ { found=1; printf "%s\n", new; next }
|
|
found && /^## / { found=0 }
|
|
!found { print }
|
|
')
|
|
else
|
|
UPDATED=$(printf '%s\n\n%s' "${WIKI_CONTENT}" "${NEW_SECTION}")
|
|
fi
|
|
curl -sf -X PUT \
|
|
--header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" \
|
|
--header "Content-Type: application/json" \
|
|
--data "$(jq -n --arg c "${UPDATED}" '{content:$c}')" \
|
|
"${WIKI_URL}"
|
|
else
|
|
echo "ERROR: GitLab API returned HTTP ${HTTP_CODE}"
|
|
cat /tmp/wiki.json
|
|
exit 1
|
|
fi
|
|
rules:
|
|
- if: $CI_PIPELINE_TYPE == "image-rebuild"
|
|
when: never
|
|
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|