-
Notifications
You must be signed in to change notification settings - Fork 68
102 lines (102 loc) · 2.97 KB
/
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
# On push, run the action-wporg-validator workflow.
name: Linting & Test
on: [push]
jobs:
validate-readme-spacing:
name: Validate README Spacing
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: pantheon-systems/validate-readme-spacing@v1
lint:
name: PHPCS Linting
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/vendor
key: test-lint-dependencies-{{ checksum "composer.json" }}
restore-keys: test-lint-dependencies-{{ checksum "composer.json" }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
- name: Install dependencies
run: composer install -n --prefer-dist
- name: Run PHP Lint
run: composer phpcs
wporg-validation:
name: WP.org Validator
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: WP.org Validator
uses: pantheon-systems/[email protected]
with:
type: plugin
php8-compatibility:
name: PHP 8.x Compatibility
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: pantheon-systems/phpcompatibility-action@dev
with:
paths: ${{ github.workspace }}/*.php
test-versions: 8.0-
test:
needs: lint
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
php_version: [7.4, 8.2, 8.3]
redis_enabled: [true, false]
services:
mariadb:
image: mariadb:${{ (matrix.php_version == '7.4') && '10.5' || '10.6' }}
redis:
image: redis:6.2
ports:
- 6379:6379
steps:
- uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php_version }}
extensions: mysqli, zip, imagick, redis
- name: Start MySQL Service
run: sudo systemctl start mysql
- name: Test Redis
run: |
sudo apt-get install -y redis-tools
redis-cli -h localhost ping
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/vendor
key: test-dependencies-{{ checksum "composer.json" }}
restore-keys: test-dependencies-{{ checksum "composer.json" }}
- name: Setup WP-CLI
uses: godaddy-wordpress/setup-wp-cli@1
- name: Install dependencies
run: |
if [ ${{ matrix.php_version }} = "7.4" ]; then
composer update
fi
composer install
- name: Run PHPUnit
run: |
if [ ${{ matrix.redis_enabled }} = 'true' ]; then
export WP_REDIS_USE_CACHE_GROUPS=1
echo -e "🔋 Testing with Redis enabled"
else
echo -e "🪫 Testing with Redis disabled"
fi
bash ./bin/phpunit-test.sh