hex/.github/workflows/build-desktop.yml
Dax 8a130e63e5
Lowercase release file names; README downloads by channel (#456) (#601)
* Lowercase release file names; README downloads by channel (#456)

Release builds and the GitHub release mirror now name files hex-<version>-macos-arm64.{zip,dmg}, hex-<version>-windows-<arch>.exe and hex-setup-<version>-windows-<arch>.exe (Linux was already lowercase), as @vixalien asked in #456. Already-published files and the frozen 2.3.1 feeds keep their names; the release service's published names (hex, Hex.dmg, Hex.zip, hex.exe, HexSetup.exe) and the bundle (Hex.app) are unchanged, so the updater, installers, Homebrew cask, AUR and Nix are unaffected.

The README downloads table has Stable and Dev columns for every target, including the updater files. The site Worker serves /hex/download/dev/<target> (the dev alias) beside /hex/download/<target> (stable, or dev while there is none), and both now cover the bare updater files.

* Lowercase names in two remaining examples

* Lowercase the Windows executable in the CPU check step
2026-10-31 12:51:09 -04:00

255 lines
11 KiB
YAML

name: Build desktop
# Builds the unsigned Linux x64 and ARM64 executables with their .deb and
# .rpm packages, and the Windows x64 and ARM64 executables, from one commit,
# named as the release service targets
# (docs/plans/release-service.md). Release calls it for every release, Test
# builds with test-build so every push to dev has downloadable builds that
# never update themselves.
#
# These jobs run repository code (cargo, build.rs, scripts), so they have no
# environment, no secrets, and no id-token. Each uploads one artifact through
# .github/release/upload, which writes its SHA256SUMS, and reports that
# manifest's digest as an output; the jobs that sign or publish the artifact
# check it (.github/release/verify-artifacts.sh).
on:
workflow_call:
inputs:
sha:
required: true
type: string
version:
required: true
type: string
channel:
description: The release channel this build is published on, compiled in as HEX_BUILD_CHANNEL (src/updater.rs); empty for test builds
type: string
default: ""
test-build:
type: boolean
default: false
artifact-prefix:
type: string
default: build
retention-days:
type: number
default: 0
outputs:
linux-x64-digest:
value: ${{ jobs.linux-x64.outputs.digest }}
linux-arm64-digest:
value: ${{ jobs.linux-arm64.outputs.digest }}
windows-x64-digest:
value: ${{ jobs.windows-x64.outputs.digest }}
windows-arm64-digest:
value: ${{ jobs.windows-arm64.outputs.digest }}
permissions:
contents: read
jobs:
# Both architectures build natively on Ubuntu 24.04, so the executable and
# packages need glibc 2.39 (Ubuntu 24.04, Debian 13, Fedora 40, Arch) rather
# than a rolling distribution's newest. ARM64 decodes on the GPU through
# Vulkan like x64 (Mesa's drivers on ARM boards and Asahi), falling back to
# the CPU without a Vulkan device.
linux-x64:
name: Linux x86_64
runs-on: ubuntu-24.04
timeout-minutes: 90
env:
HEX_VERSION: ${{ inputs.version }}
HEX_BUILD_CHANNEL: ${{ inputs.channel }}
HEX_LINUX_ARCH: x86_64
HEX_LINUX_LABEL: x64
NFPM_ARCHIVE: nfpm_2.48.0_Linux_x86_64.tar.gz
NFPM_SHA256: 6d7f9a28b2f397934403950fcbba83f598b08d02edbe79a0815b3b4897341750
outputs:
digest: ${{ steps.upload.outputs.digest }}
steps: &linux-steps
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ inputs.sha }}
persist-credentials: false
- uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable
with:
toolchain: stable
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2
if: inputs.test-build
with:
key: test-build
cache-on-failure: true
- name: Install build dependencies
# libopenblas-dev only satisfies build.rs's -lopenblas, which
# --as-needed drops: the release links no system BLAS
# (scripts/build-linux.sh).
run: |
sudo apt-get update
sudo apt-get install -y clang cmake pkg-config python3 file jq libasound2-dev \
libssl-dev libxkbcommon-x11-dev libx11-xcb-dev libfontconfig1-dev \
libfreetype-dev libxcursor-dev libxi-dev libxrandr-dev libopenblas-dev \
libvulkan-dev glslc libshaderc-dev
curl -fsSL --retry 3 -o "$RUNNER_TEMP/nfpm.tar.gz" \
"https://github.com/goreleaser/nfpm/releases/download/v2.48.0/$NFPM_ARCHIVE"
echo "$NFPM_SHA256 $RUNNER_TEMP/nfpm.tar.gz" | sha256sum -c -
mkdir -p "$RUNNER_TEMP/bin"
tar -xzf "$RUNNER_TEMP/nfpm.tar.gz" -C "$RUNNER_TEMP/bin" nfpm
echo "$RUNNER_TEMP/bin" >> "$GITHUB_PATH"
- name: Build
env:
HEX_RELEASE_DIST: ${{ runner.temp }}/dist
CARGO_BUILD_JOBS: 4
OPENSSL_NO_VENDOR: 1
CC: clang
CXX: clang++
run: |
executable=$(scripts/build-linux.sh)
scripts/package-linux.sh "$executable" "$HEX_VERSION" "$HEX_LINUX_LABEL" "$HEX_RELEASE_DIST"
- name: Install the .deb here and the .rpm on Fedora
run: |
base="$RUNNER_TEMP/dist/hex-$HEX_VERSION-linux-$HEX_LINUX_LABEL"
dpkg-deb --info "$base.deb"
sudo apt-get install -y "$base.deb"
test "$(/usr/bin/hex --version | awk 'NF { value=$NF } END { print value }')" = "$HEX_VERSION"
dpkg-query -S /usr/bin/hex /usr/lib/systemd/user/hex.service /usr/share/applications/anomaly.hex.desktop
sudo apt-get remove -y hex
docker run --rm -v "$RUNNER_TEMP/dist:/dist:ro" -e HEX_VERSION -e HEX_LINUX_LABEL fedora:42 sh -euc '
dnf install -y -q "/dist/hex-$HEX_VERSION-linux-$HEX_LINUX_LABEL.rpm"
test "$(hex --version | awk "NF { value=\$NF } END { print value }")" = "$HEX_VERSION"
rpm -qf /usr/bin/hex /usr/lib/systemd/user/hex.service /usr/share/applications/anomaly.hex.desktop'
- name: Check the x86_64 CPU floor
if: env.HEX_LINUX_ARCH == 'x86_64'
run: |
bash .github/release/check-x86-baseline.sh "$RUNNER_TEMP/dist/hex-$HEX_VERSION-linux-$HEX_LINUX_LABEL" \
target/release/build/transcribe-cpp-sys-*/out/lib/libggml*.a
- name: Report the glibc floor
run: |
floor=$(objdump -T "$RUNNER_TEMP/dist/hex-$HEX_VERSION-linux-$HEX_LINUX_LABEL" | grep -o 'GLIBC_[0-9.]*' | sort -uV | tail -1)
echo "Linux $HEX_LINUX_LABEL artifact requires $floor." | tee -a "$GITHUB_STEP_SUMMARY"
- id: upload
uses: ./.github/release/upload
with:
name: ${{ inputs.artifact-prefix }}-linux-${{ env.HEX_LINUX_ARCH }}
path: ${{ runner.temp }}/dist
retention-days: ${{ inputs.retention-days }}
linux-arm64:
name: Linux aarch64
runs-on: ubuntu-24.04-arm
timeout-minutes: 90
env:
HEX_VERSION: ${{ inputs.version }}
HEX_BUILD_CHANNEL: ${{ inputs.channel }}
HEX_LINUX_ARCH: aarch64
HEX_LINUX_LABEL: arm64
NFPM_ARCHIVE: nfpm_2.48.0_Linux_arm64.tar.gz
NFPM_SHA256: a9a75213763783b7669719e505474c748c5ad7dc66591a195619deb50f85c2f4
outputs:
digest: ${{ steps.upload.outputs.digest }}
steps: *linux-steps
windows-x64:
name: Windows x86_64
runs-on: windows-latest
timeout-minutes: 120
env:
HEX_VERSION: ${{ inputs.version }}
HEX_BUILD_CHANNEL: ${{ inputs.channel }}
HEX_WINDOWS_ARCH: x86_64
HEX_WINDOWS_LABEL: x64
DUMPBIN_HOST: Hostx64\\x64
# Compiled into src/updater.rs: test builds never self-update.
HEX_TEST_BUILD: ${{ inputs.test-build && '1' || '' }}
outputs:
digest: ${{ steps.upload.outputs.digest }}
steps: &windows-steps
# In a subdirectory: the Vulkan SDK installs into the workspace, and a
# release build needs a clean tree.
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ inputs.sha }}
path: source
persist-credentials: false
- uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable
with:
toolchain: stable
targets: ${{ env.HEX_WINDOWS_ARCH }}-pc-windows-msvc
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2
if: inputs.test-build
with:
workspaces: source -> target
key: test-build
cache-on-failure: true
- name: Install the Vulkan SDK
if: env.HEX_WINDOWS_ARCH == 'x86_64'
uses: humbletim/install-vulkan-sdk@30ba978f977e81b72d091fc8888feb1fb26f9aff # v1.2
with:
version: 1.4.309.0
cache: true
- name: Install SPIRV-Headers for the Vulkan backend
if: env.HEX_WINDOWS_ARCH == 'x86_64'
shell: pwsh
run: |
vcpkg install spirv-headers:x64-windows
if ($LASTEXITCODE -ne 0) { throw "vcpkg install spirv-headers failed" }
$prefix = "$env:VCPKG_INSTALLATION_ROOT/installed/x64-windows" -replace '\\','/'
$combined = if ($env:CMAKE_PREFIX_PATH) { "$prefix;$env:CMAKE_PREFIX_PATH" } else { $prefix }
Add-Content $env:GITHUB_ENV "CMAKE_PREFIX_PATH=$combined"
- name: Configure clang-cl for ARM64
if: env.HEX_WINDOWS_ARCH == 'aarch64'
shell: pwsh
run: |
@(
"CMAKE_C_COMPILER=clang-cl",
"CMAKE_CXX_COMPILER=clang-cl",
"CMAKE_C_COMPILER_TARGET=aarch64-pc-windows-msvc",
"CMAKE_CXX_COMPILER_TARGET=aarch64-pc-windows-msvc",
"CL=/EHsc"
) | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Build
shell: bash
run: |
# Git Bash would rewrite CL=/EHsc into a path that clang-cl reads as
# a second source file.
export MSYS2_ENV_CONV_EXCL=CL
export HEX_RELEASE_DIST="$(cygpath -u "$RUNNER_TEMP")/dist"
source/scripts/build-windows.sh
- name: Check the x86_64 CPU floor
if: env.HEX_WINDOWS_ARCH == 'x86_64'
shell: bash
run: |
OBJDUMP="$(cygpath -u "$PROGRAMFILES")/LLVM/bin/llvm-objdump.exe" \
bash source/.github/release/check-x86-baseline.sh \
"$(cygpath -u "$RUNNER_TEMP")/dist/hex-$HEX_VERSION-windows-$HEX_WINDOWS_LABEL.exe" \
source/target/x86_64-pc-windows-msvc/release/build/transcribe-cpp-sys-*/out/lib/ggml*.lib
- name: Check the executable needs no Visual C++ Redistributable
shell: pwsh
run: |
$dumpbin = Get-ChildItem "${env:ProgramFiles}\Microsoft Visual Studio" -Recurse -Filter dumpbin.exe -ErrorAction SilentlyContinue |
Where-Object { $_.FullName -match $env:DUMPBIN_HOST } | Select-Object -First 1
if (-not $dumpbin) { throw "dumpbin.exe was not found" }
$imports = & $dumpbin.FullName /dependents "$env:RUNNER_TEMP/dist/hex-$env:HEX_VERSION-windows-$env:HEX_WINDOWS_LABEL.exe"
$imports
$redist = $imports | Select-String -Pattern 'VCRUNTIME|MSVCP|vcomp'
if ($redist) { throw "hex.exe imports Visual C++ runtime DLLs: $redist" }
- id: upload
uses: ./source/.github/release/upload
with:
name: ${{ inputs.artifact-prefix }}-windows-${{ env.HEX_WINDOWS_ARCH }}
path: ${{ runner.temp }}/dist
retention-days: ${{ inputs.retention-days }}
windows-arm64:
name: Windows aarch64
runs-on: windows-11-arm
timeout-minutes: 120
env:
HEX_VERSION: ${{ inputs.version }}
HEX_BUILD_CHANNEL: ${{ inputs.channel }}
HEX_WINDOWS_ARCH: aarch64
HEX_WINDOWS_LABEL: arm64
DUMPBIN_HOST: Hostarm64\\arm64
HEX_TEST_BUILD: ${{ inputs.test-build && '1' || '' }}
outputs:
digest: ${{ steps.upload.outputs.digest }}
steps: *windows-steps