Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 42 additions & 45 deletions .github/workflows/desktop-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ jobs:
package:
name: Package (${{ matrix.platform.name }})
runs-on: ${{ matrix.platform.os }}
# Compile and bundle with Ubuntu 22.04's glibc on both Linux architectures.
container: ${{ startsWith(matrix.platform.name, 'linux-') && 'ubuntu:22.04' || '' }}
needs: prepare
if: needs.prepare.outputs.relay_image_only != 'true' && !inputs.artifact_run_ids && !inputs.verification_recovery_run_id
env:
Expand All @@ -220,6 +222,24 @@ jobs:
platform: ${{ fromJSON(needs.prepare.outputs.package_matrix) }}

steps:
- name: Install Linux desktop build dependencies
if: runner.os == 'Linux'
shell: bash
env:
DEBIAN_FRONTEND: noninteractive
run: |
apt-get update
# linuxdeploy needs the fcitx5 GTK3 module when it builds the AppImage.
apt-get install -y --no-install-recommends \
build-essential ca-certificates clang cmake curl file git jq \
libclang-dev pkg-config python3 unzip xz-utils \
xdg-utils libglib2.0-dev libgtk-3-dev libgstreamer1.0-dev \
libgstreamer-plugins-base1.0-dev gstreamer1.0-pipewire \
gstreamer1.0-plugins-base gstreamer1.0-plugins-good \
fcitx5-frontend-gtk3 libxdo-dev libwebkit2gtk-4.1-dev \
libayatana-appindicator3-dev librsvg2-dev patchelf fakeroot rpm \
libleptonica-dev libtesseract-dev tesseract-ocr tesseract-ocr-eng

# Also preserve bytes when rebuilding an older immutable tag that does
# not yet pin every hashed source file in .gitattributes.
- name: Preserve source bytes on Windows
Expand All @@ -232,6 +252,11 @@ jobs:
with:
ref: ${{ needs.prepare.outputs.checkout_ref }}

- name: Trust the Linux build checkout
if: runner.os == 'Linux'
shell: bash
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"

- name: Check Windows signing configuration
if: runner.os == 'Windows'
id: windows-signing
Expand Down Expand Up @@ -281,49 +306,6 @@ jobs:
where.exe makensis
makensis /VERSION

- name: Install Linux system dependencies (Tauri bundler)
if: runner.os == 'Linux'
shell: bash
run: |
sudo apt-get update

if apt-cache show libwebkit2gtk-4.1-dev >/dev/null 2>&1; then
WEBKIT_PKG=libwebkit2gtk-4.1-dev
else
WEBKIT_PKG=libwebkit2gtk-4.0-dev
fi

if apt-cache show libappindicator3-dev >/dev/null 2>&1; then
APPINDICATOR_PKG=libappindicator3-dev
else
APPINDICATOR_PKG=libayatana-appindicator3-dev
fi

# Tauri pins AppImage GTK input methods to its bundled cache, so the
# fcitx5 GTK3 bridge must be present before linuxdeploy builds it.
sudo apt-get install -y --no-install-recommends \
pkg-config \
xdg-utils \
libglib2.0-dev \
libgtk-3-dev \
libgstreamer1.0-dev \
libgstreamer-plugins-base1.0-dev \
gstreamer1.0-pipewire \
gstreamer1.0-plugins-base \
gstreamer1.0-plugins-good \
fcitx5-frontend-gtk3 \
libxdo-dev \
"$WEBKIT_PKG" \
"$APPINDICATOR_PKG" \
librsvg2-dev \
patchelf \
fakeroot \
rpm \
libleptonica-dev \
libtesseract-dev \
tesseract-ocr \
tesseract-ocr-eng

- name: Setup pnpm
uses: pnpm/action-setup@v5

Expand Down Expand Up @@ -376,6 +358,7 @@ jobs:
uses: swatinem/rust-cache@v2
with:
shared-key: "package-v2-${{ matrix.platform.name }}"
key: ${{ startsWith(matrix.platform.name, 'linux-') && 'ubuntu-22.04' || '' }}
cache-bin: false

- name: Install dependencies
Expand Down Expand Up @@ -490,10 +473,24 @@ jobs:
| tar -x -C "$verification_dir"
bash "$verification_dir/scripts/ci/verify-macos-signing.sh" "${{ matrix.platform.target }}"

