-
-
Notifications
You must be signed in to change notification settings - Fork 540
164 lines (141 loc) · 4.76 KB
/
tests.yml
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
name: Run Tests
on:
push:
branches:
- master
- '*.x'
pull_request:
schedule:
- cron: '0 0 * * *'
jobs:
php-tests:
runs-on: ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, '[ci skip]')"
strategy:
matrix:
php: [8.1, 8.2, 8.3, 8.4]
laravel: [10.*, 11.*]
stability: [prefer-lowest, prefer-stable]
os: [ubuntu-latest]
include:
- os: windows-latest
php: 8.3
laravel: 10.*
stability: prefer-stable
- os: windows-latest
php: 8.3
laravel: 11.*
stability: prefer-stable
exclude:
- php: 8.1
laravel: 11.*
- php: 8.4
laravel: 10.*
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44
with:
files: |
config
resources/lang
resources/users
resources/views
routes
src
tests
composer.json
phpunit.xml.dist
.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: Update apt sources
if: steps.should-run-tests.outputs.result == 'true' && matrix.os == 'ubuntu-latest'
run: |
sudo apt-get check || sudo apt --fix-broken install -y
sudo apt-get update
- name: Install French Locale
if: steps.should-run-tests.outputs.result == 'true' && matrix.os == 'ubuntu-latest'
run: sudo apt-get install language-pack-fr
- name: Setup PHP
uses: shivammathur/setup-php@v2
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@v3
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/phpunit
js-tests:
runs-on: ubuntu-20.04
if: "!contains(github.event.head_commit.message, '[ci skip]')"
name: JavaScript tests
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44
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 16.13.0
uses: actions/setup-node@v4
with:
node-version: 16.13.0
- name: Install required npm version
if: steps.should-run-tests.outputs.result == 'true'
run: npm -g install [email protected]
- name: Install dependencies
if: steps.should-run-tests.outputs.result == 'true'
run: npm ci
- name: Execute tests
if: steps.should-run-tests.outputs.result == 'true'
run: npm run test
slack:
name: Slack Notification
runs-on: ubuntu-20.04
needs: [php-tests, js-tests]
if: always()
steps:
- uses: technote-space/workflow-conclusion-action@v3
- name: Send Slack notification
uses: 8398a7/action-slack@v3
if: env.WORKFLOW_CONCLUSION == 'failure' && github.event_name == 'schedule'
with:
status: failure
fields: repo,message,commit,author,action,eventName,ref,workflow
author_name: ${{ github.actor }}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}