toddy15/spamdetect

View on GitHub
.github/workflows/test.yml

Summary

Maintainability
Test Coverage
name: Test

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  test:
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest]
        laravel: [11.*, 10.*, 9.*]
        php: [8.3, 8.2, 8.1]
        exclude:
          - laravel: 11.*
            php: 8.1

    name: Laravel ${{ matrix.laravel }} - PHP ${{ matrix.php }} - ${{ matrix.os }}

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php }}
          extensions: mbstring
          coverage: xdebug

      - name: Install dependencies
        run: |
          composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update
          composer update --prefer-stable --no-interaction

      - name: Execute tests
        run: vendor/bin/pest --coverage-clover coverage.xml

      - name: Upload coverage
        continue-on-error: true
        if: ${{ matrix.php == '8.2' && matrix.laravel == '10.*'}}
        uses: paambaati/codeclimate-action@v6
        env:
          CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
        with:
          coverageLocations: ${{github.workspace}}/coverage.xml:clover