diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..856d474 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,70 @@ +name: Run Tests + +on: # zizmor: ignore[concurrency-limits] + push: + branches: + - main + - '*.x' + pull_request: + schedule: + - cron: '0 0 * * *' + +permissions: {} + +jobs: + php-tests: + runs-on: ${{ matrix.os }} + if: "!contains(github.event.head_commit.message, '[ci skip]')" + + strategy: + matrix: + php: [8.3, 8.4, 8.5] + laravel: [13.*, 12.*] + stability: [prefer-lowest, prefer-stable] + os: [ubuntu-latest] + include: + - os: windows-latest + php: 8.5 + laravel: 13.* + stability: prefer-stable + + name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} + + steps: + - name: Checkout code + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Setup PHP + uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2 + 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: Install dependencies + shell: bash + env: + LARAVEL: ${{ matrix.laravel }} + STABILITY: ${{ matrix.stability }} + run: | + composer require "illuminate/contracts:$LARAVEL" --no-interaction --no-update + composer update --$STABILITY --prefer-dist --no-interaction --no-suggest + + - name: Execute tests + run: vendor/bin/phpunit + + - name: Send Slack notification + uses: slackapi/slack-github-action@dcb1066f776dd043e64d0e8ba94ca15cc7e1875d # v4.0.0 + if: failure() && github.event_name == 'schedule' + with: + webhook: ${{ secrets.SLACK_WEBHOOK }} + webhook-type: incoming-webhook + payload: | + text: ":x: *${{ github.repository }}* tests failed" + blocks: + - type: section + text: + type: mrkdwn + text: ":x: *${{ github.repository }}* tests failed\n*Ref:* ${{ github.ref }}\n*Author:* ${{ github.actor }}\n*Workflow:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }}>"