Skip to content

Commit

Permalink
[WIP] merge
Browse files Browse the repository at this point in the history
  • Loading branch information
IchHabRecht committed Aug 2, 2024
1 parent 461191f commit 8fe8e64
Showing 1 changed file with 93 additions and 7 deletions.
100 changes: 93 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,20 @@ name: 🏃 tests

on: [ push, pull_request, workflow_call ]

env:
OS: '[ \"ubuntu-latest\" ]'
PHP: '[ \"8.0\" \"8.1\" \"8.2\" \"8.3\" ]'

jobs:
test:
name: 'COVERAGE: ${{ matrix.coverage }} - PHP: ${{ matrix.php }}'
build:
name: 'Build COVERAGE: ${{ matrix.coverage }} - PHP: ${{ matrix.php }}'

strategy:
fail-fast: false
matrix:
os: [ 'ubuntu-latest' ]
os: ${{ env.OS }}
coverage: [ '~9.0.0', '~9.1.0', '~9.2.0', '~10.0.0', '~10.1.0' ]
php: [ '8.0', '8.1', '8.2', '8.3' ]
php: ${{ env.PHP }}
exclude:
- coverage: '~10.0.0'
php: '8.0'
Expand All @@ -28,14 +32,20 @@ jobs:
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=${COVERAGE | tr -d -c 0-9}" >> $GITHUB_OUTPUT

- uses: actions/cache/restore@v4
id: restore-composer-cache
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.coverage }}-${{ matrix.php }}
key: ${{ runner.os }}-${{ matrix.php }}-${{ matrix.coverage }}
restore-keys: |
${{ runner.os }}-composer-${{ matrix.coverage }}-
${{ runner.os }}-composer-
${{ runner.os }}-${{ matrix.php }}-
${{ runner.os }}-
- name: Set up PHP Version ${{ matrix.php }}
uses: shivammathur/setup-php@v2
Expand Down Expand Up @@ -64,3 +74,79 @@ jobs:

- 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 }}-${{ matrix.coverage }}
path: .Log/*
retention-days: 1

merge:
name: "Merge PHP: ${{ matrix.php }}"

strategy:
fail-fast: false
matrix:
os: ${{ env.OS }}
php: ${{ env.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 }}-*
merge-multiple: true

- name: Store Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- uses: actions/cache/restore@v4
id: restore-composer-cache
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.php }}
restore-keys: |
${{ 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/junit/
- name: Validate composer.json
run: composer validate

- name: Composer install
run: composer update --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

0 comments on commit 8fe8e64

Please sign in to comment.