-
Notifications
You must be signed in to change notification settings - Fork 33
123 lines (118 loc) · 3.79 KB
/
php-lint-test.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
name: PHP linting and tests
on:
pull_request
env:
WP_VERSION: latest
WC_VERSION: latest # the min supported version as per L-2 policy
jobs:
phpcs:
name: PHP Code Sniffer
runs-on: ubuntu-latest
steps:
# clone the repository
- uses: actions/checkout@v2
with:
fetch-depth: 0
# enable dependencies caching
- uses: actions/cache@v2
with:
path: ~/.cache/composer/
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
# setup PHP, but without debug extensions for reasonable performance
- uses: shivammathur/setup-php@v2
with:
php-version: '7.3' # needs >=7.3 for SARB
tools: composer
coverage: none
- name: Install SVN
run: sudo apt-get install -y subversion
# install dependencies and run phpcs
- run: composer self-update 2.0.6 && composer install --no-progress && composer phpcs
lint:
name: PHP Linting
runs-on: ubuntu-latest
steps:
# clone the repository
- uses: actions/checkout@v2
# setup PHP, but without debug extensions for reasonable performance
- uses: shivammathur/setup-php@v2
with:
php-version: '7.3'
coverage: none
- name: Install SVN
run: sudo apt-get install -y subversion
# run CI checks
- run: find . \( -path ./vendor \) -prune -o \( -name '*.php' \) -exec php -lf {} \;| (! grep -v "No syntax errors detected" )
test:
name: PHP testing
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 10
matrix:
php: [ '7.4', '8.0', '8.1', '8.2' ]
steps:
# clone the repository
- uses: actions/checkout@v2
# enable dependencies caching
- uses: actions/cache@v2
with:
path: ~/.cache/composer/
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
# setup PHP, but without debug extensions for reasonable performance
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer
- name: Install SVN
run: sudo apt-get install -y subversion
# run CI checks
- run: |
echo "bash bin/run-ci-tests.sh"
bash bin/run-ci-tests.sh
compatibility-oldest:
name: Run unit tests on Oldest supported version
runs-on: ubuntu-latest
env:
WC_VERSION: 7.7.0 # the min supported version as per L-2 policy
WP_VERSION: 'latest'
steps:
# clone the repository
- uses: actions/checkout@v2
# enable dependencies caching
- uses: actions/cache@v2
with:
path: ~/.cache/composer/
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
# setup PHP, but without debug extensions for reasonable performance
- uses: shivammathur/setup-php@v2
with:
php-version: '7.3'
tools: composer
- name: Install SVN
run: sudo apt-get install -y subversion
# run CI checks
- run: bash bin/run-ci-tests.sh
compatibility-beta:
name: Run unit tests on beta WC
runs-on: ubuntu-latest
env:
WC_VERSION: 'beta'
WP_VERSION: 'latest'
steps:
# clone the repository
- uses: actions/checkout@v2
# enable dependencies caching
- uses: actions/cache@v2
with:
path: ~/.cache/composer/
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
# setup PHP, but without debug extensions for reasonable performance
- uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
tools: composer
- name: Install SVN
run: sudo apt-get install -y subversion
# run CI checks
- run: bash bin/run-ci-tests.sh