From d0f23421cde822602e933c976213e3660c284374 Mon Sep 17 00:00:00 2001 From: Johannes Kresner Date: Mon, 2 Nov 2026 15:37:13 +0100 Subject: [PATCH] ci: add build caching --- .gitea/workflows/build.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 40ce56e..dedba56 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -36,13 +36,23 @@ jobs: - uses: dtolnay/rust-toolchain@stable with: targets: ${{ matrix.target }} + # caches ~/.cargo registry/git and target/, keyed on Cargo.lock + toolchain + - uses: Swatinem/rust-cache@v2 + with: + key: ${{ matrix.target }} # zig as cross C compiler/linker for both musl and macOS - run: pip install ziglang cargo-zigbuild # macOS: Apple SDK for Security.framework etc. - if: matrix.target == 'aarch64-apple-darwin' - run: | - curl -fsSL "https://github.com/joseluisq/macosx-sdks/releases/download/${MACOS_SDK}/MacOSX${MACOS_SDK}.sdk.tar.xz" | tar -xJ -C "$HOME" - echo "SDKROOT=$HOME/MacOSX${MACOS_SDK}.sdk" >> "$GITHUB_ENV" + id: sdk-cache + uses: actions/cache@v4 + with: + path: ~/MacOSX${{ env.MACOS_SDK }}.sdk + key: macos-sdk-${{ env.MACOS_SDK }} + - if: matrix.target == 'aarch64-apple-darwin' && steps.sdk-cache.outputs.cache-hit != 'true' + run: curl -fsSL "https://github.com/joseluisq/macosx-sdks/releases/download/${MACOS_SDK}/MacOSX${MACOS_SDK}.sdk.tar.xz" | tar -xJ -C "$HOME" + - if: matrix.target == 'aarch64-apple-darwin' + run: echo "SDKROOT=$HOME/MacOSX${MACOS_SDK}.sdk" >> "$GITHUB_ENV" - run: cargo zigbuild --release --locked --target ${{ matrix.target }} -p hx-cli env: HX_VERSION: ${{ needs.version.outputs.version }}