-
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.
- Loading branch information
1 parent
b782522
commit 9161b43
Showing
1 changed file
with
83 additions
and
0 deletions.
There are no files selected for viewing
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,83 @@ | ||
name: Test | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
|
||
tests: | ||
name: Unit Tests on PHP ${{ matrix.php-versions }} with ${{ matrix.deps }} dependencies | ||
|
||
strategy: | ||
matrix: | ||
php-versions: | ||
- '8.1' | ||
- '8.2' | ||
- '8.3' | ||
deps: | ||
- 'highest' | ||
- 'lowest' | ||
|
||
env: | ||
extensions: pdo_mysql | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Setup cache Environment | ||
id: extcache | ||
uses: shivammathur/cache-extensions@v1 | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
extensions: ${{ env.extensions }} | ||
key: ext-cache-v1 | ||
|
||
- name: Cache extensions | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ steps.extcache.outputs.dir }} | ||
key: ${{ steps.extcache.outputs.key }} | ||
restore-keys: ${{ steps.extcache.outputs.key }} | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
extensions: ${{ env.extensions }} | ||
coverage: pcov | ||
env: | ||
fail-fast: true | ||
|
||
- name: Get composer cache directory | ||
id: composer-cache | ||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | ||
|
||
- name: Cache dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-${{ matrix.deps }}-composer-${{ hashFiles('**/composer.json') }} | ||
restore-keys: ${{ runner.os }}-${{ matrix.deps }}-composer- | ||
|
||
- name: Install dependencies | ||
run: | | ||
if [[ "${{ matrix.deps }}" == "lowest" ]]; then | ||
composer update --prefer-lowest --no-progress --no-suggest --ansi --prefer-dist | ||
else | ||
composer update --prefer-stable --no-progress --no-suggest --ansi --prefer-dist | ||
fi | ||
- name: Run PHPUnit | ||
run: composer test | ||
|
||
- name: Run PHPStan | ||
run: composer lint |