From e0966630c70e98fa48e15c54d06570b6828dffd0 Mon Sep 17 00:00:00 2001 From: frysee Date: Tue, 13 May 2025 22:09:59 +0200 Subject: [PATCH] Check if we can easily cache the core builds between runs --- .github/workflows/ci.yaml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index fe6d01b30..412e2f1cb 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -71,9 +71,31 @@ jobs: - name: Setup run: make setup + - name: Compute core hash + id: cache-key + run: | + CORE_DIR="cores/${{ matrix.core }}" + HASH=$(find "$CORE_DIR" -type f -exec sha256sum {} + | sort | sha256sum | cut -d' ' -f1) + echo "core_hash=$HASH" >> "$GITHUB_OUTPUT" + + - name: Restore core build cache + id: cache-restore + uses: actions/cache/restore@v4 + with: + path: workspace/${{ env.PLATFORM }}/cores/output/ + key: core-${{ matrix.toolchain }}-${{ matrix.core }}-${{ steps.cache-key.outputs.core_hash }} + - name: Build ${{ matrix.core }} core + if: steps.cache-restore.outputs.cache-hit != 'true' run: make build-core CORE=${{ matrix.core }} + - name: Save core to cache + if: steps.cache-restore.outputs.cache-hit != 'true' + uses: actions/cache/save@v4 + with: + path: workspace/${{ env.PLATFORM }}/cores/output/ + key: core-${{ matrix.toolchain }}-${{ matrix.core }}-${{ steps.cache-key.outputs.core_hash }} + - name: Upload core uses: actions/upload-artifact@v4.6.2 with: