Unit Tests — Services & Helpers #11
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: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| jobs: | |
| laravel-tests: | |
| runs-on: ubuntu-latest | |
| services: | |
| mysql: | |
| image: mysql:8.0 | |
| env: | |
| MYSQL_ROOT_PASSWORD: root | |
| MYSQL_DATABASE: eventra_testing | |
| ports: | |
| - 3306:3306 | |
| options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
| redis: | |
| image: redis | |
| ports: | |
| - 6379:6379 | |
| options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.3' | |
| extensions: mbstring, dom, curl, libxml, mysql, zip, gd, intl, exif | |
| coverage: none | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install PHP Dependencies | |
| run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist | |
| - name: Install NPM Dependencies | |
| run: npm install | |
| - name: Build Assets | |
| run: npm run build | |
| - name: Copy .env | |
| run: php -r "file_exists('.env') || copy('.env.example', '.env');" | |
| - name: Generate key | |
| run: php artisan key:generate | |
| - name: Directory Permissions | |
| run: chmod -R 777 storage bootstrap/cache | |
| - name: Run Migrations | |
| run: php artisan migrate --env=testing --force | |
| - name: Run Tests | |
| run: php artisan test --parallel | |
| - name: Run PHPStan | |
| run: ./vendor/bin/phpstan analyze | |
| - name: Run Pint | |
| run: ./vendor/bin/pint --test |