-
Notifications
You must be signed in to change notification settings - Fork 7
132 lines (111 loc) · 4.17 KB
/
Copy pathci.yml
File metadata and controls
132 lines (111 loc) · 4.17 KB
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
124
125
126
127
128
129
130
131
132
name: CI
on:
push:
branches:
- main
pull_request:
jobs:
Lint:
name: lint check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup php 8.2
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: curl, dom, exif, fileinfo, hash, json, mbstring, mysqli, sodium, openssl, pcre, imagick, xml, zip
ini-values: assert.exception=1, zend.assertions=1
- name: Get composer cache directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Create cache for composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer
restore-keys: ${{ runner.os }}-composer
- name: Install Composer dependencies
run: composer install --prefer-dist --optimize-autoloader
- name: lint
run: composer lint
PHPUnit:
name: PHPUnit check for PHP ${{ matrix.php-versions }} and WP ${{ matrix.wp-versions }}
runs-on: ubuntu-latest
strategy:
matrix:
wp-versions: ['latest']
php-versions: [ '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2' ]
include:
- php-versions: '7.4'
wp-versions: 'trunk'
services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: curl, dom, exif, fileinfo, hash, json, mbstring, mysqli, openssl, pcre, xml, zip
ini-values: assert.exception=1, zend.assertions=1
- name: Install WordPress
run: bash bin/install-wp-tests.sh wordpress_test root '' 127.0.0.1 ${{ matrix.wp-versions }}
- name: Install PHPUnit for PHP 7.0
if: matrix.php-versions == '7.0'
run: composer global require "phpunit/phpunit=6.*"
- name: Install PHPUnit for PHP 7.1
if: matrix.php-versions == '7.1'
run: composer global require "phpunit/phpunit=7.*"
- name: Install PHPUnit for PHP 7.2
if: matrix.php-versions == '7.2'
run: composer global require "phpunit/phpunit=8.*"
- name: Install PHPUnit for PHP 7.3 - PHP 8.0
if: matrix.php-versions == '7.3' || matrix.php-versions == '7.4' || matrix.php-versions == '8.0' || matrix.php-versions == '8.1' || matrix.php-versions == '8.2'
run: composer global require "phpunit/phpunit=9.*"
# Commeting this out because PHPUnit 10 doesn't work
# - name: Install PHPUnit for PHP 8.1 - 8.2
# if: matrix.php-versions == '8.1' || matrix.php-versions == '8.2'
# run: composer global require "phpunit/phpunit=10.*"
- name: Install phpunit-polyfills
run: composer global require yoast/phpunit-polyfills
- run: phpunit --version
- name: Run PHPUnit
run: phpunit
- name: Run PHPUnit multisite
run: WP_MULTISITE=1 phpunit
Build:
name: Build check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get Node version
id: node_version
run: |
VERSION=`cat .nvmrc`
echo ::set-output name=value::$VERSION
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ steps.node_version.outputs.value }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v4
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn
restore-keys: ${{ runner.os }}-yarn
- name: yarn install
run: yarn install --prefer-offline
- name: build
run: |
yarn build