Skip to content

Commit

Permalink
[FEATURE] Add merge testing job
Browse files Browse the repository at this point in the history
  • Loading branch information
IchHabRecht committed Aug 4, 2024
1 parent 261efdf commit 4f35e49
Showing 1 changed file with 74 additions and 0 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: echo
run: echo ${{ needs.compute.outputs.major }}

- name: Store Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -85,3 +88,74 @@ jobs:
name: phpunit-logs-${{ runner.os }}-${{ matrix.php }}-${{ steps.version-cache.outputs.major }}-${{ matrix.coverage }}
path: .Log/*
retention-days: 1

merge:
name: 'Merge COVERAGE: ${{ matrix.coverage }} - PHP: ${{ matrix.php }}'

needs: [ compute, build ]

strategy:
fail-fast: false
matrix:
os: ${{ fromJson(needs.compute.outputs.os) }}
coverage: ${{ fromJson(needs.compute.outputs.major) }}
php: ${{ fromJson(needs.compute.outputs.php) }}

runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Download PHPUnit logs
uses: actions/download-artifact@v4
with:
path: .Log
pattern: phpunit-logs-${{ runner.os }}-${{ matrix.php }}-${{ matrix.coverage }}-*
merge-multiple: true

- uses: actions/cache/restore@v4
id: restore-composer-cache
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.php }}-${{ matrix.coverage }}
restore-keys: |
${{ runner.os }}-${{ matrix.php }}-
${{ runner.os }}-
- name: Set up PHP Version ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
tools: composer:v2

- name: Environment Check
run: |
php --version
composer --version
- name: Validate composer.json
run: composer validate

- name: Composer install
run: composer update --with "phpunit/php-code-coverage:^${{ matrix.coverage }}.0" --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: Merge log files
run: bin/phpunit-merger log .Log/log/ .Log/junit.xml

- name: Merge coverage files
run: bin/phpunit-merger coverage .Log/coverage/ .Log/coverage.xml

- name: Archive PHPUnit logs
uses: actions/upload-artifact@v4
with:
name: phpunit-logs-merged-${{ runner.os }}-${{ matrix.php }}-${{ matrix.coverage }}
path: .Log/*
retention-days: 1

0 comments on commit 4f35e49

Please sign in to comment.