Run unit CI inside php1 container on self-hosted runner

This commit is contained in:
Jeppe B
2026-04-23 23:40:12 +02:00
parent 8a5e6bc302
commit 39d4ba0284
+27 -13
View File
@@ -22,25 +22,35 @@ jobs:
- name: Check AI workflow sync
run: node scripts/sync-ai-workflow.mjs --check
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: mysqli, curl, openssl, json, redis, xdebug
coverage: xdebug
ini-values: variables_order=EGPCS,xdebug.mode=coverage
- name: Materialize compose env files
env:
COMPOSE_ENV: ${{ secrets.COMPOSE_ENV }}
COMPOSE_ENV_STAGING: ${{ secrets.COMPOSE_ENV_STAGING }}
run: |
set -euo pipefail
if [ -z "${COMPOSE_ENV}" ]; then
echo "Required GitHub secret COMPOSE_ENV is not configured." >&2
exit 1
fi
if [ -z "${COMPOSE_ENV_STAGING}" ]; then
echo "Required GitHub secret COMPOSE_ENV_STAGING is not configured." >&2
exit 1
fi
printf '%s\n' "$COMPOSE_ENV" > .env
printf '%s\n' "$COMPOSE_ENV_STAGING" > .env.staging
- name: Boot php1 test stack
run: docker compose up -d redis mysql-debug php1
- name: Resolve dependencies
working-directory: services/nginx/app
run: composer update --no-interaction --prefer-dist
run: docker compose exec -T php1 sh -lc "cd /var/www/html && composer update --no-interaction --prefer-dist"
- name: Run unit tests
working-directory: services/nginx/app
run: composer test:unit
run: docker compose exec -T php1 sh -lc "cd /var/www/html && composer test:unit"
- name: Generate coverage report
working-directory: services/nginx/app
run: composer test:coverage
run: |
docker compose exec -T php1 sh -lc "cd /var/www/html && if php -m | grep -Eq '^(pcov|xdebug)$'; then composer test:coverage; else echo 'Skipping coverage: no pcov/xdebug extension available in php1 image.'; fi"
- name: Upload coverage artifact
if: ${{ github.event_name == 'pull_request' }}
@@ -52,6 +62,10 @@ jobs:
if-no-files-found: warn
retention-days: 1
- name: Tear down php1 test stack
if: always()
run: docker compose down -v
edge-agent:
name: Edge Agent (required)
runs-on: [self-hosted, Linux, X64, default]