-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor GitHub Actions workflow for PHP tests
Simplified and streamlined the CI workflow, merging jobs and renaming the workflow file to `test.yml`. Improved test matrix to include multiple OS and PHP versions with dependency variations. Added caching for Composer dependencies to enhance performance.
- Loading branch information
Showing
2 changed files
with
45 additions
and
142 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Tests | ||
|
||
on: ['push', 'pull_request'] | ||
|
||
jobs: | ||
ci: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
php: ['8.2', '8.3', '8.4'] | ||
dependency-version: [prefer-lowest, prefer-stable] | ||
|
||
name: Tests PHP${{ matrix.php }} - ${{ matrix.os }} - ${{ matrix.dependency-version }} | ||
|
||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
extensions: dom, mbstring, zip | ||
coverage: xdebug | ||
|
||
- name: Get Composer cache directory | ||
id: composer-cache | ||
shell: bash | ||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | ||
|
||
- name: Cache dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: dependencies-php-${{ matrix.php }}-os-${{ matrix.os }}-version-${{ matrix.dependency-version }}-composer-${{ hashFiles('composer.json') }} | ||
restore-keys: dependencies-php-${{ matrix.php }}-os-${{ matrix.os }}-version-${{ matrix.dependency-version }}-composer- | ||
|
||
- name: Install Composer dependencies | ||
run: composer update --${{ matrix.dependency-version }} --no-interaction --prefer-dist | ||
|
||
- name: Integration Tests | ||
run: php ./vendor/phpunit/phpunit/phpunit --testsuite default |