Optimize code #151
This file contains hidden or 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: CI | |
on: | |
[push, pull_request] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
php: [8.2, 8.3] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
tools: composer:2 | |
extensions: pdo, sqlite3 | |
- name: Validate composer files | |
run: composer validate --strict | |
- name: Cache Composer dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ~/.composer/cache | |
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} | |
- name: Install dependencies | |
run: composer install --prefer-dist --no-interaction | |
- name: Check coding style (optional) | |
run: composer lint | |
continue-on-error: true # In case you want to not fail build if lint fails | |
- name: Run Unit Tests | |
run: | | |
echo "Running unit tests with $(which php)" | |
if [ -f .Build/bin/phpunit ]; then | |
.Build/bin/phpunit --colors=always Tests/Unit/ | |
elif [ -f vendor/bin/phpunit ]; then | |
vendor/bin/phpunit --colors=always Tests/Unit/ | |
else | |
echo "phpunit binary not found!" | |
exit 1 | |
fi |