diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index d8cf893..9a18a90 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -19,6 +19,33 @@ jobs: steps: - uses: actions/checkout@v4 + # setup-php installs PHP 8.3+ through php-builder, which apt-installs ~70 + # -dev packages before unpacking the build (#178). Ubuntu's image deletes + # the .debs after install, so every job re-downloads them. Keeping them + # and restoring them from the cache server, which lives in the cluster, + # turns a WAN download into a local one. + # + # Keyed per PHP version because the install path differs by version and + # the package sets are not interchangeable: 8.3+ pulls the ~70 -dev + # packages through php-builder, while 8.1 and 8.2 come from the ondrej + # PPA as a handful of runtime packages. Sharing one key across both lets + # whichever job finishes first decide what the others restore, and 8.1 is + # always first. + # + # Only the .debs are cached, never /var/lib/apt/lists — a stale index is + # how you get 404s mid-install. + - name: Keep downloaded .debs + run: | + sudo rm -f /etc/apt/apt.conf.d/docker-clean + echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' \ + | sudo tee /etc/apt/apt.conf.d/99keep-downloaded-packages >/dev/null + + - name: Cache apt packages + uses: actions/cache@v4 + with: + path: /var/cache/apt/archives/*.deb + key: apt-php8.3-${{ runner.arch }}-v1 + - name: Setup PHP uses: shivammathur/setup-php@v2 with: @@ -26,7 +53,7 @@ jobs: tools: composer:v2 - name: Cache Composer packages - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.composer/cache key: composer-${{ hashFiles('composer.json') }} @@ -50,9 +77,37 @@ jobs: - '8.1' - '8.2' - '8.3' + - '8.5' steps: - uses: actions/checkout@v4 + # setup-php installs PHP 8.3+ through php-builder, which apt-installs ~70 + # -dev packages before unpacking the build (#178). Ubuntu's image deletes + # the .debs after install, so every job re-downloads them. Keeping them + # and restoring them from the cache server, which lives in the cluster, + # turns a WAN download into a local one. + # + # Keyed per PHP version because the install path differs by version and + # the package sets are not interchangeable: 8.3+ pulls the ~70 -dev + # packages through php-builder, while 8.1 and 8.2 come from the ondrej + # PPA as a handful of runtime packages. Sharing one key across both lets + # whichever job finishes first decide what the others restore, and 8.1 is + # always first. + # + # Only the .debs are cached, never /var/lib/apt/lists — a stale index is + # how you get 404s mid-install. + - name: Keep downloaded .debs + run: | + sudo rm -f /etc/apt/apt.conf.d/docker-clean + echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' \ + | sudo tee /etc/apt/apt.conf.d/99keep-downloaded-packages >/dev/null + + - name: Cache apt packages + uses: actions/cache@v4 + with: + path: /var/cache/apt/archives/*.deb + key: apt-php${{ matrix.php }}-${{ runner.arch }}-v1 + - name: Setup PHP uses: shivammathur/setup-php@v2 with: @@ -62,7 +117,7 @@ jobs: tools: composer:v2 - name: Cache Composer packages - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.composer/cache key: ${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} @@ -96,6 +151,33 @@ jobs: steps: - uses: actions/checkout@v4 + # setup-php installs PHP 8.3+ through php-builder, which apt-installs ~70 + # -dev packages before unpacking the build (#178). Ubuntu's image deletes + # the .debs after install, so every job re-downloads them. Keeping them + # and restoring them from the cache server, which lives in the cluster, + # turns a WAN download into a local one. + # + # Keyed per PHP version because the install path differs by version and + # the package sets are not interchangeable: 8.3+ pulls the ~70 -dev + # packages through php-builder, while 8.1 and 8.2 come from the ondrej + # PPA as a handful of runtime packages. Sharing one key across both lets + # whichever job finishes first decide what the others restore, and 8.1 is + # always first. + # + # Only the .debs are cached, never /var/lib/apt/lists — a stale index is + # how you get 404s mid-install. + - name: Keep downloaded .debs + run: | + sudo rm -f /etc/apt/apt.conf.d/docker-clean + echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' \ + | sudo tee /etc/apt/apt.conf.d/99keep-downloaded-packages >/dev/null + + - name: Cache apt packages + uses: actions/cache@v4 + with: + path: /var/cache/apt/archives/*.deb + key: apt-php8.3-${{ runner.arch }}-v1 + - name: Setup PHP uses: shivammathur/setup-php@v2 with: