CI / No Debug Code (pull_request) Successful in 4s
CI / Tests (PHP 8.2) (pull_request) Successful in 55s
CI / Tests (PHP 8.1) (pull_request) Successful in 1m15s
CI / Tests (PHP 8.5) (pull_request) Successful in 6m41s
CI / Tests (PHP 8.3) (pull_request) Failing after 12m21s
CI / Coding Standards & Static Analysis (pull_request) Successful in 13m48s
CI / Build Plugin Zip (pull_request) Skipped
I misread the instruction to hold 8.5 as "take it out until the cache
lands" and removed it in f6481d4, so #179 merged without it. It was meant
to stay where it was. Restoring it.
8.5 takes the same php-builder path as 8.3, so the apt cache in this
branch is exactly what it needs, and the per-version key means it caches
its own ~70 -dev packages rather than sharing with the ondrej-path jobs.
composer test passes on 8.5.9 locally: 915 tests, 2592 assertions.
Refs #178.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Uw545F1vveNJKjzLxdi2ks
209 lines
7.7 KiB
YAML
209 lines
7.7 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- develop
|
|
pull_request:
|
|
|
|
jobs:
|
|
# PHPCS and PHPStan share a job so the two of them draw once on Setup PHP
|
|
# rather than twice. That step is slow and intermittently fails on 8.3
|
|
# (see #178), so every job that can be folded into another is one less
|
|
# chance for a run to fall over. They run as separate steps, and PHPCS
|
|
# failing stops the job before PHPStan reports.
|
|
quality:
|
|
name: Coding Standards & Static Analysis
|
|
runs-on: ubuntu-latest
|
|
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:
|
|
php-version: '8.3'
|
|
tools: composer:v2
|
|
|
|
- name: Cache Composer packages
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.composer/cache
|
|
key: composer-${{ hashFiles('composer.json') }}
|
|
|
|
- name: Install dependencies
|
|
run: composer install --prefer-dist --no-progress --no-interaction
|
|
|
|
- name: Run PHPCS
|
|
run: composer cs
|
|
|
|
- name: Run PHPStan
|
|
run: composer lint
|
|
|
|
test:
|
|
name: Tests (PHP ${{ matrix.php }})
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
php:
|
|
- '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:
|
|
php-version: ${{ matrix.php }}
|
|
extensions: mbstring, intl
|
|
coverage: none
|
|
tools: composer:v2
|
|
|
|
- name: Cache Composer packages
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.composer/cache
|
|
key: ${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
|
|
|
|
- name: Install dependencies
|
|
run: composer install --prefer-dist --no-progress --no-interaction
|
|
|
|
- name: Run PHPUnit
|
|
run: composer test
|
|
|
|
no-debug:
|
|
name: No Debug Code
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Check for debug statements
|
|
run: |
|
|
# \b keeps method calls like DateTimeImmutable::add() from matching dd(.
|
|
if grep -rn --include="*.php" -E "\b(var_dump|var_export|print_r|error_log|dd|dump)\s*\(" src/; then
|
|
echo "Debug code found in src/ — please remove before merging."
|
|
exit 1
|
|
fi
|
|
|
|
build:
|
|
name: Build Plugin Zip
|
|
runs-on: ubuntu-latest
|
|
# Only build a shippable artifact once changes land on main, and only
|
|
# after the quality gates pass.
|
|
needs: [quality, test, no-debug]
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
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:
|
|
php-version: '8.3'
|
|
tools: composer:v2
|
|
|
|
- name: Build plugin zip
|
|
run: composer build
|
|
|
|
- name: Read plugin version
|
|
id: meta
|
|
run: |
|
|
version="$(sed -nE 's/^[[:space:]]*\*?[[:space:]]*Version:[[:space:]]*([^[:space:]]+).*/\1/p' unsupervised-schedular.php | head -1)"
|
|
echo "version=${version}" >> "$GITHUB_OUTPUT"
|
|
|
|
# Gitea/Actions re-zips artifacts on download. Upload the unpacked plugin
|
|
# folder (not the built zip) so the downloaded archive's top level is
|
|
# unsupervised-schedular/ and installs directly in WordPress. Uploading
|
|
# the zip instead double-wraps it ("No valid plugins were found").
|
|
- name: Unpack plugin for artifact
|
|
run: unzip -q "dist/unsupervised-schedular-${{ steps.meta.outputs.version }}.zip" -d artifact
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: unsupervised-schedular-${{ steps.meta.outputs.version }}
|
|
path: artifact/
|
|
if-no-files-found: error
|