-
Notifications
You must be signed in to change notification settings - Fork 17
95 lines (80 loc) · 3.12 KB
/
php.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
name: PHP Lint & Test
on:
# allow to manually run this workflow from the UI
workflow_dispatch:
push:
paths:
- '**.php'
branches:
- main
pull_request:
paths:
- '**.php'
branches:
- main
env:
DB_HOST: 127.0.0.1
DB_TABLE_PREFIX: wp_
DB_NAME: wp.codeception.test
DB_USER: user
DB_PASSWORD: passw0rd
WP_URL: https://jetformbuilder.test
WP_ADMIN_PATH: /wp-admin
WP_DOMAIN: jetformbuilder.test
WP_ADMIN_USERNAME: admin
WP_ADMIN_PASSWORD: password
WP_ADMIN_EMAIL: [email protected]
jobs:
linter:
name: PHP CodeSniffer Linter
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
- name: Install Composer dependencies
run: composer install
- name: Run PHP CodeSniffer
run: composer cs
codeception-tests:
name: PHP Codeception tests
timeout-minutes: 15
runs-on: ubuntu-latest
services:
mysql:
image: mysql:5.7
env:
MYSQL_USER: ${{ env.DB_USER }}
MYSQL_PASSWORD: ${{ env.DB_PASSWORD }}
MYSQL_DATABASE: ${{ env.DB_NAME }}
MYSQL_ALLOW_EMPTY_PASSWORD: yes
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
- name: Install Composer dependencies
run: composer install
- name: "Set up WordPress"
run: |
mkdir -p /tmp/WP
./vendor/bin/wp core download --path="/tmp/WP"
./vendor/bin/wp config create --path="/tmp/WP" --dbname="${{ env.DB_NAME }}" --dbuser="${{ env.DB_USER }}" --dbpass="${{ env.DB_PASSWORD }}" --dbhost="${{ env.DB_HOST }}" --dbprefix="${{ env.DB_TABLE_PREFIX }}"
./vendor/bin/wp core install --path="/tmp/WP" --url="${{ env.WP_URL }}" --title="Test" --admin_user="${{ env.WP_ADMIN_USERNAME }}" --admin_password="${{ env.WP_ADMIN_PASSWORD }}" --admin_email="${{ env.WP_ADMIN_EMAIL }}" --skip-email
./vendor/bin/wp rewrite structure '/%postname%/' --path="/tmp/WP" --hard
# Needs changes to be used outside the boilerplate
ln -s ${GITHUB_WORKSPACE} /tmp/WP/wp-content/plugins/
- name: "Set Codeception parameters"
run: |
rm tests/_envs/.env
mv tests/_envs/.env.testing tests/_envs/.env
- name: Run PHP tests
run: composer test:wpunit