You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@magpie.apache.org by po...@apache.org on 2026/10/24 10:40:06 UTC

(magpie-site) branch main updated: Keep the Playwright apt cache next to the workspace (#247)

This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/magpie-site.git


The following commit(s) were added to refs/heads/main by this push:
     new b81c763  Keep the Playwright apt cache next to the workspace (#247)
b81c763 is described below

commit b81c76392cbbb99043d0af2aba3ba3138f4cda05
Author: Jarek Potiuk <ja...@potiuk.com>
AuthorDate: Sat Oct 24 12:40:00 2026 +0200

    Keep the Playwright apt cache next to the workspace (#247)
    
    actions/cache stores paths relative to the workspace. The cache job's
    container has its home and workspace at /github/home and /__w/..., ubuntu-slim
    at /home/runner and /home/runner/work/..., so a cache of ~/apt-cache saved in
    the container unpacked outside apt's archive on the shards: #244's shards hit
    the cache and still downloaded all 27.7 MB. Next to the workspace is the same
    relative place on both.
    
    Generated-by: Claude Opus 5
---
 .github/actions/playwright-chromium/action.yml | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/.github/actions/playwright-chromium/action.yml b/.github/actions/playwright-chromium/action.yml
index d3e2080..55df94a 100644
--- a/.github/actions/playwright-chromium/action.yml
+++ b/.github/actions/playwright-chromium/action.yml
@@ -39,21 +39,29 @@ runs:
     # the .debs those updates superseded. The key also carries the Ubuntu
     # release the job runs on, so packages are only ever restored onto the
     # release they were built for. A container job runs as root without sudo.
+    #
+    # actions/cache stores paths relative to the workspace, and the cache job's
+    # container lays out its home and workspace differently from ubuntu-slim:
+    # a cache of ~/apt-cache saved there unpacks somewhere else on the shards.
+    # Next to the workspace is the same relative place on both. The path is
+    # also part of the cache's version, so it is written the same way, as a
+    # literal, in both steps below.
     - name: Keep apt's downloads for the cache
       id: apt-cache
       shell: bash
       run: |
         sudo=$(command -v sudo || true)
-        mkdir -p "${HOME}/apt-cache/partial"
+        cache="${GITHUB_WORKSPACE}/../apt-cache"
+        mkdir -p "${cache}/partial"
         ${sudo} rm -f /etc/apt/apt.conf.d/docker-clean
-        echo "Dir::Cache::Archives \"${HOME}/apt-cache\";" | ${sudo} tee /etc/apt/apt.conf.d/99playwright-cache
+        echo "Dir::Cache::Archives \"${cache}\";" | ${sudo} tee /etc/apt/apt.conf.d/99playwright-cache
         . /etc/os-release
         echo "os=${ID}-${VERSION_ID}" >> "${GITHUB_OUTPUT}"
         echo "week=$(date -u +%G-W%V)" >> "${GITHUB_OUTPUT}"
     - id: restore
       uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
       with:
-        path: ~/apt-cache/*.deb
+        path: ../apt-cache/*.deb
         key: playwright-apt-${{ steps.apt-cache.outputs.os }}-${{ steps.apt-cache.outputs.week }}
         restore-keys: playwright-apt-${{ steps.apt-cache.outputs.os }}-
     - shell: bash
@@ -64,5 +72,5 @@ runs:
     - if: inputs.save == 'true' && steps.restore.outputs.cache-hit != 'true'
       uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
       with:
-        path: ~/apt-cache/*.deb
+        path: ../apt-cache/*.deb
         key: ${{ steps.restore.outputs.cache-primary-key }}