diff --git a/.github/actions/save-runtime-cache/action.yml b/.github/actions/save-runtime-cache/action.yml index 55cba2c..59a4be8 100644 --- a/.github/actions/save-runtime-cache/action.yml +++ b/.github/actions/save-runtime-cache/action.yml @@ -34,6 +34,7 @@ runs: const runtime_caches = await github.rest.actions.getActionsCacheList({ owner: context.repo.owner, repo: context.repo.repo, + ref: context.ref, key: `${RUNTIME_CACHE_KEY}`, }) for (const runtime_cache of runtime_caches.data.actions_caches) { diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 63e5076..10f6eb4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,7 +26,6 @@ jobs: matrix: runtime: - linux-x64 - - win-x64 - browser-wasm uses: ./.github/workflows/cache-runtime.yml with: @@ -39,6 +38,7 @@ jobs: runs-on: ubuntu-latest outputs: + win-x64: ${{ steps.lookup-win-x64.outputs.cache-hit }} osx-arm64: ${{ steps.lookup-osx-arm64.outputs.cache-hit }} steps: @@ -46,12 +46,26 @@ jobs: id: checkout uses: actions/checkout@v4 + - name: Lookup win-x64 + id: lookup-win-x64 + uses: ./.github/actions/lookup-runtime-cache + with: + runtime: win-x64 + - name: Lookup osx-arm64 id: lookup-osx-arm64 uses: ./.github/actions/lookup-runtime-cache with: runtime: osx-arm64 + runtime-win-x64: + needs: lookup-runtime-caches + if: ${{ !needs.lookup-runtime-caches.outputs.win-x64 }} + uses: ./.github/workflows/runtime-win-x64.yml + permissions: + contents: read + actions: write + runtime-osx-arm64: needs: lookup-runtime-caches if: ${{ !needs.lookup-runtime-caches.outputs.osx-arm64 }} @@ -63,6 +77,7 @@ jobs: build-dotnet: needs: - cache-runtimes + - runtime-win-x64 - runtime-osx-arm64 if: always() @@ -83,13 +98,10 @@ jobs: key: runtime-linux-x64-${{ hashFiles('.gitmodules', 'libc/libc.c', '.github/workflows/runtime-linux-x64.yml') }} fail-on-cache-miss: true - - name: Restore win-x64 artifact - uses: actions/cache/restore@v4 + - name: Restore win-x64 + uses: ./.github/actions/restore-runtime-cache with: - path: | - Xmss/runtimes/** - key: runtime-win-x64-${{ hashFiles('.gitmodules', 'libc/libc.c', '.github/workflows/runtime-win-x64.yml') }} - fail-on-cache-miss: true + runtime: win-x64 - name: Restore osx-arm64 uses: ./.github/actions/restore-runtime-cache diff --git a/.github/workflows/runtime-osx-arm64.yml b/.github/workflows/runtime-osx-arm64.yml index 68a21b0..3f14168 100644 --- a/.github/workflows/runtime-osx-arm64.yml +++ b/.github/workflows/runtime-osx-arm64.yml @@ -2,8 +2,6 @@ # # SPDX-License-Identifier: MIT -# This file requires LF line endings, as it is used in GitHub action hashes. - --- # yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json @@ -23,7 +21,7 @@ permissions: actions: write jobs: - build-osx-arm64: + build: runs-on: macos-latest steps: @@ -58,4 +56,4 @@ jobs: id: save-runtime-cache uses: ./.github/actions/save-runtime-cache with: - runtime: osx-arm64 + runtime: ${{ env.RUNTIME }} diff --git a/.github/workflows/runtime-win-x64.yml b/.github/workflows/runtime-win-x64.yml index 91536f5..7b7982d 100644 --- a/.github/workflows/runtime-win-x64.yml +++ b/.github/workflows/runtime-win-x64.yml @@ -21,7 +21,7 @@ permissions: actions: write jobs: - build-win-x64: + build: runs-on: windows-latest steps: @@ -30,12 +30,6 @@ jobs: with: submodules: recursive - - name: Calculate cache key - id: cache-key - run: | - echo "value=runtime-${{ env.RUNTIME }}-${{ hashFiles('.gitmodules', 'libc/libc.c', '.github/workflows/runtime-win-x64.yml') }}" ` - >> "$env:GITHUB_OUTPUT" - - name: Configure run: > cmake @@ -61,28 +55,8 @@ jobs: mkdir "Xmss\runtimes\${{ env.RUNTIME }}\native" copy build\src\Release\xmss.dll "Xmss\runtimes\${{ env.RUNTIME }}\native\" - - name: Check existing cache - id: cache-check - uses: actions/cache/restore@v4 - with: - path: | - Xmss/runtimes/** - key: ${{ steps.cache-key.outputs.value }} - enableCrossOsArchive: true - lookup-only: true - - - name: Delete existing cache - if: ${{ steps.cache-check.outputs.cache-hit }} - run: | - gh extension install actions/gh-actions-cache - gh actions-cache delete "${{ steps.cache-key.outputs.value }}" --confirm - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Save cache - uses: actions/cache/save@v4 + - name: Save runtime cache + id: save-runtime-cache + uses: ./.github/actions/save-runtime-cache with: - path: | - Xmss/runtimes/** - key: ${{ steps.cache-key.outputs.value }} - enableCrossOsArchive: true + runtime: ${{ env.RUNTIME }}