-
-
Notifications
You must be signed in to change notification settings - Fork 3
95 lines (76 loc) · 2.68 KB
/
main.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
name: Check
on:
- push
- pull_request
defaults:
run:
shell: bash
jobs:
phpcs:
name: PHP CodeSniffer
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.2"
coverage: none
- name: Determine Composer cache directory
id: composer-cache-directory
run: echo "directory=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer dependencies
uses: actions/cache@v3
if: always()
with:
path: ${{ steps.composer-cache-directory.outputs.directory }}
key: ${{ runner.os }}-composer-phpcs-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-phpcs-
- name: Cache PHP CodeSniffer results
uses: actions/cache@v3
if: always()
with:
path: /tmp/phpcs.*.cache
key: ${{ runner.os }}-phpcs-${{ github.sha }}
restore-keys: ${{ runner.os }}-phpcs-
- name: Install dependencies
run: composer install --classmap-authoritative --prefer-dist --no-interaction --no-progress
- name: Run PHP CodeSniffer
run: composer phpcs
phpunit:
name: PHPUnit
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ["8.1", "8.2", "8.3", "8.4"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: pcov
- name: Determine Composer cache directory
id: composer-cache-directory
run: echo "directory=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer dependencies
uses: actions/cache@v3
if: always()
with:
path: ${{ steps.composer-cache-directory.outputs.directory }}
key: ${{ runner.os }}-${{ matrix.php }}-composer-phpunit-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-${{ matrix.php }}-composer-phpunit-
- name: Install dependencies
run: composer install --classmap-authoritative --prefer-dist --no-interaction --no-progress
- name: Run PHPUnit
run: composer phpunit
# Disabled because Scrutinizer Ocular has some problems
#
# - name: Upload coverage to Scrutinizer CI
# if: always() && matrix.php == '8.2'
# run: |
# wget --no-verbose https://scrutinizer-ci.com/ocular.phar
# php ocular.phar code-coverage:upload --format=php-clover build/clover.xml