Skip to content

Commit b266ae5

Browse files
authored
Merge pull request #263 from wpengine/ryanmeier/circle-ci-integration
[PI-3477] Add CircleCI integration for CI
2 parents 221a794 + 543caf8 commit b266ae5

File tree

7 files changed

+1590
-118
lines changed

7 files changed

+1590
-118
lines changed

.circleci/config.yml

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
version: 2
2+
3+
references:
4+
load_composer_cache: &load_composer_cache
5+
restore_cache:
6+
keys:
7+
- composer-cache-{{ checksum "composer.json" }}
8+
- composer-cache-
9+
10+
composer_install: &composer_install
11+
run:
12+
name: Install composer packages.
13+
command: composer install --no-suggest --ignore-platform-reqs
14+
15+
save_composer_cache: &save_composer_cache
16+
save_cache:
17+
key: composer-cache-{{ checksum "composer.json" }}
18+
paths:
19+
- ./vendor
20+
21+
install_composer: &install_composer
22+
run:
23+
name: Installing composer...
24+
command: |
25+
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
26+
EXPECTED_SIGNATURE=$(curl -s https://composer.github.io/installer.sig)
27+
ACTUAL_SIGNATURE=$(php -r "echo hash_file('sha384', 'composer-setup.php');")
28+
[[ "$EXPECTED_SIGNATURE" == "$ACTUAL_SIGNATURE" ]] && php composer-setup.php --install-dir=/bin --filename=composer || exit 1
29+
composer config -g github-protocols https && composer config -g repo.packagist composer https://packagist.org
30+
rm composer-setup.php
31+
32+
install_dockerize: &install_dockerize
33+
run:
34+
name: Install Dockerize
35+
command: |
36+
wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
37+
tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
38+
rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
39+
environment:
40+
DOCKERIZE_VERSION: v0.6.1
41+
42+
wait_for_mysql: &wait_for_mysql
43+
run:
44+
name: Wait for MySQL
45+
command: dockerize -wait tcp://localhost:3306 -timeout 1m
46+
47+
job_phpunit_base: &job_phpunit_base
48+
docker:
49+
- image: wordpress:php$CONTAINER_PHP_VERSION-fpm-alpine
50+
- image: mysql:5.7
51+
environment:
52+
MYSQL_DATABASE: phpcompat_test
53+
MYSQL_USER: phpcompat_user
54+
MYSQL_PASSWORD: phpcompat_pass
55+
MYSQL_ROOT_PASSWORD: wordpress
56+
working_directory: /root/project/phpcompat
57+
steps:
58+
- run: apk add --no-cache git subversion
59+
- *install_dockerize
60+
- *install_composer
61+
- checkout
62+
- run:
63+
name: PHP Lint Error Check
64+
command: /bin/bash php-lint.sh
65+
- *load_composer_cache
66+
- *composer_install
67+
- *save_composer_cache
68+
- *wait_for_mysql
69+
- run:
70+
name: WordPress Test Suite Installation
71+
command: /bin/bash tests/install-wp-tests.sh phpcompat_test phpcompat_user phpcompat_pass 127.0.0.1 $CONTAINER_WP_VERSION true
72+
- run:
73+
name: Run WordPress PHPUnit Tests
74+
command: composer test
75+
76+
jobs:
77+
job_test_javascript:
78+
docker:
79+
- image: circleci/node:12
80+
steps:
81+
- checkout
82+
- run: npm install
83+
- run:
84+
name: Run NPM Tests
85+
command: npm test
86+
job_php_code_standards:
87+
docker:
88+
- image: wordpress:php7.3-fpm-alpine
89+
working_directory: /root/project/phpcompat
90+
steps:
91+
- run: apk add --no-cache git subversion
92+
- *install_composer
93+
- checkout
94+
- *load_composer_cache
95+
- *composer_install
96+
- *save_composer_cache
97+
- run:
98+
name: Run PHP Code Sniffer Check
99+
command: composer phpcs
100+
job_test_php56_min:
101+
<<: *job_phpunit_base
102+
environment:
103+
CONTAINER_WP_VERSION: "5.1"
104+
CONTAINER_PHP_VERSION: "5.6"
105+
job_test_php56:
106+
<<: *job_phpunit_base
107+
environment:
108+
CONTAINER_WP_VERSION: "latest"
109+
CONTAINER_PHP_VERSION: "5.6"
110+
job_test_php70:
111+
<<: *job_phpunit_base
112+
environment:
113+
CONTAINER_WP_VERSION: "latest"
114+
CONTAINER_PHP_VERSION: "7.0"
115+
job_test_php71:
116+
<<: *job_phpunit_base
117+
environment:
118+
CONTAINER_WP_VERSION: "latest"
119+
CONTAINER_PHP_VERSION: "7.1"
120+
job_test_php72:
121+
<<: *job_phpunit_base
122+
environment:
123+
CONTAINER_WP_VERSION: "latest"
124+
CONTAINER_PHP_VERSION: "7.2"
125+
job_test_php73_min:
126+
<<: *job_phpunit_base
127+
environment:
128+
CONTAINER_WP_VERSION: "5.2"
129+
CONTAINER_PHP_VERSION: "7.3"
130+
job_test_php73:
131+
<<: *job_phpunit_base
132+
environment:
133+
CONTAINER_WP_VERSION: "latest"
134+
CONTAINER_PHP_VERSION: "7.3"
135+
136+
workflows:
137+
version: 2
138+
test:
139+
jobs:
140+
- job_test_javascript
141+
- job_php_code_standards:
142+
requires:
143+
- job_test_javascript
144+
- job_test_php56_min:
145+
requires:
146+
- job_php_code_standards
147+
- job_test_php56:
148+
requires:
149+
- job_php_code_standards
150+
- job_test_php70:
151+
requires:
152+
- job_php_code_standards
153+
- job_test_php71:
154+
requires:
155+
- job_php_code_standards
156+
- job_test_php72:
157+
requires:
158+
- job_php_code_standards
159+
- job_test_php73_min:
160+
requires:
161+
- job_php_code_standards
162+
- job_test_php73:
163+
requires:
164+
- job_php_code_standards

.travis.yml

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

Gruntfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module.exports = function(grunt) {
2121

2222
// Add build status image to GitHub readme.
2323
function addBuildStatus(readme) {
24-
var buildImage = '<a href="https://travis-ci.org/wpengine/phpcompat"><img src="https://travis-ci.org/wpengine/phpcompat.svg?branch=master"></a>';
24+
var buildImage = '<a href="https://circleci.com/gh/wpengine/phpcompat/tree/master"><img src="https://circleci.com/gh/wpengine/phpcompat/tree/master.svg?style=shield"></a>';
2525

2626
return readme.replace(/# PHP Compatibility Checker #/, '# PHP Compatibility Checker ' + buildImage);
2727
}

composer.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"phpcompatibility/phpcompatibility-wp": "^2"
1313
},
1414
"require-dev": {
15-
"wp-coding-standards/wpcs": "^1"
15+
"wp-coding-standards/wpcs": "^1",
16+
"phpunit/phpunit": "^5"
1617
},
1718
"scripts": {
1819
"post-update-cmd": [
@@ -22,6 +23,7 @@
2223
"cd php52; composer install; cd .."
2324
],
2425
"phpcs": "phpcs --standard=src/ruleset-wordpress.xml wpengine-phpcompat.php load-files.php src/*.php",
25-
"phpcs:fix": "phpcbf --standard=src/ruleset-wordpress.xml wpengine-phpcompat.php load-files.php src/*.php"
26+
"phpcs:fix": "phpcbf --standard=src/ruleset-wordpress.xml wpengine-phpcompat.php load-files.php src/*.php",
27+
"test": "phpunit"
2628
}
2729
}

0 commit comments

Comments
 (0)