Less strict composer.json validation #14
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
name: Run Tests | |
on: | |
push: | |
branches: [ "main" ] | |
paths: | |
- 'src/**.php' | |
- '.github/workflows/laravel-tests.yml' | |
pull_request: | |
branches: [ "main" ] | |
paths: | |
- 'src/**.php' | |
- '.github/workflows/laravel-tests.yml' | |
defaults: | |
run: | |
working-directory: src | |
concurrency: | |
group: "${{ github.workflow_ref }}-${{ github.ref }}" | |
cancel-in-progress: true | |
jobs: | |
tests: | |
strategy: | |
matrix: | |
php-version: [8.2, 8.3, 8.4] | |
os: [ubuntu-latest] | |
runs-on: ${{ matrix.os }} | |
name: PHPUnit tests with PHP ${{ matrix.php-versions }} on ${{ matrix.os }} | |
env: | |
php-extensions: intl, pcov | |
php-coverage: pcov | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: PHP extensions cache | |
id: extcache | |
uses: shivammathur/cache-extensions@v1 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: ${{ env.php-extensions }} | |
key: vl-${{ matrix.os }}-php${{ matrix.php-version }}-${{ hashFiles('composer.json', 'composer.lock', 'package.json', 'package.lock') }} | |
- name: Get Composer cache directory | |
id: composer-cache | |
run: | | |
composer validate | |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache dependencies | |
uses: actions/cache@v4.2.0 | |
with: | |
path: | | |
${{ steps.extcache.outputs.dir }} | |
${{ steps.composer-cache.outputs.dir }} | |
src/vendor | |
src/node_modules | |
key: ${{ steps.extcache.outputs.key }} | |
restore-keys: vl-${{ matrix.os }}-php${{ matrix.php-version }}- | |
- uses: shivammathur/setup-php@9e72090525849c5e82e596468b86eb55e9cc5401 | |
with: | |
php-version: ${{ matrix.php-version }} | |
extensions: ${{ env.php-extensions }} | |
coverage: ${{ env.php-coverage }} | |
- name: Prepare Env. | |
run: | | |
# Copy .env, Generate key, Set directory permissions, Create empty SQLite DB | |
php -r "file_exists('.env') || copy('.env.example', '.env');" | |
php artisan key:generate | |
chmod -R 777 storage storage/database bootstrap/cache | |
mkdir -p storage/database | |
rm -f storage/database/visual-laravel.sqlite | |
touch storage/database/visual-laravel.sqlite | |
- name: Install Dependencies | |
run: | | |
composer self-update && composer install --no-interaction --no-progress --prefer-dist -vv | |
npm run build | |
- name: Run PHPUnit/Pest tests | |
env: | |
DB_CONNECTION: sqlite | |
run: php artisan test |