Upgrade Laravel 10 #63
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: [master, develop] | |
pull_request: | |
branches: [master, develop] | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
env: | |
DB_DATABASE: laravel | |
DB_USERNAME: root | |
DB_PASSWORD: password | |
BROADCAST_DRIVER: log | |
CACHE_DRIVER: file | |
QUEUE_CONNECTION: sync | |
SESSION_DRIVER: file | |
services: | |
mysql: | |
image: mysql:latest | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: false | |
MYSQL_ROOT_PASSWORD: password | |
MYSQL_DATABASE: laravel | |
ports: | |
- 3306/tcp | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
strategy: | |
fail-fast: true | |
matrix: | |
os: [ubuntu-latest] | |
php: [8.2] | |
laravel: [9.*] | |
stability: [prefer-stable] | |
name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Cache PHP dependencies | |
uses: actions/cache@v4 | |
with: | |
path: vendor | |
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, bcmath, intl, gd, fileinfo | |
coverage: xdebug | |
- name: Setup problem matchers | |
run: | | |
echo "::add-matcher::${{ runner.tool_cache }}/php.json" | |
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | |
- name: Install dependencies | |
run: composer install --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist | |
- name: Setup application | |
run: | | |
php -r "file_exists('.env') || copy('.env.example', '.env');" | |
php artisan key:generate | |
- name: Run Migration | |
run: php artisan migrate -v | |
env: | |
DB_PORT: ${{ job.services.mysql.ports['3306'] }} | |
- name: Execute tests | |
run: vendor/bin/phpunit --testdox | |
env: | |
DB_PORT: ${{ job.services.mysql.ports['3306'] }} | |
- name: Prepare paths for SonarQube analysis | |
run: | | |
sed -i "s|$GITHUB_WORKSPACE|/github/workspace|g" tests/coverage/php/logs/clover.xml | |
sed -i "s|$GITHUB_WORKSPACE|/github/workspace|g" tests/coverage/php/report.junit.xml | |
- name: Run SonarQube analysis | |
uses: sonarsource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |