-
-
Notifications
You must be signed in to change notification settings - Fork 641
196 lines (169 loc) · 7.08 KB
/
Copy pathtests.yml
File metadata and controls
196 lines (169 loc) · 7.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
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 }}>"