-
Notifications
You must be signed in to change notification settings - Fork 53
90 lines (77 loc) · 2.7 KB
/
test-code.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
name: "Run unit tests"
on:
push:
branches:
- master
pull_request:
jobs:
test-laravel:
name: Test Laravel ${{ matrix.laravel }} on PHP ${{ matrix.php }}
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental == true }}
strategy:
fail-fast: false
matrix:
php:
- '8.2'
- '8.3'
- nightly
laravel:
- '10.0'
- '11.0'
include:
- laravel: '10.0'
testbench: '8.0'
- laravel: '11.0'
testbench: '9.0'
- php: 8.3
laravel: '11.0'
stable: true
- php: nightly
experimental: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: exif,json,mbstring
coverage: pcov
- name: Configure to use Laravel ${{ matrix.laravel }} with Testbench ${{ matrix.testbench }}
run: |
composer require --no-update laravel/laravel:^${{ matrix.laravel }}
composer require --no-update --dev orchestra/testbench:^${{ matrix.testbench }}
- name: Configure local Laravel Nova dummy package
run: composer config repositories.0 path ./tests/Fixtures/nova
- name: Install Composer dependencies
uses: ramsey/composer-install@v3
with:
composer-options: "--ignore-platform-req=php"
- name: Run unit tests with coverage and printer
id: phpunit
run: |
echo "phpunit_version=$( vendor/bin/phpunit --version | cut -d ' ' -f 2 )" >> $GITHUB_OUTPUT
vendor/bin/phpunit \
--log-junit ./report-junit.xml \
--coverage-clover ./coverage-clover.xml
- name: Report test results
if: success() || failure()
uses: mikepenz/action-junit-report@v4
with:
report_paths: ./report-junit.xml
check_name: Laravel ${{ matrix.laravel }}, PHP ${{ matrix.php }} (PHPUnit ${{ steps.phpunit.outputs.phpunit_version }})
summary: |
PHP version: `${{ matrix.php }}`
Laravel version: `${{ matrix.laravel }}`
Testbench version: `${{ matrix.testbench }}`
PHPUnit version: `${{ steps.phpunit.outputs.phpunit_version }}`
- name: Determine coverage
uses: slavcodev/coverage-monitor-action@1.9.0
if: github.event_name == 'pull_request' && matrix.stable == true
continue-on-error: true
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
coverage_path: ./coverage-clover.xml
threshold_alert: 60
threshold_warning: 85