Skip to content

Add plan-feature and build-feature skills #34323

Add plan-feature and build-feature skills

Add plan-feature and build-feature skills #34323

Workflow file for this run

name: Run Tests
on:
push:
branches:
- master
- '*.x'
pull_request:
schedule:
- cron: '0 0 * * *'
permissions: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
php-tests:
runs-on: ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, '[ci skip]')"
permissions:
contents: read
strategy:
matrix:
php: [8.3, 8.4, 8.5]
laravel: [12.*, 13.*]
stability: [prefer-lowest, prefer-stable]
os: [ubuntu-latest]
shard: [1, 2, 3, 4]
shards: [4] # single value, so it doesn't multiply the combinations
# An include entry that overrides an existing matrix key (os) creates a standalone
# combination rather than merging, so it wouldn't inherit the shard dimension.
# Windows is the slowest job, so each shard has to be listed explicitly. It's split
# more ways than ubuntu because its tests take roughly twice as long to run.
include:
- { os: windows-latest, php: 8.5, laravel: '12.*', stability: prefer-stable, shard: 1, shards: 6 }
- { os: windows-latest, php: 8.5, laravel: '12.*', stability: prefer-stable, shard: 2, shards: 6 }
- { os: windows-latest, php: 8.5, laravel: '12.*', stability: prefer-stable, shard: 3, shards: 6 }
- { os: windows-latest, php: 8.5, laravel: '12.*', stability: prefer-stable, shard: 4, shards: 6 }
- { os: windows-latest, php: 8.5, laravel: '12.*', stability: prefer-stable, shard: 5, shards: 6 }
- { os: windows-latest, php: 8.5, laravel: '12.*', stability: prefer-stable, shard: 6, shards: 6 }
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} - shard ${{ matrix.shard }}/${{ matrix.shards }}
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6
with:
files: |
config/**
lang/**
resources/users/**
resources/views/**
routes/**
src/**
tests/**
composer.json
phpunit.dist.xml
.github/workflows/tests.yml
**.php
- name: Determine whether tests should run
id: should-run-tests
if: steps.changed-files.outputs.any_modified == 'true' || github.event_name == 'schedule'
run: |
echo "result=true" >> $GITHUB_OUTPUT
echo "result=true" >> $env:GITHUB_OUTPUT
- name: Install French Locale
if: steps.should-run-tests.outputs.result == 'true' && matrix.os == 'ubuntu-latest'
run: |
sudo locale-gen fr_FR.UTF-8
locale -a | grep -q '^fr_FR\.utf8$'
- name: Setup PHP
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
if: steps.should-run-tests.outputs.result == 'true'
with:
php-version: ${{ matrix.php }}
extensions: fileinfo, exif, gd, pdo, sqlite, pdo_sqlite
ini-values: short_open_tag=on
coverage: none
- name: Install dependencies
uses: nick-invision/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 # v4.0.0
if: steps.should-run-tests.outputs.result == 'true'
with:
timeout_minutes: 5
max_attempts: 5
command: |
composer require "illuminate/contracts:${{ matrix.laravel }}" --dev --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
- name: List Installed Dependencies
if: steps.should-run-tests.outputs.result == 'true'
run: composer show -D
- name: Execute tests
if: steps.should-run-tests.outputs.result == 'true'
run: vendor/bin/pest --shard=${{ matrix.shard }}/${{ matrix.shards }} --ci # zizmor: ignore[template-injection] shard is a static list defined in the matrix above
php-tests-result:
name: PHP tests
runs-on: ubuntu-latest
needs: [php-tests]
if: always()
permissions: {}
steps:
- name: Fail if any shard failed
if: needs.php-tests.result != 'success' && needs.php-tests.result != 'skipped'
run: exit 1
js-tests:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
permissions:
contents: read
name: JavaScript tests
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6
with:
files: |
**/*.{js,vue,ts}
package.json
.github/workflows/tests.yml
- name: Determine whether tests should run
id: should-run-tests
if: steps.changed-files.outputs.any_modified == 'true' || github.event_name == 'schedule'
run: |
echo "result=true" >> $GITHUB_OUTPUT
echo "result=true" >> $env:GITHUB_OUTPUT
- name: Use Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
- name: Install dependencies
if: steps.should-run-tests.outputs.result == 'true'
run: npm ci
- name: Install Playwright browsers
if: steps.should-run-tests.outputs.result == 'true'
run: npx playwright install chromium
- name: Execute tests
if: steps.should-run-tests.outputs.result == 'true'
run: npm run test
env:
CI: true
LARAVEL_BYPASS_ENV_CHECK: 1
LANG: en_US.UTF-8
- name: Verify build succeeds
if: steps.should-run-tests.outputs.result == 'true'
run: npm run build
slack:
name: Slack Notification
runs-on: ubuntu-latest
needs: [php-tests-result, js-tests]
permissions:
actions: read # required by workflow-conclusion-action to determine overall workflow status
if: always()
steps:
- uses: technote-space/workflow-conclusion-action@45ce8e0eb155657ab8ccf346ade734257fd196a5 # v3.0.3
- name: Send Slack notification
uses: slackapi/slack-github-action@dcb1066f776dd043e64d0e8ba94ca15cc7e1875d # v4.0.0
if: env.WORKFLOW_CONCLUSION == '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 }}>"