-
Notifications
You must be signed in to change notification settings - Fork 12
84 lines (68 loc) · 1.83 KB
/
phpunit.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
name: Unit Tests
on:
pull_request:
paths:
- '**.php'
- '*.json'
- '*.xml.dist'
push:
paths:
- '**.php'
- '*.json'
- '*.xml.dist'
branches:
- master
jobs:
phpcs:
name: PHP CodeSniffer
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: none
tools: composer, cs2pr
- name: Install Composer dependencies
run: |
composer install --prefer-dist --no-suggest --no-progress --no-ansi --no-interaction
- name: Run PHPCS
run: |
vendor/bin/phpcs -q --report=checkstyle src | cs2pr
unit-php:
name: PHP Unit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
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: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- name: Npm install and build
run: |
npm ci
npm run build
- name: composer install
run: |
composer install
- name: Install WordPress
run: |
chmod -R 767 ./ # TODO: Possibly integrate in wp-env
npm run wp-env start
- name: Run unit tests
run: npm run test:unit-php
if: ${{ success() || failure() }}