diff --git a/.github/actions/setup-go/action.yaml b/.github/actions/setup-go/action.yaml index a6541bffc2..1c1026b3d8 100644 --- a/.github/actions/setup-go/action.yaml +++ b/.github/actions/setup-go/action.yaml @@ -5,6 +5,10 @@ inputs: description: Path prefix for go.mod / go.sum files (used when the repo is checked out into a subdirectory) required: false default: "." + cache: + description: Whether to cache Go modules and build outputs + required: false + default: "true" runs: using: composite steps: @@ -14,5 +18,5 @@ runs: cache-dependency-path: | ${{ inputs.working-directory }}/go.sum ${{ inputs.working-directory }}/caddy/go.sum - cache: ${{ !startsWith(github.ref, 'refs/tags/') }} + cache: ${{ inputs.cache == 'true' && !startsWith(github.ref, 'refs/tags/') }} check-latest: true diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index e0d0d1dbf5..3ea099d2ff 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -157,6 +157,8 @@ jobs: fi - if: steps.state.outputs.resume != 'true' uses: ./.github/actions/setup-go + with: + cache: "false" - if: steps.state.outputs.resume != 'true' uses: ./.github/actions/setup-php - if: steps.state.outputs.resume != 'true' diff --git a/.github/workflows/static.yaml b/.github/workflows/static.yaml index 29d5452dbd..f8f229460f 100644 --- a/.github/workflows/static.yaml +++ b/.github/workflows/static.yaml @@ -447,6 +447,8 @@ jobs: ref: ${{ needs.prepare.outputs.ref }} persist-credentials: false - uses: ./.github/actions/setup-go + with: + cache: ${{ !(needs.prepare.outputs.ref || github.ref_type == 'tag') }} - id: version uses: ./.github/actions/version with: diff --git a/.github/workflows/windows.yaml b/.github/workflows/windows.yaml index 804147612f..6b31919fca 100644 --- a/.github/workflows/windows.yaml +++ b/.github/workflows/windows.yaml @@ -79,6 +79,20 @@ jobs: uses: ./frankenphp/.github/actions/setup-go with: working-directory: frankenphp + cache: ${{ !env.REF }} + + - name: Determine runner image + id: image + run: '"version=$env:ImageVersion" >> $env:GITHUB_OUTPUT' + + # SourceForge sometimes serves runners a non-archive body for pthreads sources; release runs skip the cache + - name: Cache Vcpkg Packages # zizmor: ignore[cache-poisoning] + if: ${{ !env.REF }} + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: ~\AppData\Local\vcpkg\archives + key: vcpkg-${{ runner.os }}-${{ steps.image.outputs.version }}-${{ hashFiles('frankenphp/vcpkg.json') }} + restore-keys: vcpkg-${{ runner.os }}- - name: Install Vcpkg Libraries working-directory: frankenphp