Handle running in testbench vs running in applications #34
Workflow file for this run
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: | |
| paths: | |
| - '**.php' | |
| - '.github/workflows/run-tests.yml' | |
| - 'phpunit.xml.dist' | |
| - 'composer.json' | |
| - 'composer.lock' | |
| jobs: | |
| test: | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 5 | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| php: [8.2, 8.4] | |
| laravel: [^11] | |
| stability: [prefer-lowest, prefer-stable] | |
| name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo | |
| coverage: none | |
| - 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 update --${{ matrix.stability }} --prefer-dist --no-interaction | |
| composer dump-autoload --optimize | |
| - name: List Installed Dependencies | |
| run: composer show -D | |
| - name: Execute tests | |
| run: vendor/bin/pest --ci | |
| coverage: | |
| needs: [ test ] | |
| name: coverage | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest] | |
| php: [8.4] | |
| laravel: [^11] | |
| stability: [prefer-stable] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Cache dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.composer/cache/files | |
| key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-stability-${{ matrix.stability }}-composer-${{ hashFiles('composer.json') }} | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, 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 update --${{ matrix.stability }} --prefer-dist --no-interaction | |
| composer dump-autoload --optimize | |
| - name: Test & publish code coverage | |
| uses: paambaati/[email protected] | |
| env: | |
| CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | |
| with: | |
| coverageCommand: composer test-coverage | |
| coverageLocations: | | |
| ${{github.workspace}}/build/logs/clover.xml:clover |