- name: Verify AppImage fcitx5 GTK module
- name: Verify Linux desktop package
if: runner.os == 'Linux'
shell: bash
run: bash scripts/ci/verify-appimage-fcitx.sh "${{ matrix.platform.target }}"
env:
WORKFLOW_SHA: ${{ github.workflow_sha }}
TARGET: ${{ matrix.platform.target }}
run: |
set -euo pipefail
# Apply the current packaging checks when rebuilding an older tag.
verification_dir="$(mktemp -d)"
trap 'rm -rf "$verification_dir"' EXIT
if ! git cat-file -e "$WORKFLOW_SHA^{commit}"; then
git fetch --no-tags --depth=1 origin "$WORKFLOW_SHA"
fi
git archive "$WORKFLOW_SHA" scripts/ci/verify-linux-desktop-package.sh \
scripts/ci/check-glibc-floor.sh scripts/ci/linux-appimage-tray-libraries.json \
| tar -x -C "$verification_dir"
bash "$verification_dir/scripts/ci/verify-linux-desktop-package.sh" "$TARGET"

- name: Preserve macOS verification recovery bundles
if: failure() && runner.os == 'macOS' && steps.apple_verification.outcome == 'failure'
Expand Down
83 changes: 40 additions & 43 deletions .github/workflows/nightly-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ jobs:
package:
name: Package (${{ matrix.platform }})
if: ${{ inputs.build_desktop_packages }}
runs-on: ${{ fromJSON('{"linux-x64":"ubuntu-latest","linux-arm64":"ubuntu-24.04-arm","macos-arm64":"macos-15","macos-x64":"macos-15-intel","windows-x64":"windows-latest"}')[matrix.platform] }}
runs-on: ${{ fromJSON('{"linux-x64":"ubuntu-24.04","linux-arm64":"ubuntu-24.04-arm","macos-arm64":"macos-15","macos-x64":"macos-15-intel","windows-x64":"windows-latest"}')[matrix.platform] }}
# Use the same Linux build environment as Desktop Package.
container: ${{ startsWith(matrix.platform, 'linux-') && 'ubuntu:22.04' || '' }}
env:
NODE_OPTIONS: --max-old-space-size=6144
OPENBITFUN_RELEASE_CHANNEL: nightly
Expand All @@ -85,52 +87,32 @@ jobs:
platform: ${{ fromJSON(inputs.desktop_platforms) }}

steps:
- name: Install Linux desktop build dependencies
if: runner.os == 'Linux'
shell: bash
env:
DEBIAN_FRONTEND: noninteractive
run: |
apt-get update
# linuxdeploy needs the fcitx5 GTK3 module when it builds the AppImage.
apt-get install -y --no-install-recommends \
build-essential ca-certificates clang cmake curl file git jq \
libclang-dev pkg-config python3 unzip xz-utils \
xdg-utils libglib2.0-dev libgtk-3-dev libgstreamer1.0-dev \
libgstreamer-plugins-base1.0-dev gstreamer1.0-pipewire \
gstreamer1.0-plugins-base gstreamer1.0-plugins-good \
fcitx5-frontend-gtk3 libxdo-dev libwebkit2gtk-4.1-dev \
libayatana-appindicator3-dev librsvg2-dev patchelf fakeroot rpm \
libleptonica-dev libtesseract-dev tesseract-ocr tesseract-ocr-eng

- uses: actions/checkout@v5
with:
ref: ${{ inputs.checkout_ref }}

- name: Install Linux system dependencies (Tauri bundler)
- name: Trust the Linux build checkout
if: runner.os == 'Linux'
shell: bash
run: |
sudo apt-get update

if apt-cache show libwebkit2gtk-4.1-dev >/dev/null 2>&1; then
WEBKIT_PKG=libwebkit2gtk-4.1-dev
else
WEBKIT_PKG=libwebkit2gtk-4.0-dev
fi

if apt-cache show libappindicator3-dev >/dev/null 2>&1; then
APPINDICATOR_PKG=libappindicator3-dev
else
APPINDICATOR_PKG=libayatana-appindicator3-dev
fi

# Tauri pins AppImage GTK input methods to its bundled cache, so the
# fcitx5 GTK3 bridge must be present before linuxdeploy builds it.
sudo apt-get install -y --no-install-recommends \
pkg-config \
xdg-utils \
libglib2.0-dev \
libgtk-3-dev \
libgstreamer1.0-dev \
libgstreamer-plugins-base1.0-dev \
gstreamer1.0-pipewire \
gstreamer1.0-plugins-base \
gstreamer1.0-plugins-good \
fcitx5-frontend-gtk3 \
libxdo-dev \
"$WEBKIT_PKG" \
"$APPINDICATOR_PKG" \
librsvg2-dev \
patchelf \
fakeroot \
rpm \
libleptonica-dev \
libtesseract-dev \
tesseract-ocr \
tesseract-ocr-eng
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"

