php-template/.forgejo/workflows/ci.yml

69 lines
2.1 KiB
YAML
Raw Permalink Normal View History

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
name: PHP ${{ matrix.php }}
runs-on: ubuntu-latest
container:
image: lthn/build:php-${{ matrix.php }}
strategy:
fail-fast: true
matrix:
php: ["8.3", "8.4"]
steps:
- uses: actions/checkout@v4
- name: Clone sister packages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
for pkg in php-framework php-admin php-api php-mcp; do
echo "Cloning $pkg into ../$pkg"
git clone --depth 1 \
"https://x-access-token:${GITHUB_TOKEN}@forge.lthn.ai/core/${pkg}.git" \
../$pkg
done
ls -la ../php-framework/composer.json ../php-admin/composer.json ../php-api/composer.json ../php-mcp/composer.json
- name: Configure path repositories
run: |
composer config repositories.core path ../php-framework --no-interaction
composer config repositories.admin path ../php-admin --no-interaction
composer config repositories.api path ../php-api --no-interaction
composer config repositories.mcp path ../php-mcp --no-interaction
composer config --unset repositories.0 --no-interaction 2>/dev/null || true
2026-02-23 06:44:26 +00:00
- name: Allow composer plugins
run: |
composer config allow-plugins.pestphp/pest-plugin true --no-interaction
composer config allow-plugins.php-http/discovery true --no-interaction 2>/dev/null || true
- name: Install dependencies
run: composer install --prefer-dist --no-interaction --no-progress
- name: Run Pint
run: |
if [ -f vendor/bin/pint ]; then
vendor/bin/pint --test
else
echo "Pint not installed, skipping"
fi
- name: Run tests
run: |
if [ -f vendor/bin/pest ]; then
vendor/bin/pest --ci --coverage
elif [ -f vendor/bin/phpunit ]; then
vendor/bin/phpunit --coverage-text
else
echo "No test runner found, skipping"
fi