Files
unsupervised-scheduler/.gitea/workflows/ci.yml
T
thatguygriff 2011319750
CI / Coding Standards (pull_request) Successful in 52s
CI / PHPStan (pull_request) Successful in 58s
CI / Tests (PHP 8.1) (pull_request) Successful in 51s
CI / Tests (PHP 8.2) (pull_request) Successful in 49s
CI / Tests (PHP 8.3) (pull_request) Successful in 49s
CI / No Debug Code (pull_request) Successful in 2s
CI / Build Plugin Zip (pull_request) Has been skipped
Fix CI artifact so the downloaded plugin installs directly
Gitea/Actions re-zips artifacts on download, so uploading the built plugin
zip produced a double-wrapped archive (a zip containing a zip). WordPress
then reported "No valid plugins were found" because the upload had no
plugin folder/header at its top level.

Unpack the built zip and upload the resulting plugin folder instead, so the
downloaded artifact's top level is unsupervised-schedular/ and installs
directly via Plugins -> Add New -> Upload.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-05 12:31:29 -03:00

143 lines
3.8 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
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
tools: composer:v2
- 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: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
tools: composer:v2
- 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: 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@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: |
if grep -rn --include="*.php" -E "(var_dump|var_export|print_r|error_log|dd\(|dump\()" 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: 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