- name: Setup pnpm
uses: pnpm/action-setup@v5
Expand Down Expand Up @@ -185,6 +167,7 @@ jobs:
uses: swatinem/rust-cache@v2
with:
shared-key: "nightly-v3-${{ github.base_ref || github.ref_name }}-${{ matrix.platform }}"
key: ${{ startsWith(matrix.platform, 'linux-') && 'ubuntu-22.04' || '' }}
cache-bin: false
# A PR merge ref can never become a reusable base cache. Even a
# trusted caller cannot override this guard.
Expand Down Expand Up @@ -312,10 +295,24 @@ jobs:
"${{ steps.macos-cli.outputs.archive }}" \
"${{ steps.macos-cli.outputs.checksum }}"

- name: Verify AppImage fcitx5 GTK module
- name: Verify Linux desktop package
if: runner.os == 'Linux'
shell: bash
run: bash scripts/ci/verify-appimage-fcitx.sh "${{ env.PACKAGE_TARGET }}"
env:
WORKFLOW_SHA: ${{ github.workflow_sha }}
TARGET: ${{ env.PACKAGE_TARGET }}
run: |
set -euo pipefail
# Apply the current packaging checks when rebuilding an older tag.
verification_dir="$(mktemp -d)"
trap 'rm -rf "$verification_dir"' EXIT
if ! git cat-file -e "$WORKFLOW_SHA^{commit}"; then
git fetch --no-tags --depth=1 origin "$WORKFLOW_SHA"
fi
git archive "$WORKFLOW_SHA" scripts/ci/verify-linux-desktop-package.sh \
scripts/ci/check-glibc-floor.sh scripts/ci/linux-appimage-tray-libraries.json \
| tar -x -C "$verification_dir"
bash "$verification_dir/scripts/ci/verify-linux-desktop-package.sh" "$TARGET"

# Keep output validation independent from artifact upload. PR callers do
# not upload packages, but still need evidence that every selected
Expand Down
29 changes: 29 additions & 0 deletions scripts/check-github-config.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1695,6 +1695,35 @@ test('stable and beta publication require every producer, while artifact-only ru
});


test('Desktop release and nightly package Linux on Ubuntu 22.04 and verify before upload', () => {
const readPackageJob = (file) =>
yaml.parse(readFileSync(path.join(repoRoot, '.github/workflows', file), 'utf8')).jobs.package;
const release = readPackageJob('desktop-package.yml');
const nightly = readPackageJob('nightly-artifacts.yml');
const dependencies = (job) => job.steps.find((step) => step.name === 'Install Linux desktop build dependencies');

assert.equal(release.container, "${{ startsWith(matrix.platform.name, 'linux-') && 'ubuntu:22.04' || '' }}");
assert.equal(nightly.container, "${{ startsWith(matrix.platform, 'linux-') && 'ubuntu:22.04' || '' }}");
assert.equal(dependencies(release).run, dependencies(nightly).run);

for (const job of [release, nightly]) {
const checkout = job.steps.find((step) => step.uses === 'actions/checkout@v5');
const trust = job.steps.find((step) => step.name === 'Trust the Linux build checkout');
const verify = job.steps.find((step) => step.name === 'Verify Linux desktop package');
const buildIndex = job.steps.findIndex((step) => step.name === 'Build desktop app');
const uploadIndex = job.steps.findIndex((step) => step.name === 'Upload bundles');
assert.equal(trust.if, "runner.os == 'Linux'");
assert.equal(trust.run, 'git config --global --add safe.directory "$GITHUB_WORKSPACE"');
assert.ok(job.steps.indexOf(checkout) < job.steps.indexOf(trust));
assert.ok(job.steps.indexOf(trust) < buildIndex);
assert.equal(verify.if, "runner.os == 'Linux'");
assert.match(verify.run, /verify-linux-desktop-package\.sh/);
assert.match(verify.run, /linux-appimage-tray-libraries\.json/);
assert.ok(buildIndex >= 0 && buildIndex < job.steps.indexOf(verify));
assert.ok(job.steps.indexOf(verify) < uploadIndex);
}
});

