Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
164 changes: 164 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
version: 2

references:
load_composer_cache: &load_composer_cache
restore_cache:
keys:
- composer-cache-{{ checksum "composer.json" }}
- composer-cache-

composer_install: &composer_install
run:
name: Install composer packages.
command: composer install --no-suggest --ignore-platform-reqs

save_composer_cache: &save_composer_cache
save_cache:
key: composer-cache-{{ checksum "composer.json" }}
paths:
- ./vendor

install_composer: &install_composer
run:
name: Installing composer...
command: |
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
EXPECTED_SIGNATURE=$(curl -s https://composer.github.io/installer.sig)
ACTUAL_SIGNATURE=$(php -r "echo hash_file('sha384', 'composer-setup.php');")
[[ "$EXPECTED_SIGNATURE" == "$ACTUAL_SIGNATURE" ]] && php composer-setup.php --install-dir=/bin --filename=composer || exit 1
composer config -g github-protocols https && composer config -g repo.packagist composer https://packagist.org
rm composer-setup.php

install_dockerize: &install_dockerize
run:
name: Install Dockerize
command: |
wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
environment:
DOCKERIZE_VERSION: v0.6.1

wait_for_mysql: &wait_for_mysql
run:
name: Wait for MySQL
command: dockerize -wait tcp://localhost:3306 -timeout 1m

job_phpunit_base: &job_phpunit_base
docker:
- image: wordpress:php$CONTAINER_PHP_VERSION-fpm-alpine
- image: mysql:5.7
environment:
MYSQL_DATABASE: phpcompat_test
MYSQL_USER: phpcompat_user
MYSQL_PASSWORD: phpcompat_pass
MYSQL_ROOT_PASSWORD: wordpress
working_directory: /root/project/phpcompat
steps:
- run: apk add --no-cache git subversion
- *install_dockerize
- *install_composer
- checkout
- run:
name: PHP Lint Error Check
command: /bin/bash php-lint.sh
- *load_composer_cache
- *composer_install
- *save_composer_cache
- *wait_for_mysql
- run:
name: WordPress Test Suite Installation
command: /bin/bash tests/install-wp-tests.sh phpcompat_test phpcompat_user phpcompat_pass 127.0.0.1 $CONTAINER_WP_VERSION true
- run:
name: Run WordPress PHPUnit Tests
command: composer test

jobs:
job_test_javascript:
docker:
- image: circleci/node:12
steps:
- checkout
- run: npm install
- run:
name: Run NPM Tests
command: npm test
job_php_code_standards:
docker:
- image: wordpress:php7.3-fpm-alpine
working_directory: /root/project/phpcompat
steps:
- run: apk add --no-cache git subversion
- *install_composer
- checkout
- *load_composer_cache
- *composer_install
- *save_composer_cache
- run:
name: Run PHP Code Sniffer Check
command: composer phpcs
job_test_php56_min:
<<: *job_phpunit_base
environment:
CONTAINER_WP_VERSION: "5.1"
CONTAINER_PHP_VERSION: "5.6"
job_test_php56:
<<: *job_phpunit_base
environment:
CONTAINER_WP_VERSION: "latest"
CONTAINER_PHP_VERSION: "5.6"
job_test_php70:
<<: *job_phpunit_base
environment:
CONTAINER_WP_VERSION: "latest"
CONTAINER_PHP_VERSION: "7.0"
job_test_php71:
<<: *job_phpunit_base
environment:
CONTAINER_WP_VERSION: "latest"
CONTAINER_PHP_VERSION: "7.1"
job_test_php72:
<<: *job_phpunit_base
environment:
CONTAINER_WP_VERSION: "latest"
CONTAINER_PHP_VERSION: "7.2"
job_test_php73_min:
<<: *job_phpunit_base
environment:
CONTAINER_WP_VERSION: "5.2"
CONTAINER_PHP_VERSION: "7.3"
job_test_php73:
<<: *job_phpunit_base
environment:
CONTAINER_WP_VERSION: "latest"
CONTAINER_PHP_VERSION: "7.3"

workflows:
version: 2
test:
jobs:
- job_test_javascript
- job_php_code_standards:
requires:
- job_test_javascript
- job_test_php56_min:
requires:
- job_php_code_standards
- job_test_php56:
requires:
- job_php_code_standards
- job_test_php70:
requires:
- job_php_code_standards
- job_test_php71:
requires:
- job_php_code_standards
- job_test_php72:
requires:
- job_php_code_standards
- job_test_php73_min:
requires:
- job_php_code_standards
- job_test_php73:
requires:
- job_php_code_standards
99 changes: 0 additions & 99 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module.exports = function(grunt) {

// Add build status image to GitHub readme.
function addBuildStatus(readme) {
var buildImage = '<a href="https://travis-ci.org/wpengine/phpcompat"><img src="https://travis-ci.org/wpengine/phpcompat.svg?branch=master"></a>';
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>';

return readme.replace(/# PHP Compatibility Checker #/, '# PHP Compatibility Checker ' + buildImage);
}
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"phpcompatibility/phpcompatibility-wp": "^2"
},
"require-dev": {
"wp-coding-standards/wpcs": "^1"
"wp-coding-standards/wpcs": "^1",
"phpunit/phpunit": "^5"
},
"scripts": {
"post-update-cmd": [
Expand All @@ -22,6 +23,7 @@
"cd php52; composer install; cd .."
],
"phpcs": "phpcs --standard=src/ruleset-wordpress.xml wpengine-phpcompat.php load-files.php src/*.php",
"phpcs:fix": "phpcbf --standard=src/ruleset-wordpress.xml wpengine-phpcompat.php load-files.php src/*.php"
"phpcs:fix": "phpcbf --standard=src/ruleset-wordpress.xml wpengine-phpcompat.php load-files.php src/*.php",
"test": "phpunit"
}
}
Loading