|
| 1 | +name: PHPUnit |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "master" ] |
| 6 | + pull_request: |
| 7 | + branches: [ "master" ] |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + |
| 12 | +jobs: |
| 13 | + test: |
| 14 | + |
| 15 | + runs-on: ubuntu-latest |
| 16 | + |
| 17 | + services: |
| 18 | + mysql: |
| 19 | + image: mysql:5.7 |
| 20 | + env: |
| 21 | + MYSQL_ALLOW_EMPTY_PASSWORD: yes |
| 22 | + MYSQL_DATABASE: laravel_admin_test |
| 23 | + ports: |
| 24 | + - 3306:3306 |
| 25 | + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 |
| 26 | + |
| 27 | + strategy: |
| 28 | + fail-fast: true |
| 29 | + matrix: |
| 30 | + include: |
| 31 | + - php: 8.3 |
| 32 | + laravel: 12.* |
| 33 | + - php: 8.4 |
| 34 | + laravel: 12.* |
| 35 | + name: Laravel${{ matrix.laravel }}-PHP${{ matrix.php }} |
| 36 | + |
| 37 | + steps: |
| 38 | + - uses: actions/checkout@v4 |
| 39 | + |
| 40 | + - name: Setup PHP |
| 41 | + uses: shivammathur/setup-php@v2 |
| 42 | + with: |
| 43 | + php-version: ${{ matrix.php }} |
| 44 | + tools: composer:v2 |
| 45 | + coverage: xdebug |
| 46 | + |
| 47 | + - name: Validate composer.json and composer.lock |
| 48 | + run: composer validate --strict |
| 49 | + |
| 50 | + - name: Cache Composer packages |
| 51 | + id: composer-cache |
| 52 | + uses: actions/cache@v3 |
| 53 | + with: |
| 54 | + path: vendor |
| 55 | + key: ${{ runner.os }}-php-${{ matrix.php }}-Laravel${{ matrix.laravel }}-${{ hashFiles('**/composer.lock') }} |
| 56 | + restore-keys: | |
| 57 | + ${{ runner.os }}-php-${{ matrix.php }}-Laravel${{ matrix.laravel }} |
| 58 | +
|
| 59 | + - name: Install dependencies |
| 60 | + run: composer install --prefer-dist --no-progress |
| 61 | + |
| 62 | + - name: Run test suite |
| 63 | + run: composer test |
| 64 | + |
| 65 | + - name: Run Coveralls |
| 66 | + env: |
| 67 | + COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 68 | + COVERALLS_PARALLEL: true |
| 69 | + COVERALLS_FLAG_NAME: ${{ runner.os }} - ${{ matrix.php }} - Laravel${{ matrix.laravel }} |
| 70 | + run: | |
| 71 | + composer global require php-coveralls/php-coveralls:^2.4 |
| 72 | + php-coveralls --coverage_clover=.build/logs/clover.xml -v |
| 73 | +
|
| 74 | + upload-coverage: |
| 75 | + runs-on: ubuntu-latest |
| 76 | + needs: [ test ] |
| 77 | + steps: |
| 78 | + - name: Coveralls Finished |
| 79 | + uses: coverallsapp/github-action@master |
| 80 | + with: |
| 81 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 82 | + parallel-finished: true |
| 83 | + |
| 84 | + semantic-release: |
| 85 | + runs-on: ubuntu-latest |
| 86 | + needs: [ test, upload-coverage ] |
| 87 | + steps: |
| 88 | + - uses: actions/checkout@v2 |
| 89 | + - uses: actions/setup-node@v2 |
| 90 | + with: |
| 91 | + node-version: 'lts/*' |
| 92 | + |
| 93 | + - name: Run semantic-release |
| 94 | + env: |
| 95 | + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} |
| 96 | + run: npx semantic-release |
0 commit comments