test('Desktop recovery selects one platform and cannot publish an incomplete release', (t) => {
const workflow = yaml.parse(readFileSync(path.join(repoRoot, '.github/workflows/desktop-package.yml'), 'utf8'));
const step = workflow.jobs.prepare.steps.find((entry) => entry.name === 'Select Desktop package platforms');
Expand Down
39 changes: 16 additions & 23 deletions scripts/ci/check-glibc-floor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,17 @@ if ! command -v readelf >/dev/null 2>&1; then
exit 2
fi

# Highest GLIBC_x.y this binary asks for; empty when it needs none.
# The trailing `|| true` matters: `grep` exits non-zero when a binary has no
# versioned glibc symbols at all (a static build), and under `set -e` that
# would abort the whole run at the command substitution below.
# Read version requirements only. A shared library can also define symbols.
max_required_glibc() {
readelf -V "$1" 2>/dev/null |
grep -oE 'GLIBC_[0-9]+\.[0-9]+' |
sort -u -V |
tail -n 1 || true
LC_ALL=C readelf --version-info --wide "$1" |
awk '
/^Version .* section / { needs = /^Version needs section / }
needs && match($0, /Name: GLIBC_[0-9]+\.[0-9]+(\.[0-9]+)?/) {
print substr($0, RSTART + length("Name: "), RLENGTH - length("Name: "))
}
' |
LC_ALL=C sort -u -V |
tail -n 1
}

status=0
Expand All @@ -54,7 +56,11 @@ for bin in "$@"; do
status=1
continue
fi
required="$(max_required_glibc "$bin")"
if ! required="$(max_required_glibc "$bin")"; then
echo "ERROR: could not read ELF version information from $bin" >&2
status=1
continue
fi
if [ -z "$required" ]; then
echo "ok $(basename "$bin"): no versioned glibc requirement"
continue
Expand All @@ -63,24 +69,11 @@ for bin in "$@"; do
# sort -V puts the larger version last: if that is not MAX, MAX was exceeded.
highest="$(printf '%s\n%s\n' "$MAX" "$required" | sort -V | tail -n 1)"
if [ "$highest" != "$MAX" ]; then
echo "FAIL $(basename "$bin"): requires glibc $required, above the $MAX floor" >&2
echo "FAIL $bin: requires glibc $required, above the $MAX floor" >&2
status=1
else
echo "ok $(basename "$bin"): requires glibc $required (floor $MAX)"
fi
done

if [ "$status" -ne 0 ]; then
cat >&2 <<EOF

The binary needs a newer glibc than this release promises, so it cannot run on
older distributions or in the relay deploy runtime image.

Fix one of these, deliberately:
- Build on an older runner image (this is what keeps the floor low), or
- raise the declared floor here AND in the relay runtime base image
(src/apps/relay-server/release-download.sh), remembering that already
published archives keep whatever floor they were built with.
EOF
fi
exit "$status"
3 changes: 2 additions & 1 deletion scripts/ci/classify-build-impact.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,8 @@ function isMacPackageInput(file) {
}

function isLinuxDesktopPackageInput(file) {
return file === 'scripts/ci/verify-appimage-fcitx.sh'
return file === 'scripts/ci/verify-linux-desktop-package.sh'
|| file === 'scripts/ci/check-glibc-floor.sh'
|| file.startsWith('scripts/linux/')
|| file.includes('/linux/')
|| /(?:appimage|linuxdeploy|\.deb\b|\.rpm\b)/i.test(file);
Expand Down
11 changes: 10 additions & 1 deletion scripts/ci/classify-build-impact.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,22 @@ test('maps representative changes to the smallest predictive validation', () =>
}),
},
{
paths: ['scripts/ci/verify-appimage-fcitx.sh'],
paths: ['scripts/ci/verify-linux-desktop-package.sh'],
result: expected({
rustRequired: true,
desktopPlatforms: ['linux-x64', 'linux-arm64'],
reason: 'platform-package-input',
}),
},
{
paths: ['scripts/ci/check-glibc-floor.sh'],
result: expected({
rustRequired: true,
desktopPlatforms: ['linux-x64', 'linux-arm64'],
linuxBinariesRequired: true,
reason: 'platform-package-input',
}),
},
...[
'scripts/prepare-flashgrep-resource.mjs',
'resources/flashgrep/VERSION.json',
Expand Down
7 changes: 7 additions & 0 deletions scripts/ci/linux-appimage-tray-libraries.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[
"libayatana-appindicator3.so.1",
"libayatana-ido3-0.4.so.0",
"libayatana-indicator3.so.7",
"libdbusmenu-glib.so.4",
"libdbusmenu-gtk3.so.4"
]
Loading
Loading