Skip to content

Commit 0804d05

Browse files
authored
Add github actions for PHPCS and tests
2 parents 8fff4ed + 990deb9 commit 0804d05

File tree

3 files changed

+98
-47
lines changed

3 files changed

+98
-47
lines changed

.github/phpcs.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: PHP CodeSniffer lint
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
- develop
8+
jobs:
9+
run:
10+
runs-on: ${{ matrix.operating-system }}
11+
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
operating-system: [ubuntu-latest]
16+
php-versions: ['7.4']
17+
18+
name: Lint with PHPCS. PHP ${{ matrix.php-versions }} on ${{ matrix.operating-system }}.
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v3
22+
23+
- name: Setup PHP
24+
uses: shivammathur/setup-php@v2
25+
with:
26+
php-version: ${{ matrix.php-versions }}
27+
coverage: none # XDebug can be enabled here 'coverage: xdebug'
28+
tools: composer:v2
29+
30+
- name: Install dependencies
31+
run: composer install --prefer-dist --no-interaction --no-scripts
32+
33+
- name: Lint with phpcs
34+
run: composer phpcs
35+

.github/tests.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Unit/Integration tests PHP
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
- develop
8+
jobs:
9+
run:
10+
runs-on: ${{ matrix.operating-system }}
11+
12+
strategy:
13+
fail-fast: true
14+
matrix:
15+
operating-system: [ubuntu-latest]
16+
php-versions: ['7.3', '7.4', '8.0', '8.1', '8.2']
17+
wp-versions: ['latest']
18+
19+
name: WP ${{ matrix.wp-versions }} with PHP ${{ matrix.php-versions }} on ${{ matrix.operating-system }}.
20+
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v2
25+
26+
- name: Setup PHP
27+
uses: shivammathur/setup-php@v2
28+
with:
29+
php-version: ${{ matrix.php-versions }}
30+
coverage: none # XDebug can be enabled here 'coverage: xdebug'
31+
tools: composer:v2, phpunit
32+
33+
- name: Start mysql service
34+
run: sudo /etc/init.d/mysql start
35+
36+
- name: Setup problem matchers for PHP
37+
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
38+
39+
- name: Setup problem matchers for PHPUnit
40+
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
41+
42+
- name: Get composer cache directory
43+
id: composercache
44+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
45+
46+
- name: Cache dependencies
47+
uses: actions/cache@v2
48+
with:
49+
path: ${{ steps.composercache.outputs.dir }}
50+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
51+
restore-keys: ${{ runner.os }}-composer-
52+
53+
- name: Install dependencies
54+
run: composer install --prefer-dist --no-interaction --no-scripts
55+
56+
- name: Install tests
57+
run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1:3306 ${{ matrix.wp-versions }}
58+
59+
- name: Mysql8 auth plugin workaround
60+
run: sudo mysql -u root -proot -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';"
61+
62+
- name: Test
63+
run: composer run-tests

.travis.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)