Files
unsupervised-scheduler/.gitea/workflows/ci.yml
T
thatguygriffandClaude Opus 5 1291af0b72
CI / PHPStan (pull_request) Successful in 6m52s
CI / Tests (PHP 8.1) (pull_request) Successful in 6m0s
CI / Tests (PHP 8.2) (pull_request) Successful in 1m11s
CI / Tests (PHP 8.3) (pull_request) Successful in 2m55s
CI / No Debug Code (pull_request) Successful in 2s
CI / Coding Standards (pull_request) Successful in 7m6s
CI / Build Plugin Zip (pull_request) Skipped
Authenticate setup-php against the GitHub API
setup-php resolves its tools through the GitHub API, unauthenticated at 60
requests an hour per source address. A CI fan-out across the fleet exhausts
that bucket, and the step then retries for several minutes before reporting
only "Could not setup PHP 8.3". It reads as a hang rather than a throttle,
and it took out both a main CI run and a release build.

Each cluster has its own egress address and so its own bucket, which is why
the same job passed on one runner and failed on another in the same minute.

The token comes from 1Password through the Connect instance in whichever
cluster picked up the job, matching the pattern in thatguygriff/infra. That
repository's composite action is not reachable from here, so it is mirrored
locally. It stays a step output rather than being exported to the job
environment, to keep it away from the package scripts composer install runs.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0133tYSQoZhoKebKZV8o2GPs
2026-08-20 13:27:22 -03:00

192 lines
6.0 KiB
YAML

name: CI
on:
push:
branches:
- main
- develop
pull_request:
jobs:
lint:
name: Coding Standards
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# setup-php resolves its tools through the GitHub API, which allows 60
# requests an hour per source address unauthenticated. A CI fan-out across
# the fleet exhausts that, and the step then retries for minutes before
# reporting only "Could not setup PHP".
- name: Load GitHub API token
id: gh-token
uses: ./.gitea/actions/op-github-token
with:
connect-host: ${{ vars.OP_CONNECT_HOST }}
op-connect-token-eris: ${{ secrets.OP_CONNECT_TOKEN_ERIS }}
op-connect-token-kallone: ${{ secrets.OP_CONNECT_TOKEN_KALLONE }}
op-connect-token-nemesis: ${{ secrets.OP_CONNECT_TOKEN_NEMESIS }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
tools: composer:v2
env:
GITHUB_TOKEN: ${{ steps.gh-token.outputs.token }}
- name: Cache Composer packages
uses: actions/cache@v3
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
static-analysis:
name: PHPStan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Load GitHub API token
id: gh-token
uses: ./.gitea/actions/op-github-token
with:
connect-host: ${{ vars.OP_CONNECT_HOST }}
op-connect-token-eris: ${{ secrets.OP_CONNECT_TOKEN_ERIS }}
op-connect-token-kallone: ${{ secrets.OP_CONNECT_TOKEN_KALLONE }}
op-connect-token-nemesis: ${{ secrets.OP_CONNECT_TOKEN_NEMESIS }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
tools: composer:v2
env:
GITHUB_TOKEN: ${{ steps.gh-token.outputs.token }}
- name: Cache Composer packages
uses: actions/cache@v3
with:
path: ~/.composer/cache
key: composer-${{ hashFiles('composer.json') }}
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-interaction
- 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'
steps:
- uses: actions/checkout@v4
- name: Load GitHub API token
id: gh-token
uses: ./.gitea/actions/op-github-token
with:
connect-host: ${{ vars.OP_CONNECT_HOST }}
op-connect-token-eris: ${{ secrets.OP_CONNECT_TOKEN_ERIS }}
op-connect-token-kallone: ${{ secrets.OP_CONNECT_TOKEN_KALLONE }}
op-connect-token-nemesis: ${{ secrets.OP_CONNECT_TOKEN_NEMESIS }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring, intl
coverage: none
tools: composer:v2
env:
GITHUB_TOKEN: ${{ steps.gh-token.outputs.token }}
- name: Cache Composer packages
uses: actions/cache@v3
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: [lint, static-analysis, test, no-debug]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Load GitHub API token
id: gh-token
uses: ./.gitea/actions/op-github-token
with:
connect-host: ${{ vars.OP_CONNECT_HOST }}
op-connect-token-eris: ${{ secrets.OP_CONNECT_TOKEN_ERIS }}
op-connect-token-kallone: ${{ secrets.OP_CONNECT_TOKEN_KALLONE }}
op-connect-token-nemesis: ${{ secrets.OP_CONNECT_TOKEN_NEMESIS }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
tools: composer:v2
env:
GITHUB_TOKEN: ${{ steps.gh-token.outputs.token }}
- 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