Skip to content

fix: use Application::addCommand() for Symfony Console 8 #1

fix: use Application::addCommand() for Symfony Console 8

fix: use Application::addCommand() for Symfony Console 8 #1

Workflow file for this run

# SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: AGPL-3.0-or-later
name: Test PHP tools
on:
push:
branches:
- master
paths:
- '**.php'
- '**/composer.json'
- '**/composer.lock'
- '.github/workflows/php-test.yml'
pull_request:
paths:
- '**.php'
- '**/composer.json'
- '**/composer.lock'
- '.github/workflows/php-test.yml'
permissions:
contents: read
concurrency:
group: php-test-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
# Discover every PHP tool (any directory with a composer.json) so new tools
# are picked up automatically without touching this workflow.
discover:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.find.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Find composer projects
id: find
run: |
dirs=$(find . -mindepth 2 -maxdepth 2 -name composer.json -not -path '*/vendor/*' \
-printf '%h\n' | sed 's#^\./##' | sort -u | jq -R . | jq -sc .)
echo "matrix=$dirs" >> "$GITHUB_OUTPUT"
echo "Discovered: $dirs"
test:
needs: discover
if: needs.discover.outputs.matrix != '[]'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
dir: ${{ fromJson(needs.discover.outputs.matrix) }}
defaults:
run:
working-directory: ${{ matrix.dir }}
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
# Matches the PHP version used by the release changelog workflow.
- name: Set up PHP
uses: shivammathur/setup-php@0f7f1d08e3e32076e51cae65eb0b0c871405b16e # v2.34.1
with:
php-version: '8.4'
coverage: none
- name: Install dependencies
run: composer install --no-progress
- name: Lint PHP files
run: find . -path ./vendor -prune -o -name '*.php' -print0 | xargs -0 -n1 php -l
# Runs the test suite only for tools that define a "test" composer script.
- name: Run tests
run: |
if composer run-script --list 2>/dev/null | grep -qE '^\s*test\b'; then
composer test
else
echo "No 'test' script in ${{ matrix.dir }}/composer.json, skipping."
fi