[FEATURE] Add major version processing #23
Workflow file for this run
This file contains 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: 🏃 tests | |
on: [ push, pull_request, workflow_call ] | |
jobs: | |
compute: | |
uses: ./.github/workflows/compute.yml | |
build: | |
name: 'Build COVERAGE: ${{ matrix.coverage }} - PHP: ${{ matrix.php }}' | |
needs: [ compute ] | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ${{ fromJson(needs.compute.outputs.os) }} | |
coverage: ${{ fromJson(needs.compute.outputs.coverage) }} | |
php: ${{ fromJson(needs.compute.outputs.php) }} | |
exclude: ${{ fromJson(needs.compute.outputs.exclude) }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Store Composer cache directory | |
id: composer-cache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Store PHP code coverage version | |
id: version-cache | |
env: | |
COVERAGE: ${{ matrix.coverage }} | |
run: | | |
echo "version=$(echo $COVERAGE | tr -d -c 0-9)" >> $GITHUB_OUTPUT | |
echo "major=$(echo $COVERAGE | tr -d -c 0-9 | sed 's/.\{2\}$//')" >> $GITHUB_OUTPUT | |
- uses: actions/cache/restore@v4 | |
id: restore-composer-cache | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-${{ matrix.php }}-${{ steps.version-cache.outputs.major }}-${{ matrix.coverage }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.php }}-${{ steps.version-cache.outputs.major }}- | |
${{ runner.os }}-${{ matrix.php }}- | |
${{ runner.os }}- | |
- name: Set up PHP Version ${{ matrix.php }} | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
coverage: xdebug | |
tools: composer:v2 | |
- name: Environment Check | |
run: | | |
php --version | |
composer --version | |
mkdir -p .Log/coverage/ .Log/log/ | |
- name: Validate composer.json | |
run: composer validate | |
- name: Composer install | |
run: composer update --with "phpunit/php-code-coverage:${{ matrix.coverage }}" --no-interaction | |
- name: Save composer cache | |
uses: actions/cache/save@v4 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ steps.restore-composer-cache.outputs.cache-primary-key }} | |
- name: Lint PHP | |
run: php .Build/bin/parallel-lint --exclude .Build . | |
- name: Run PHPUnit | |
if: ${{ success() || failure() }} | |
run: .Build/bin/phpunit --log-junit .Log/log/junit_${{ steps.version-cache.outputs.version }}.xml --coverage-php .Log/coverage/coverage_${{ steps.version-cache.outputs.version }}.cov --coverage-filter src/ tests/ | |
- name: Archive PHPUnit logs | |
uses: actions/upload-artifact@v4 | |
with: | |
name: phpunit-logs-${{ runner.os }}-${{ matrix.php }}-${{ steps.version-cache.outputs.major }}-${{ matrix.coverage }} | |
path: .Log/* | |
retention-days: 1 |