Repository navigation
63 lines (58 loc) · 2.26 KB
/
Copy pathcodeception.yml
File metadata and controls
63 lines (58 loc) · 2.26 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
name: CodeCeption
on:
# Trigger the workflow on push or pull request,
# but only for the main branch
pull_request:
types: [ opened, labeled, synchronize ]
jobs:
build-test:
if: contains(github.event.pull_request.labels.*.name, 'run analysis')
runs-on: ubuntu-latest
strategy:
matrix:
include:
- php: 7.4
wordpress: 5.8
- php: 7.4
wordpress: master
name: PHP ${{ matrix.php }} tests in WP ${{ matrix.wordpress }}
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: wordpress_tests
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping -proot" --health-interval=10s --health-timeout=5s --health-retries=5
steps:
- uses: actions/checkout@v3.5.0
# get the PHP version
- uses: shivammathur/setup-php@2.24.0
with:
php-version: ${{ matrix.php }}
tools: phpunit-polyfills
- run: composer install --no-progress --ansi
- name: Installing WordPress
run: |
export WP_DEVELOP_DIR=/tmp/wordpress/
git clone --depth=50 --branch="${{ matrix.wordpress }}" git://develop.git.wordpress.org/ /tmp/wordpress
cd ..
cp -r "${GITHUB_REPOSITORY#*/}" "/tmp/wordpress/src/wp-content/plugins/${GITHUB_REPOSITORY#*/}"
cd /tmp/wordpress/
pwd
cp wp-tests-config-sample.php wp-tests-config.php
sed -i "s/youremptytestdbnamehere/wordpress_tests/" wp-tests-config.php
sed -i "s/yourusernamehere/root/" wp-tests-config.php
sed -i "s/yourpasswordhere/root/" wp-tests-config.php
sed -i "s/'localhost'/'127.0.0.1'/" wp-tests-config.php
sed -i 's/dbHost: "localhost"/dbHost: "127.0.0.1"/' "src/wp-content/plugins/${GITHUB_REPOSITORY#*/}/tests/wpunit.suite.yml"
- name: Check Syntax
run: find -L . -path ./vendor -prune -o -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l
- name: Run chromedriver
run: nohup $CHROMEWEBDRIVER/chromedriver --url-base=/wd/hub /dev/null 2>&1 &
- name: Codeception tests
run: |
cd "/tmp/wordpress/src/wp-content/plugins/${GITHUB_REPOSITORY#*/}"
pwd
composer phpunit