refactor: reorganize commands into Console namespace with dependency … #211
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Run PHPUnit Tests | |
| on: | |
| workflow_call: | |
| inputs: | |
| min-coverage: | |
| description: Minimum line coverage percentage enforced by dev-tools tests. | |
| required: false | |
| type: number | |
| default: 80 | |
| workflow_dispatch: | |
| inputs: | |
| min-coverage: | |
| description: Minimum line coverage percentage enforced by dev-tools tests. | |
| required: false | |
| type: number | |
| default: 80 | |
| pull_request: | |
| push: | |
| branches: [ "main" ] | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| tests: | |
| name: Run Tests | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| php-version: [ '8.3', '8.4', '8.5' ] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Cache Composer dependencies | |
| uses: actions/cache@v5 | |
| with: | |
| path: /tmp/composer-cache | |
| key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-composer- | |
| - name: Install dependencies | |
| uses: php-actions/composer@v6 | |
| env: | |
| COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ github.token }}"} }' | |
| COMPOSER_CACHE_DIR: /tmp/composer-cache | |
| with: | |
| php_version: ${{ matrix.php-version }} | |
| command: 'install' | |
| args: '--prefer-dist --no-progress --no-interaction --no-plugins --no-scripts' | |
| - name: Composer Audit | |
| uses: php-actions/composer@v6 | |
| with: | |
| php_version: ${{ matrix.php-version }} | |
| command: 'audit' | |
| - name: Resolve minimum coverage | |
| id: minimum-coverage | |
| run: echo "value=${INPUT_MIN_COVERAGE:-80}" >> "$GITHUB_OUTPUT" | |
| env: | |
| INPUT_MIN_COVERAGE: ${{ inputs.min-coverage }} | |
| - name: Run PHPUnit tests | |
| uses: php-actions/composer@v6 | |
| with: | |
| php_version: ${{ matrix.php-version }} | |
| php_extensions: pcov pcntl | |
| command: 'dev-tools' | |
| args: 'tests -- --coverage=public/coverage --min-coverage=${{ steps.minimum-coverage.outputs.value }}' |