diff --git a/.gitea/workflows/ci-badge.yml b/.gitea/workflows/ci-badge.yml index 6b8bbcac..46f65508 100644 --- a/.gitea/workflows/ci-badge.yml +++ b/.gitea/workflows/ci-badge.yml @@ -9,7 +9,7 @@ jobs: publish: runs-on: alkane-fast container: - image: gitea.bluefla.re/blueflare/alkane-ci@sha256:ad56db2fc456a3f1c68c715ba44309751cb5c455376d9f797ac346833c011e15 + image: gitea.bluefla.re/blueflare/alkane-ci@sha256:9d2a992bbcb91014af3c85d2e1ec8c5990701cecf83fd06c8d46f9ef13dbd948 permissions: actions: read contents: write diff --git a/.gitea/workflows/next.yml b/.gitea/workflows/next.yml index a1cfa898..e248c869 100644 --- a/.gitea/workflows/next.yml +++ b/.gitea/workflows/next.yml @@ -15,7 +15,7 @@ jobs: candidate: runs-on: alkane-ci container: - image: gitea.bluefla.re/blueflare/alkane-ci@sha256:ad56db2fc456a3f1c68c715ba44309751cb5c455376d9f797ac346833c011e15 + image: gitea.bluefla.re/blueflare/alkane-ci@sha256:9d2a992bbcb91014af3c85d2e1ec8c5990701cecf83fd06c8d46f9ef13dbd948 env: CARGO_TARGET_DIR: target WX_PREFIX: /root/.cache/wx-3.3.3-linux diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 7faa4a7e..c6a9a451 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -18,7 +18,7 @@ jobs: release: runs-on: alkane-ci container: - image: gitea.bluefla.re/blueflare/alkane-ci@sha256:ad56db2fc456a3f1c68c715ba44309751cb5c455376d9f797ac346833c011e15 + image: gitea.bluefla.re/blueflare/alkane-ci@sha256:9d2a992bbcb91014af3c85d2e1ec8c5990701cecf83fd06c8d46f9ef13dbd948 env: CARGO_TARGET_DIR: target WX_PREFIX: /root/.cache/wx-3.3.3-linux diff --git a/.gitea/workflows/source.yml b/.gitea/workflows/source.yml index e934fbe6..cec6e529 100644 --- a/.gitea/workflows/source.yml +++ b/.gitea/workflows/source.yml @@ -13,7 +13,7 @@ jobs: check: runs-on: alkane-fast container: - image: gitea.bluefla.re/blueflare/alkane-ci@sha256:ad56db2fc456a3f1c68c715ba44309751cb5c455376d9f797ac346833c011e15 + image: gitea.bluefla.re/blueflare/alkane-ci@sha256:9d2a992bbcb91014af3c85d2e1ec8c5990701cecf83fd06c8d46f9ef13dbd948 env: CARGO_BUILD_JOBS: 2 steps: diff --git a/.gitea/workflows/verify.yml b/.gitea/workflows/verify.yml index e71c46c9..2686bff0 100644 --- a/.gitea/workflows/verify.yml +++ b/.gitea/workflows/verify.yml @@ -13,7 +13,7 @@ jobs: verify: runs-on: alkane-verify container: - image: gitea.bluefla.re/blueflare/alkane-ci@sha256:ad56db2fc456a3f1c68c715ba44309751cb5c455376d9f797ac346833c011e15 + image: gitea.bluefla.re/blueflare/alkane-ci@sha256:9d2a992bbcb91014af3c85d2e1ec8c5990701cecf83fd06c8d46f9ef13dbd948 env: CARGO_TARGET_DIR: target CARGO_BUILD_JOBS: 2 @@ -52,6 +52,10 @@ jobs: if: steps.surface.outputs.surface != 'documentation' run: bash ci/ensure-build-deps.sh base + - name: Configure bounded Rust compiler cache + if: steps.surface.outputs.surface != 'documentation' + run: bash ci/configure-rust-cache.sh + - name: Compute wxWidgets cache key id: wx-key if: steps.surface.outputs.surface == 'full' @@ -142,6 +146,12 @@ jobs: else echo "cargo-audit not installed on this runner; skipping" fi + - name: Rust compiler cache statistics + if: always() && steps.surface.outputs.surface != 'documentation' + run: | + if [ -n "${SCCACHE_DIR:-}" ]; then + sccache --show-stats + fi - name: Clean generated Toolkit build if: always() run: python3 ci/cleanup-generated.py diff --git a/ci/configure-rust-cache.sh b/ci/configure-rust-cache.sh new file mode 100644 index 00000000..67747872 --- /dev/null +++ b/ci/configure-rust-cache.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: MIT +# Reuse Rust compiler results on the dedicated verification runner. +set -euo pipefail + +[ "$(sccache --version)" = 'sccache 0.18.0' ] || { + echo 'CI image has an unexpected sccache version' >&2 + exit 1 +} + +toolcache="${RUNNER_TOOL_CACHE:-}" +if [ -z "$toolcache" ] || [ -L "$toolcache" ] || + [ ! -d "$toolcache" ] || [ ! -w "$toolcache" ]; then + echo 'Persistent runner tool cache is unavailable; compiling without sccache' + exit 0 +fi + +cache_dir="$toolcache/alkane-toolkit-rust-sccache" +if [ -L "$cache_dir" ]; then + echo 'Rust cache path is a symlink' >&2 + exit 1 +fi +umask 077 +mkdir -p "$cache_dir" +if [ ! -d "$cache_dir" ] || [ ! -w "$cache_dir" ]; then + echo 'Rust cache directory is unavailable' >&2 + exit 1 +fi +chmod 0700 "$cache_dir" + +{ + printf 'RUSTC_WRAPPER=%s\n' "$(command -v sccache)" + printf 'SCCACHE_DIR=%s\n' "$cache_dir" + printf 'SCCACHE_CACHE_SIZE=2G\n' + printf 'CARGO_INCREMENTAL=0\n' +} >> "${GITHUB_ENV:?GITHUB_ENV is required}" +echo 'Bounded Rust compiler cache configured for Alkane Toolkit' diff --git a/ci/runner-image.txt b/ci/runner-image.txt index 6781c89d..4436eea6 100644 --- a/ci/runner-image.txt +++ b/ci/runner-image.txt @@ -1 +1 @@ -gitea.bluefla.re/blueflare/alkane-ci@sha256:ad56db2fc456a3f1c68c715ba44309751cb5c455376d9f797ac346833c011e15 +gitea.bluefla.re/blueflare/alkane-ci@sha256:9d2a992bbcb91014af3c85d2e1ec8c5990701cecf83fd06c8d46f9ef13dbd948