diff --git a/README.md b/README.md index 60690664..e7492a64 100644 --- a/README.md +++ b/README.md @@ -199,7 +199,7 @@ The following files are always generated: The following files are also included unless the `--skip-tests` is used: * `phpunit.xml.dist` is the configuration file for PHPUnit. -* `.travis.yml` is the configuration file for Travis CI. Use `--ci=` to select a different service. +* `.circleci/config.yml` is the configuration file for CircleCI. Use `--ci=` to select a different service. * `bin/install-wp-tests.sh` configures the WordPress test suite and a test database. * `tests/bootstrap.php` is the file that makes the current plugin active when running the test suite. * `tests/test-sample.php` is a sample file containing test cases. @@ -234,9 +234,8 @@ The following files are also included unless the `--skip-tests` is used: [--ci=] Choose a configuration file for a continuous integration provider. --- - default: travis + default: circle options: - - travis - circle - gitlab --- @@ -269,7 +268,7 @@ wp scaffold plugin-tests [] [--dir=] [--ci=] [--force The following files are generated by default: * `phpunit.xml.dist` is the configuration file for PHPUnit. -* `.travis.yml` is the configuration file for Travis CI. Use `--ci=` to select a different service. +* `.circleci/config.yml` is the configuration file for CircleCI. Use `--ci=` to select a different service. * `bin/install-wp-tests.sh` configures the WordPress test suite and a test database. * `tests/bootstrap.php` is the file that makes the current plugin active when running the test suite. * `tests/test-sample.php` is a sample file containing the actual tests. @@ -293,9 +292,8 @@ variable. [--ci=] Choose a configuration file for a continuous integration provider. --- - default: travis + default: circle options: - - travis - circle - gitlab - bitbucket @@ -408,7 +406,7 @@ wp scaffold theme-tests [] [--dir=] [--ci=] [--force] The following files are generated by default: * `phpunit.xml.dist` is the configuration file for PHPUnit. -* `.travis.yml` is the configuration file for Travis CI. Use `--ci=` to select a different service. +* `.circleci/config.yml` is the configuration file for CircleCI. Use `--ci=` to select a different service. * `bin/install-wp-tests.sh` configures the WordPress test suite and a test database. * `tests/bootstrap.php` is the file that makes the current theme active when running the test suite. * `tests/test-sample.php` is a sample file containing the actual tests. @@ -432,9 +430,8 @@ variable. [--ci=] Choose a configuration file for a continuous integration provider. --- - default: travis + default: circle options: - - travis - circle - gitlab - bitbucket diff --git a/features/scaffold-plugin-tests.feature b/features/scaffold-plugin-tests.feature index 5a800922..da516dfa 100644 --- a/features/scaffold-plugin-tests.feature +++ b/features/scaffold-plugin-tests.feature @@ -41,44 +41,29 @@ Feature: Scaffold plugin unit tests """ And the {PLUGIN_DIR}/hello-world/.phpcs.xml.dist file should exist And the {PLUGIN_DIR}/hello-world/circle.yml file should not exist - And the {PLUGIN_DIR}/hello-world/.circleci directory should not exist And the {PLUGIN_DIR}/hello-world/bitbucket-pipelines.yml file should not exist And the {PLUGIN_DIR}/hello-world/.gitlab-ci.yml file should not exist - And the {PLUGIN_DIR}/hello-world/.travis.yml file should contain: - """ - script: - - | - if [[ ! -z "$WP_VERSION" ]] ; then - phpunit - WP_MULTISITE=1 phpunit - fi - - | - if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then - phpcs - fi - """ - And the {PLUGIN_DIR}/hello-world/.travis.yml file should contain: - """ - matrix: - include: - - php: 7.4 - env: WP_VERSION=latest - - php: 7.3 - env: WP_VERSION=latest - - php: 7.2 - env: WP_VERSION=latest - - php: 7.1 - env: WP_VERSION=latest - - php: 7.0 - env: WP_VERSION=latest - - php: 5.6 - env: WP_VERSION=4.5 - - php: 5.6 - env: WP_VERSION=latest - - php: 5.6 - env: WP_VERSION=trunk - - php: 5.6 - env: WP_TRAVISCI=phpcs + And the {PLUGIN_DIR}/hello-world/.circleci/config.yml file should contain: + """ + jobs: + php56-build: + <<: *php_job + docker: + - image: circleci/php:5.6 + - image: *mysql_image + """ + And the {PLUGIN_DIR}/hello-world/.circleci/config.yml file should contain: + """ + workflows: + version: 2 + main: + jobs: + - php56-build + - php70-build + - php71-build + - php72-build + - php73-build + - php74-build """ When I run `wp eval "if ( is_executable( '{PLUGIN_DIR}/hello-world/bin/install-wp-tests.sh' ) ) { echo 'executable'; } else { exit( 1 ); }"` @@ -93,7 +78,6 @@ Feature: Scaffold plugin unit tests When I run `wp plugin path hello-world --dir` Then save STDOUT as {PLUGIN_DIR} - And the {PLUGIN_DIR}/.travis.yml file should not exist And the {PLUGIN_DIR}/circle.yml file should not exist And the {PLUGIN_DIR}/.circleci/config.yml file should contain: """ @@ -133,7 +117,6 @@ Feature: Scaffold plugin unit tests When I run `wp scaffold plugin-tests hello-world --ci=circle` Then STDOUT should not be empty - And the {PLUGIN_DIR}/.travis.yml file should not exist And the {PLUGIN_DIR}/circle.yml file should not exist And the {PLUGIN_DIR}/.circleci/config.yml file should contain: """ @@ -167,7 +150,6 @@ Feature: Scaffold plugin unit tests When I run `wp scaffold plugin-tests hello-world --ci=gitlab` Then STDOUT should not be empty - And the {PLUGIN_DIR}/.travis.yml file should not exist And the {PLUGIN_DIR}/.gitlab-ci.yml file should contain: """ MYSQL_DATABASE @@ -182,7 +164,6 @@ Feature: Scaffold plugin unit tests When I run `wp scaffold plugin-tests hello-world --ci=bitbucket` Then STDOUT should not be empty - And the {PLUGIN_DIR}/.travis.yml file should not exist And the {PLUGIN_DIR}/bitbucket-pipelines.yml file should contain: """ pipelines: diff --git a/features/scaffold-theme-tests.feature b/features/scaffold-theme-tests.feature index f9edd93a..f03e4bfc 100644 --- a/features/scaffold-theme-tests.feature +++ b/features/scaffold-theme-tests.feature @@ -38,43 +38,29 @@ Feature: Scaffold theme unit tests ./tests/test-sample.php """ And the {THEME_DIR}/p2child/.phpcs.xml.dist file should exist - And the {THEME_DIR}/p2child/circle.yml file should not exist - And the {THEME_DIR}/p2child/.circleci directory should not exist And the {THEME_DIR}/p2child/bitbucket-pipelines.yml file should not exist And the {THEME_DIR}/p2child/.gitlab-ci.yml file should not exist - And the {THEME_DIR}/p2child/.travis.yml file should contain: - """ - script: - - | - if [[ ! -z "$WP_VERSION" ]] ; then - phpunit - WP_MULTISITE=1 phpunit - fi - - | - if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then - phpcs - fi - """ - And the {THEME_DIR}/p2child/.travis.yml file should contain: - """ - matrix: - include: - - php: 7.4 - env: WP_VERSION=latest - - php: 7.3 - env: WP_VERSION=latest - - php: 7.2 - env: WP_VERSION=latest - - php: 7.1 - env: WP_VERSION=latest - - php: 7.0 - env: WP_VERSION=latest - - php: 5.6 - env: WP_VERSION=latest - - php: 5.6 - env: WP_VERSION=trunk - - php: 5.6 - env: WP_TRAVISCI=phpcs + And the {THEME_DIR}/p2child/.circleci/config.yml file should contain: + """ + jobs: + php56-build: + <<: *php_job + docker: + - image: circleci/php:5.6 + - image: *mysql_image + """ + And the {THEME_DIR}/p2child/.circleci/config.yml file should contain: + """ + workflows: + version: 2 + main: + jobs: + - php56-build + - php70-build + - php71-build + - php72-build + - php73-build + - php74-build """ When I run `wp eval "if ( is_executable( '{THEME_DIR}/p2child/bin/install-wp-tests.sh' ) ) { echo 'executable'; } else { exit( 1 ); }"` @@ -133,7 +119,6 @@ Feature: Scaffold theme unit tests Scenario: Scaffold theme tests with Circle as the provider When I run `wp scaffold theme-tests p2child --ci=circle` Then STDOUT should not be empty - And the {THEME_DIR}/p2child/.travis.yml file should not exist And the {THEME_DIR}/p2child/circle.yml file should not exist And the {THEME_DIR}/p2child/.circleci/config.yml file should contain: """ @@ -167,7 +152,6 @@ Feature: Scaffold theme unit tests Scenario: Scaffold theme tests with Gitlab as the provider When I run `wp scaffold theme-tests p2child --ci=gitlab` Then STDOUT should not be empty - And the {THEME_DIR}/p2child/.travis.yml file should not exist And the {THEME_DIR}/p2child/.gitlab-ci.yml file should contain: """ MYSQL_DATABASE @@ -176,7 +160,6 @@ Feature: Scaffold theme unit tests Scenario: Scaffold theme tests with Bitbucket Pipelines as the provider When I run `wp scaffold theme-tests p2child --ci=bitbucket` Then STDOUT should not be empty - And the {THEME_DIR}/p2child/.travis.yml file should not exist And the {THEME_DIR}/p2child/bitbucket-pipelines.yml file should contain: """ pipelines: diff --git a/features/scaffold.feature b/features/scaffold.feature index 8d4aa584..f75b370b 100644 --- a/features/scaffold.feature +++ b/features/scaffold.feature @@ -276,7 +276,7 @@ Feature: WordPress code scaffolding https://wp-cli.org https://wp-cli.org n - travis + circle Y n n @@ -473,29 +473,19 @@ Feature: WordPress code scaffolding When I run `wp scaffold plugin hello-world` Then STDOUT should not be empty And the {PLUGIN_DIR}/hello-world/readme.txt file should exist - And the {PLUGIN_DIR}/hello-world/.travis.yml file should exist - And the {PLUGIN_DIR}/hello-world/.travis.yml file should contain: - """ - matrix: - include: - - php: 7.4 - env: WP_VERSION=latest - - php: 7.3 - env: WP_VERSION=latest - - php: 7.2 - env: WP_VERSION=latest - - php: 7.1 - env: WP_VERSION=latest - - php: 7.0 - env: WP_VERSION=latest - - php: 5.6 - env: WP_VERSION=4.5 - - php: 5.6 - env: WP_VERSION=latest - - php: 5.6 - env: WP_VERSION=trunk - - php: 5.6 - env: WP_TRAVISCI=phpcs + And the {PLUGIN_DIR}/hello-world/.circleci/config.yml file should exist + And the {PLUGIN_DIR}/hello-world/.circleci/config.yml file should contain: + """ + workflows: + version: 2 + main: + jobs: + - php56-build + - php70-build + - php71-build + - php72-build + - php73-build + - php74-build """ @require-php-5.6 @require-wp-4.6 diff --git a/src/Scaffold_Command.php b/src/Scaffold_Command.php index d32e3c76..f5bcbcef 100644 --- a/src/Scaffold_Command.php +++ b/src/Scaffold_Command.php @@ -403,17 +403,6 @@ public function underscores( $args, $assoc_args ) { $response = wp_remote_post( $url, $post_args ); - // Workaround to get scaffolding to work within Travis CI. - // See https://github.com/wp-cli/scaffold-command/issues/181 - if ( is_wp_error( $response ) - && false !== strpos( $response->get_error_message(), 'gnutls_handshake() failed' ) - ) { - // Certificate problem, falling back to unsecured request instead. - $alt_url = str_replace( 'https://', 'http://', $url ); - WP_CLI::warning( "Secured request to {$url} failed, using {$alt_url} as a fallback." ); - $response = wp_remote_post( $alt_url, $post_args ); - } - if ( is_wp_error( $response ) ) { WP_CLI::error( $response ); } @@ -580,7 +569,7 @@ private function get_output_path( $assoc_args, $subdir ) { * The following files are also included unless the `--skip-tests` is used: * * * `phpunit.xml.dist` is the configuration file for PHPUnit. - * * `.travis.yml` is the configuration file for Travis CI. Use `--ci=` to select a different service. + * * `.circleci/config.yml` is the configuration file for CircleCI. Use `--ci=` to select a different service. * * `bin/install-wp-tests.sh` configures the WordPress test suite and a test database. * * `tests/bootstrap.php` is the file that makes the current plugin active when running the test suite. * * `tests/test-sample.php` is a sample file containing test cases. @@ -615,9 +604,8 @@ private function get_output_path( $assoc_args, $subdir ) { * [--ci=] * : Choose a configuration file for a continuous integration provider. * --- - * default: travis + * default: circle * options: - * - travis * - circle * - gitlab * --- @@ -716,7 +704,7 @@ public function plugin( $args, $assoc_args ) { * The following files are generated by default: * * * `phpunit.xml.dist` is the configuration file for PHPUnit. - * * `.travis.yml` is the configuration file for Travis CI. Use `--ci=` to select a different service. + * * `.circleci/config.yml` is the configuration file for CircleCI. Use `--ci=` to select a different service. * * `bin/install-wp-tests.sh` configures the WordPress test suite and a test database. * * `tests/bootstrap.php` is the file that makes the current plugin active when running the test suite. * * `tests/test-sample.php` is a sample file containing the actual tests. @@ -740,9 +728,8 @@ public function plugin( $args, $assoc_args ) { * [--ci=] * : Choose a configuration file for a continuous integration provider. * --- - * default: travis + * default: circle * options: - * - travis * - circle * - gitlab * - bitbucket @@ -769,7 +756,7 @@ public function plugin_tests( $args, $assoc_args ) { * The following files are generated by default: * * * `phpunit.xml.dist` is the configuration file for PHPUnit. - * * `.travis.yml` is the configuration file for Travis CI. Use `--ci=` to select a different service. + * * `.circleci/config.yml` is the configuration file for CircleCI. Use `--ci=` to select a different service. * * `bin/install-wp-tests.sh` configures the WordPress test suite and a test database. * * `tests/bootstrap.php` is the file that makes the current theme active when running the test suite. * * `tests/test-sample.php` is a sample file containing the actual tests. @@ -793,9 +780,8 @@ public function plugin_tests( $args, $assoc_args ) { * [--ci=] * : Choose a configuration file for a continuous integration provider. * --- - * default: travis + * default: circle * options: - * - travis * - circle * - gitlab * - bitbucket @@ -890,9 +876,7 @@ private function scaffold_plugin_theme_tests( $args, $assoc_args, $type ) { "{$tests_dir}/bootstrap.php" => self::mustache_render( "{$type}-bootstrap.mustache", $template_data ), "{$tests_dir}/test-sample.php" => self::mustache_render( "{$type}-test-sample.mustache", $template_data ), ]; - if ( 'travis' === $assoc_args['ci'] ) { - $files_to_create[ "{$target_dir}/.travis.yml" ] = self::mustache_render( 'plugin-travis.mustache', compact( 'wp_versions_to_test' ) ); - } elseif ( 'circle' === $assoc_args['ci'] ) { + if ( 'circle' === $assoc_args['ci'] ) { $files_to_create[ "{$target_dir}/.circleci/config.yml" ] = self::mustache_render( 'plugin-circle.mustache', compact( 'wp_versions_to_test' ) ); } elseif ( 'gitlab' === $assoc_args['ci'] ) { $files_to_create[ "{$target_dir}/.gitlab-ci.yml" ] = self::mustache_render( 'plugin-gitlab.mustache' ); diff --git a/templates/plugin-travis.mustache b/templates/plugin-travis.mustache deleted file mode 100644 index e32c8a58..00000000 --- a/templates/plugin-travis.mustache +++ /dev/null @@ -1,69 +0,0 @@ -sudo: false -dist: trusty - -language: php - -notifications: - email: - on_success: never - on_failure: change - -branches: - only: - - master - -cache: - directories: - - $HOME/.composer/cache - -matrix: - include: - - php: 7.4 - env: WP_VERSION=latest - - php: 7.3 - env: WP_VERSION=latest - - php: 7.2 - env: WP_VERSION=latest - - php: 7.1 - env: WP_VERSION=latest - - php: 7.0 - env: WP_VERSION=latest - {{#wp_versions_to_test}} - - php: 5.6 - env: WP_VERSION={{.}} - {{/wp_versions_to_test}} - - php: 5.6 - env: WP_TRAVISCI=phpcs - -before_script: - - export PATH="$HOME/.composer/vendor/bin:$PATH" - - | - if [ -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ]; then - phpenv config-rm xdebug.ini - else - echo "xdebug.ini does not exist" - fi - - | - if [[ ! -z "$WP_VERSION" ]] ; then - bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION - composer global require "phpunit/phpunit=4.8.*|5.7.*" - fi - - | - if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then - composer global require wp-coding-standards/wpcs - composer global require phpcompatibility/php-compatibility - composer global require phpcompatibility/phpcompatibility-paragonie - composer global require phpcompatibility/phpcompatibility-wp - phpcs --config-set installed_paths $HOME/.composer/vendor/wp-coding-standards/wpcs,$HOME/.composer/vendor/phpcompatibility/php-compatibility,$HOME/.composer/vendor/phpcompatibility/phpcompatibility-paragonie,$HOME/.composer/vendor/phpcompatibility/phpcompatibility-wp - fi - -script: - - | - if [[ ! -z "$WP_VERSION" ]] ; then - phpunit - WP_MULTISITE=1 phpunit - fi - - | - if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then - phpcs - fi