Skip to content

Commit 539c780

Browse files
committed
Refactor GitHub Actions workflow to improve test execution and stability.
1 parent 812828e commit 539c780

File tree

1 file changed

+25
-26
lines changed

1 file changed

+25
-26
lines changed

.github/workflows/run-tests.yml

+25-26
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,54 @@
11
name: run-tests
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
paths:
6+
- '**.php'
7+
- '.github/workflows/run-tests.yml'
8+
- 'phpunit.xml.dist'
9+
- 'composer.json'
10+
- 'composer.lock'
411

512
jobs:
613
test:
714
runs-on: ${{ matrix.os }}
15+
timeout-minutes: 5
816
strategy:
9-
fail-fast: false
17+
fail-fast: true
1018
matrix:
11-
php: [8.2, 8.3]
12-
laravel: [10.*, 11.*]
13-
dependency-version: [prefer-stable]
1419
os: [ubuntu-latest]
20+
php: [8.3, 8.2]
21+
laravel: [10.*]
22+
stability: [prefer-lowest, prefer-stable]
1523
include:
1624
- laravel: 10.*
1725
testbench: 8.*
18-
- laravel: 11.*
19-
testbench: 9.*
2026

21-
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}
27+
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
2228

2329
steps:
2430
- name: Checkout code
2531
uses: actions/checkout@v4
2632

27-
- name: Install and start test server
28-
run: |
29-
cd tests/server
30-
npm install
31-
(node server.js &) || /bin/true
32-
33-
- name: Wait for server bootup
34-
run: sleep 5
35-
36-
- name: Cache dependencies
37-
uses: actions/cache@v4
38-
with:
39-
path: ~/.composer/cache/files
40-
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
41-
4233
- name: Setup PHP
4334
uses: shivammathur/setup-php@v2
4435
with:
4536
php-version: ${{ matrix.php }}
46-
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, mysql, mysqli, pdo_mysql, bcmath, soap, intl, gd, exif, iconv, imagick
37+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
4738
coverage: none
4839

40+
- name: Setup problem matchers
41+
run: |
42+
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
43+
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
44+
4945
- name: Install dependencies
5046
run: |
5147
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
52-
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
48+
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
49+
50+
- name: List Installed Dependencies
51+
run: composer show -D
5352

5453
- name: Execute tests
55-
run: vendor/bin/pest
54+
run: vendor/bin/pest --ci

0 commit comments

Comments
 (0)