Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AqpXh3hQMMaC74pTjFq4it Gitea 1.25 cannot run reusable workflows (workflow_call), so the logic of deploy-app.yml, smoke.yml and ci.yml moves into composite actions under .gitea/actions/, and each repo gets a thin pipeline rendered by tools/gitea-pipeline/render.py from repos.json. .github/workflows is left untouched (Gitea ignores it once .gitea/workflows exists).
66 lines
2.2 KiB
YAML
66 lines
2.2 KiB
YAML
name: CI - PHPUnit
|
|
description: >-
|
|
composer test for one PHP version (Gitea port of the phpunit job). For
|
|
tests=wp-framework the caller declares a `mysql` service; on Gitea runners it is
|
|
reached by its service name, not 127.0.0.1 as on GitHub VMs.
|
|
inputs:
|
|
php:
|
|
required: true
|
|
tests:
|
|
description: "stubs | brain-monkey | wp-framework"
|
|
required: false
|
|
default: stubs
|
|
db_host:
|
|
required: false
|
|
default: mysql
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: Install subversion (wp-framework only)
|
|
if: ${{ inputs.tests == 'wp-framework' }}
|
|
shell: bash
|
|
run: command -v svn >/dev/null || (sudo apt-get update -qq && sudo apt-get install -y --no-install-recommends subversion)
|
|
|
|
- name: Setup PHP ${{ inputs.php }}
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: ${{ inputs.php }}
|
|
coverage: none
|
|
tools: composer:v2
|
|
extensions: ${{ inputs.tests == 'wp-framework' && 'mysqli' || '' }}
|
|
|
|
- name: Install Composer dependencies
|
|
shell: bash
|
|
run: composer install --no-progress --no-interaction --prefer-dist
|
|
|
|
- name: Wait for MySQL (wp-framework only)
|
|
if: ${{ inputs.tests == 'wp-framework' }}
|
|
shell: bash
|
|
env:
|
|
DB_HOST: ${{ inputs.db_host }}
|
|
run: |
|
|
for i in $(seq 1 30); do
|
|
if (exec 3<>/dev/tcp/$DB_HOST/3306) 2>/dev/null; then echo "MySQL is up"; exit 0; fi
|
|
echo "Waiting for MySQL... ($i/30)"; sleep 2
|
|
done
|
|
echo "::error::MySQL at $DB_HOST:3306 never came up"; exit 1
|
|
|
|
- name: Install WordPress test suite (wp-framework only)
|
|
# skip-db-create=true: the service already created wp_tests.
|
|
# WP_CORE_DIR must end with a slash (concatenated verbatim into ABSPATH).
|
|
if: ${{ inputs.tests == 'wp-framework' }}
|
|
shell: bash
|
|
env:
|
|
WP_TESTS_DIR: /tmp/wordpress-tests-lib
|
|
WP_CORE_DIR: /tmp/wordpress/
|
|
DB_HOST: ${{ inputs.db_host }}
|
|
run: |
|
|
chmod +x bin/install-wp-tests.sh
|
|
bin/install-wp-tests.sh wp_tests root root "$DB_HOST:3306" latest true
|
|
|
|
- name: Run PHPUnit
|
|
shell: bash
|
|
env:
|
|
WP_TESTS_DIR: /tmp/wordpress-tests-lib
|
|
run: composer test
|