⬆️ Update dependency larastan/larastan to v2.9.12 #556
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: Testing | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: [opened, synchronize, reopened] | |
env: | |
DEFAULT_FOLDER: "./laravel" | |
jobs: | |
pest: | |
name: "🧹 Laravel Pest (PHP: ${{ matrix.php-versions }} - Laravel: ${{ matrix.laravel }})" | |
runs-on: ${{ matrix.operating-system }} | |
# Service container MySQL | |
services: | |
mysql: | |
image: mysql:8.4 | |
env: | |
MYSQL_USER: laravel_user | |
MYSQL_DATABASE: db_test_laravel | |
MYSQL_ALLOW_EMPTY_PASSWORD: yes | |
ports: | |
- 33306:3306 | |
# Set health checks to wait until mysql database has started (it takes some seconds to start) | |
options: --health-cmd "mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 10 | |
strategy: | |
fail-fast: false | |
matrix: | |
operating-system: [ubuntu-latest] | |
php-versions: ["8.2", "8.3"] | |
laravel: ["11.*"] | |
include: | |
- laravel: 11.* | |
testbench: 9.* | |
steps: | |
- name: ⤵️ Check out code from GitHub | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: 🏗 Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20.x" | |
- name: 💻 Show PHP and NPM versions | |
run: | | |
npm --version | |
php --version | |
- name: 🏗 Install NPM packages | |
working-directory: ${{env.DEFAULT_FOLDER}} | |
run: npm ci | |
- name: 🛠️ Build frontend | |
working-directory: ${{env.DEFAULT_FOLDER}} | |
run: npm run build | |
- name: 🏗 Setup PHP, with composer and extensions | |
uses: shivammathur/[email protected] | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: mbstring, bcmath | |
coverage: pcov | |
- name: 🛠️ Copy ENV Laravel Configuration for CI | |
working-directory: ${{env.DEFAULT_FOLDER}} | |
run: php -r "file_exists('.env') || copy('.env.example', '.env');" | |
- name: 🏗 Install Laravel Dependencies | |
working-directory: ${{env.DEFAULT_FOLDER}} | |
run: | | |
composer install --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist | |
# - name: Show files in folder | |
# working-directory: ${{env.DEFAULT_FOLDER}} | |
# run: ls -lao | |
- name: 🛠️ Generate key | |
working-directory: ${{env.DEFAULT_FOLDER}} | |
run: | | |
php artisan key:generate | |
php artisan config:clear | |
- name: 🛠️ Directory Permissions | |
working-directory: ${{env.DEFAULT_FOLDER}} | |
run: chmod -R 777 storage bootstrap/cache | |
- name: 🚀 Run Migrations | |
working-directory: ${{env.DEFAULT_FOLDER}} | |
# Set environment | |
env: | |
DB_CONNECTION: mysql | |
DB_DATABASE: db_test_laravel | |
DB_PORT: ${{ job.services.mysql.ports[3306] }} | |
DB_USER: laravel_user | |
run: php artisan migrate | |
- name: 🚀 Execute tests (Unit and Feature tests) via Pest | |
working-directory: ${{env.DEFAULT_FOLDER}} | |
# Set environment | |
env: | |
DB_CONNECTION: mysql | |
DB_DATABASE: db_test_laravel | |
DB_PORT: ${{ job.services.mysql.ports[3306] }} | |
DB_USER: laravel_user | |
run: vendor/bin/pest --coverage --coverage-clover coverage.xml | |
- name: 🚀 Upload coverage to Codecov | |
uses: codecov/[email protected] | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./laravel/coverage.xml | |
flags: pest |