chore(ci): speed up nightly builds

This commit is contained in:
LynithDev 2026-08-01 23:30:52 +02:00
parent 455f69f894
commit 4792c9975f
2 changed files with 29 additions and 1 deletions

View file

@ -13,6 +13,14 @@ inputs:
description: Whether to restore the Rust cache
required: false
default: 'true'
cache-namespace:
description: >
Cache namespace. Workflows that compile with different profile settings
MUST use different namespaces — cargo fingerprints every dependency by its
profile, so sharing one would mean each workflow evicts artifacts the other
cannot use.
required: false
default: release-cache
runs:
using: composite
steps:
@ -29,7 +37,7 @@ runs:
with:
key: ${{ inputs.target }}
save-if: ${{ inputs.save-cache }}
shared-key: release-cache
shared-key: ${{ inputs.cache-namespace }}
# Release builds are long and can fail late (signing, notarization,
# upload). Without this the whole compile is thrown away on those runs.
cache-on-failure: true

View file

@ -10,6 +10,22 @@ concurrency:
group: oneclient-nightly-${{ github.ref }}
cancel-in-progress: true
# Nightlies are unsigned test builds, so they do not need the release profile's
# whole-program optimization — and that optimization is exactly what makes them
# slow. `lto = "fat"` + `codegen-units = 1` force a single-threaded re-optimization
# of the entire dependency graph at link time, on every run, which no cache can
# ever skip. Thin LTO keeps nearly all of the runtime benefit at a fraction of the
# link cost, and 16 codegen units lets the whole compile use every runner core.
#
# These are cargo's documented profile overrides, so `target/release` stays the
# output directory and every path below is unaffected. The shipped release binary
# is untouched: oneclient_release.yml still builds the fat-LTO profile from
# Cargo.toml. That difference is why the two workflows must not share a cache
# namespace — see `cache-namespace` on the Setup Rust step.
env:
CARGO_PROFILE_RELEASE_LTO: thin
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: '16'
jobs:
build:
permissions:
@ -55,6 +71,10 @@ jobs:
target: ${{ matrix.target }}
save-cache: true
restore-cache: true
# Separate namespace: nightly's thin-LTO dependency artifacts have
# different cargo fingerprints than the release workflow's fat-LTO ones,
# so a shared cache would just thrash between the two.
cache-namespace: nightly-cache
- name: (Linux) Install system dependencies
if: matrix.platform == 'ubuntu-22.04'