-
-
Notifications
You must be signed in to change notification settings - Fork 8
78 lines (63 loc) · 2.29 KB
/
ci.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
name: CI
on:
push:
pull_request:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php: ['8.1', '8.2']
laravel: ['9.*', '10.*']
include:
- laravel: '9.*'
testbench: '7.*'
- laravel: '10.*'
testbench: '8.*'
name: P${{ matrix.php }} - L${{ matrix.laravel }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.composer/cache/files
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: curl, json, mbstring, zip, sqlite, pdo_sqlite
coverage: pcov
- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --prefer-dist --no-interaction
# Lower PHP and laravel versions.
- name: PHPUnit without code coverage
if: matrix.php != '8.2' || matrix.laravel != '10.*'
run: vendor/bin/phpunit --no-coverage
# Last PHP and laravel versions.
- name: Code analysis
if: matrix.php == '8.2' && matrix.laravel == '10.*'
run: |
vendor/bin/pint --test -vvv
vendor/bin/phpmd config,src,tests text phpmd.xml
vendor/bin/phpstan analyse
- name: PHPUnit with code coverage
if: matrix.php == '8.2' && matrix.laravel == '10.*'
run: |
mkdir -p build/logs
vendor/bin/phpunit --coverage-text --coverage-clover build/logs/clover.xml
- name: Code coverage upload to Coveralls
if: env.COVERALLS_REPO_TOKEN && matrix.php == '8.2' && matrix.laravel == '10.*'
env:
COVERALLS_RUN_LOCALLY: 1
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
run: |
composer require php-coveralls/php-coveralls --with-all-dependencies
vendor/bin/php-coveralls -v --coverage_clover=build/logs/clover.xml