run-tests #2047
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: run-tests | |
| on: | |
| push: | |
| pull_request: | |
| schedule: | |
| - cron: '0 0 * * *' | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| php: [8.4, 8.3, 8.2] | |
| laravel: ['^12.0'] | |
| name: P${{ matrix.php }} - L${{ matrix.laravel }} | |
| services: | |
| mysql: | |
| image: mysql:8.0 | |
| env: | |
| MYSQL_ALLOW_EMPTY_PASSWORD: yes | |
| MYSQL_DATABASE: model_uuid | |
| ports: | |
| - 3306 | |
| options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| extensions: json, dom, curl, libxml, mbstring, pdo, sqlite, pdo_sqlite | |
| coverage: none | |
| - name: Cache dependencies | |
| id: composer-cache | |
| run: | | |
| echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
| - uses: actions/cache@v3 | |
| with: | |
| path: ${{ steps.composer-cache.outputs.dir }} | |
| key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-composer- | |
| - name: Cache pint.json | |
| uses: actions/cache@v3 | |
| with: | |
| path: pint.json | |
| key: ${{ runner.os }}-pint | |
| restore-keys: ${{ runner.os }}-pint | |
| - name: Install dependencies | |
| run: | | |
| composer require "illuminate/contracts=${{ matrix.laravel }}" --prefer-dist --no-interaction --no-update | |
| composer update --prefer-dist --no-interaction --no-progress | |
| - name: Lint | |
| run: vendor/bin/pint --test | |
| - name: Execute tests | |
| run: vendor/bin/phpunit | |
| env: | |
| DB_CONNECTION: mysql | |
| DB_DATABASE: model_uuid | |
| DB_USERNAME: root | |
| DB_PORT: ${{ job.services.mysql.ports[3306] }} |