mirror of
https://github.com/anomalyco/hex.git
synced 2026-11-28 13:02:21 +01:00
download-artifact unpacks a single matching artifact straight into the download folder; verify-artifacts.sh now files it under the name whose reported digest its SHA256SUMS has. The Windows build checks out into source/ because the Vulkan SDK installs into the workspace. verify-macos runs only after sign-macos succeeds. .github/CODEOWNERS names @thdxr; docs describe the split release.
201 lines
8 KiB
YAML
201 lines
8 KiB
YAML
name: Build desktop
|
|
|
|
# Builds the unsigned Linux x86_64 and 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-digest:
|
|
value: ${{ jobs.linux.outputs.digest }}
|
|
windows-x64-digest:
|
|
value: ${{ jobs.windows-x64.outputs.digest }}
|
|
windows-arm64-digest:
|
|
value: ${{ jobs.windows-arm64.outputs.digest }}
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
linux:
|
|
name: Linux x86_64
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 90
|
|
# The supported Linux host is x86_64 Arch, so the release links against
|
|
# current Arch libraries; the glibc floor is reported in the summary.
|
|
container: archlinux:base-devel
|
|
env:
|
|
HEX_VERSION: ${{ inputs.version }}
|
|
HEX_BUILD_CHANNEL: ${{ inputs.channel }}
|
|
outputs:
|
|
digest: ${{ steps.upload.outputs.digest }}
|
|
steps:
|
|
- name: Install build dependencies
|
|
run: |
|
|
pacman -Syu --noconfirm --needed git rustup python alsa-lib curl jq openssl \
|
|
xxd file binutils util-linux glib2 \
|
|
libxkbcommon libxkbcommon-x11 libx11 libxcb libxcursor libxi libxrandr \
|
|
fontconfig freetype2 wayland systemd-libs openblas vulkan-headers \
|
|
vulkan-icd-loader shaderc spirv-headers clang cmake pkgconf
|
|
useradd --create-home builder
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
ref: ${{ inputs.sha }}
|
|
persist-credentials: false
|
|
- name: Restore the Cargo cache
|
|
if: inputs.test-build
|
|
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
|
|
with:
|
|
path: |
|
|
/home/builder/.cargo/registry
|
|
/home/builder/.cargo/git
|
|
target
|
|
key: test-build-linux-${{ hashFiles('Cargo.lock') }}
|
|
- name: Build
|
|
run: |
|
|
mkdir -p "$RUNNER_TEMP/dist"
|
|
chown -R builder: "$GITHUB_WORKSPACE" "$RUNNER_TEMP/dist" /home/builder
|
|
runuser -u builder -- env HOME=/home/builder \
|
|
HEX_RELEASE_SOURCE="$GITHUB_WORKSPACE" \
|
|
HEX_RELEASE_DIST="$RUNNER_TEMP/dist" \
|
|
HEX_VERSION="$HEX_VERSION" HEX_BUILD_CHANNEL="$HEX_BUILD_CHANNEL" \
|
|
CARGO_BUILD_JOBS=4 BLA_VENDOR=OpenBLAS OPENSSL_NO_VENDOR=1 \
|
|
CC=clang CXX=clang++ \
|
|
sh -c 'git config --global --add safe.directory "$HEX_RELEASE_SOURCE" && rustup default stable && scripts/build-linux.sh'
|
|
- name: Report the glibc floor
|
|
run: |
|
|
floor=$(objdump -T "$RUNNER_TEMP/dist/hex-$HEX_VERSION-linux-x64" | grep -o 'GLIBC_[0-9.]*' | sort -uV | tail -1)
|
|
ldd --version | head -1
|
|
echo "Linux artifact requires $floor." | tee -a "$GITHUB_STEP_SUMMARY"
|
|
- id: upload
|
|
uses: ./.github/release/upload
|
|
with:
|
|
name: ${{ inputs.artifact-prefix }}-linux-x86_64
|
|
path: ${{ runner.temp }}/dist
|
|
retention-days: ${{ inputs.retention-days }}
|
|
|
|
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 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
|