-
-
Notifications
You must be signed in to change notification settings - Fork 5
94 lines (81 loc) · 2.7 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
name: Tests and Build
on:
pull_request:
branches:
- master
push:
branches:
- master
jobs:
run:
name: Runs on WordPress ${{ matrix.wp-versions }}
runs-on: ubuntu-latest
services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: false
MYSQL_ROOT_PASSWORD: secret
MYSQL_DATABASE: wordpress
ports:
- 3306
strategy:
matrix:
php-versions: ['7.3']
wp-versions: ['5.0', '5.1', '5.2', '5.3', '5.4', '5.5']
steps:
- name: Checkout
uses: actions/checkout@master
- name: Set up PHP
uses: shivammathur/setup-php@master
with:
php-version: ${{ matrix.php-versions }}
extensions: exif, gd, gettext, imagick, mbstring, xmlrpc
coverage: xdebug
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache composer dependencies
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install composer dependencies
run: composer require roots/wordpress ${{ matrix.wp-versions }} --prefer-dist --no-progress --no-suggest
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: '10.x'
registry-url: 'https://registry.npmjs.org'
- name: Get yarn cache directory
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache yarn dependencies
uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-
- name: Install Dependencies
run: yarn --ignore-engines
- name: Install WordPress Core
env:
WP_ENV: testing
WP_HOME: http://localhost:8080
DB_HOST: 127.0.0.1:${{ job.services.mysql.ports['3306'] }}
run: .github/setup.sh
- name: Unit Test
run: |
vendor/bin/phpcs --standard=packages/phpcs.xml packages
vendor/bin/phpunit -c tests/phpunit.xml --coverage-text
- name: End-to-end Tests
if: matrix.wp-versions == 5.4
env:
BROWSERSTACK_PROJECT: "${{ github.repository }} - ${{ github.workflow }}"
BROWSERSTACK_BUILD: ${{ github.ref }}
BROWSERSTACK_USER: ${{ secrets.BROWSERSTACK_USER }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
run: |
yarn gulp build --mode production
yarn gulp e2e --mode testing