-
Notifications
You must be signed in to change notification settings - Fork 63
134 lines (112 loc) · 3.66 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
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
133
name: Tests
on:
push:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
tests:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:5.7
env:
MYSQL_DATABASE: testdb
MYSQL_USER: user
MYSQL_PASSWORD: password
MYSQL_ROOT_PASSWORD: rootpassword
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
fail-fast: true
matrix:
php: ["7.4", "8.3"]
name: PHP ${{ matrix.php }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: 23.x
cache: 'npm'
- run: npm install -g gulp-cli eslint @babel/eslint-parser
- name: Install PHP
uses: shivammathur/setup-php@master
with:
php-version: ${{ matrix.php }}
- name: Report PHP version
run: php -v
- name: Cache Composer dependencies
id: cache-composer-dependencies
uses: actions/cache@v2
env:
cache-name: cache-composer-dependencies-${{ matrix.php }}
with:
# caching node_modules
path: vendor
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install Composer dependencies
if: steps.cache-composer-dependencies.outputs.cache-hit != 'true'
run: |
composer install -o
export PATH="$HOME/.composer/vendor/bin:$PATH"
- name: Cache node modules
id: cache-nodemodules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# caching node_modules
path: node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install npm Dependencies
if: steps.cache-nodemodules.outputs.cache-hit != 'true'
run: |
npm install
- name: Test Syntax
run: ./tests/test_for_syntax_errors.sh
- name: Test Installation
run: ./tests/test_installation.sh
- name: Get changed PHP files
id: changed-php-files
uses: tj-actions/changed-files@v35
with:
files: |
**/*.php
- name: Run PHPCS on changed PHP files
if: steps.changed-php-files.outputs.all_changed_files != ''
run: |
./tests/test_phpcs.sh ${{ steps.changed-php-files.outputs.all_changed_files }}
- name: Test eslint
run: ./tests/test_eslint.sh
- name: Get changed CSS & JS files
id: changed-css-js-files
uses: tj-actions/changed-files@v35
with:
files: |
**/*.css
**/*.js
- name: Test minification
if: steps.changed-css-js-files.outputs.all_changed_and_modified_files != ''
run : |
find dt-assets/ -iname "*.min.js" -or -iname "*.map" -or -iname "*.min.css" -delete && rm -rf build/
gulp
git diff --exit-code -- . ':(exclude)package-lock.json'
- name: PHPunitSetup
run: ./tests/install-wp-tests.sh wordpress_test root rootpassword 127.0.0.0 latest
shell: bash
- name: PHPunit
run: |
composer require "phpunit/phpunit=8.*"
composer require "yoast/phpunit-polyfills"
vendor/phpunit/phpunit/phpunit --version
WP_MULTISITE=1 vendor/phpunit/phpunit/phpunit