Skip to content

Commit bdac4c3

Browse files
authored
Remove Travis CI from wp scaffold plugin-tests (#325)
1 parent 4125a31 commit bdac4c3

File tree

6 files changed

+69
-203
lines changed

6 files changed

+69
-203
lines changed

README.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ The following files are always generated:
199199
The following files are also included unless the `--skip-tests` is used:
200200

201201
* `phpunit.xml.dist` is the configuration file for PHPUnit.
202-
* `.travis.yml` is the configuration file for Travis CI. Use `--ci=<provider>` to select a different service.
202+
* `.circleci/config.yml` is the configuration file for CircleCI. Use `--ci=<provider>` to select a different service.
203203
* `bin/install-wp-tests.sh` configures the WordPress test suite and a test database.
204204
* `tests/bootstrap.php` is the file that makes the current plugin active when running the test suite.
205205
* `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:
234234
[--ci=<provider>]
235235
Choose a configuration file for a continuous integration provider.
236236
---
237-
default: travis
237+
default: circle
238238
options:
239-
- travis
240239
- circle
241240
- gitlab
242241
---
@@ -269,7 +268,7 @@ wp scaffold plugin-tests [<plugin>] [--dir=<dirname>] [--ci=<provider>] [--force
269268
The following files are generated by default:
270269

271270
* `phpunit.xml.dist` is the configuration file for PHPUnit.
272-
* `.travis.yml` is the configuration file for Travis CI. Use `--ci=<provider>` to select a different service.
271+
* `.circleci/config.yml` is the configuration file for CircleCI. Use `--ci=<provider>` to select a different service.
273272
* `bin/install-wp-tests.sh` configures the WordPress test suite and a test database.
274273
* `tests/bootstrap.php` is the file that makes the current plugin active when running the test suite.
275274
* `tests/test-sample.php` is a sample file containing the actual tests.
@@ -293,9 +292,8 @@ variable.
293292
[--ci=<provider>]
294293
Choose a configuration file for a continuous integration provider.
295294
---
296-
default: travis
295+
default: circle
297296
options:
298-
- travis
299297
- circle
300298
- gitlab
301299
- bitbucket
@@ -408,7 +406,7 @@ wp scaffold theme-tests [<theme>] [--dir=<dirname>] [--ci=<provider>] [--force]
408406
The following files are generated by default:
409407

410408
* `phpunit.xml.dist` is the configuration file for PHPUnit.
411-
* `.travis.yml` is the configuration file for Travis CI. Use `--ci=<provider>` to select a different service.
409+
* `.circleci/config.yml` is the configuration file for CircleCI. Use `--ci=<provider>` to select a different service.
412410
* `bin/install-wp-tests.sh` configures the WordPress test suite and a test database.
413411
* `tests/bootstrap.php` is the file that makes the current theme active when running the test suite.
414412
* `tests/test-sample.php` is a sample file containing the actual tests.
@@ -432,9 +430,8 @@ variable.
432430
[--ci=<provider>]
433431
Choose a configuration file for a continuous integration provider.
434432
---
435-
default: travis
433+
default: circle
436434
options:
437-
- travis
438435
- circle
439436
- gitlab
440437
- bitbucket

features/scaffold-plugin-tests.feature

Lines changed: 21 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -41,44 +41,29 @@ Feature: Scaffold plugin unit tests
4141
"""
4242
And the {PLUGIN_DIR}/hello-world/.phpcs.xml.dist file should exist
4343
And the {PLUGIN_DIR}/hello-world/circle.yml file should not exist
44-
And the {PLUGIN_DIR}/hello-world/.circleci directory should not exist
4544
And the {PLUGIN_DIR}/hello-world/bitbucket-pipelines.yml file should not exist
4645
And the {PLUGIN_DIR}/hello-world/.gitlab-ci.yml file should not exist
47-
And the {PLUGIN_DIR}/hello-world/.travis.yml file should contain:
48-
"""
49-
script:
50-
- |
51-
if [[ ! -z "$WP_VERSION" ]] ; then
52-
phpunit
53-
WP_MULTISITE=1 phpunit
54-
fi
55-
- |
56-
if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then
57-
phpcs
58-
fi
59-
"""
60-
And the {PLUGIN_DIR}/hello-world/.travis.yml file should contain:
61-
"""
62-
matrix:
63-
include:
64-
- php: 7.4
65-
env: WP_VERSION=latest
66-
- php: 7.3
67-
env: WP_VERSION=latest
68-
- php: 7.2
69-
env: WP_VERSION=latest
70-
- php: 7.1
71-
env: WP_VERSION=latest
72-
- php: 7.0
73-
env: WP_VERSION=latest
74-
- php: 5.6
75-
env: WP_VERSION=4.5
76-
- php: 5.6
77-
env: WP_VERSION=latest
78-
- php: 5.6
79-
env: WP_VERSION=trunk
80-
- php: 5.6
81-
env: WP_TRAVISCI=phpcs
46+
And the {PLUGIN_DIR}/hello-world/.circleci/config.yml file should contain:
47+
"""
48+
jobs:
49+
php56-build:
50+
<<: *php_job
51+
docker:
52+
- image: circleci/php:5.6
53+
- image: *mysql_image
54+
"""
55+
And the {PLUGIN_DIR}/hello-world/.circleci/config.yml file should contain:
56+
"""
57+
workflows:
58+
version: 2
59+
main:
60+
jobs:
61+
- php56-build
62+
- php70-build
63+
- php71-build
64+
- php72-build
65+
- php73-build
66+
- php74-build
8267
"""
8368

8469
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
9378

9479
When I run `wp plugin path hello-world --dir`
9580
Then save STDOUT as {PLUGIN_DIR}
96-
And the {PLUGIN_DIR}/.travis.yml file should not exist
9781
And the {PLUGIN_DIR}/circle.yml file should not exist
9882
And the {PLUGIN_DIR}/.circleci/config.yml file should contain:
9983
"""
@@ -133,7 +117,6 @@ Feature: Scaffold plugin unit tests
133117

134118
When I run `wp scaffold plugin-tests hello-world --ci=circle`
135119
Then STDOUT should not be empty
136-
And the {PLUGIN_DIR}/.travis.yml file should not exist
137120
And the {PLUGIN_DIR}/circle.yml file should not exist
138121
And the {PLUGIN_DIR}/.circleci/config.yml file should contain:
139122
"""
@@ -167,7 +150,6 @@ Feature: Scaffold plugin unit tests
167150

168151
When I run `wp scaffold plugin-tests hello-world --ci=gitlab`
169152
Then STDOUT should not be empty
170-
And the {PLUGIN_DIR}/.travis.yml file should not exist
171153
And the {PLUGIN_DIR}/.gitlab-ci.yml file should contain:
172154
"""
173155
MYSQL_DATABASE
@@ -182,7 +164,6 @@ Feature: Scaffold plugin unit tests
182164

183165
When I run `wp scaffold plugin-tests hello-world --ci=bitbucket`
184166
Then STDOUT should not be empty
185-
And the {PLUGIN_DIR}/.travis.yml file should not exist
186167
And the {PLUGIN_DIR}/bitbucket-pipelines.yml file should contain:
187168
"""
188169
pipelines:

features/scaffold-theme-tests.feature

Lines changed: 21 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -38,43 +38,29 @@ Feature: Scaffold theme unit tests
3838
<exclude>./tests/test-sample.php</exclude>
3939
"""
4040
And the {THEME_DIR}/p2child/.phpcs.xml.dist file should exist
41-
And the {THEME_DIR}/p2child/circle.yml file should not exist
42-
And the {THEME_DIR}/p2child/.circleci directory should not exist
4341
And the {THEME_DIR}/p2child/bitbucket-pipelines.yml file should not exist
4442
And the {THEME_DIR}/p2child/.gitlab-ci.yml file should not exist
45-
And the {THEME_DIR}/p2child/.travis.yml file should contain:
46-
"""
47-
script:
48-
- |
49-
if [[ ! -z "$WP_VERSION" ]] ; then
50-
phpunit
51-
WP_MULTISITE=1 phpunit
52-
fi
53-
- |
54-
if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then
55-
phpcs
56-
fi
57-
"""
58-
And the {THEME_DIR}/p2child/.travis.yml file should contain:
59-
"""
60-
matrix:
61-
include:
62-
- php: 7.4
63-
env: WP_VERSION=latest
64-
- php: 7.3
65-
env: WP_VERSION=latest
66-
- php: 7.2
67-
env: WP_VERSION=latest
68-
- php: 7.1
69-
env: WP_VERSION=latest
70-
- php: 7.0
71-
env: WP_VERSION=latest
72-
- php: 5.6
73-
env: WP_VERSION=latest
74-
- php: 5.6
75-
env: WP_VERSION=trunk
76-
- php: 5.6
77-
env: WP_TRAVISCI=phpcs
43+
And the {THEME_DIR}/p2child/.circleci/config.yml file should contain:
44+
"""
45+
jobs:
46+
php56-build:
47+
<<: *php_job
48+
docker:
49+
- image: circleci/php:5.6
50+
- image: *mysql_image
51+
"""
52+
And the {THEME_DIR}/p2child/.circleci/config.yml file should contain:
53+
"""
54+
workflows:
55+
version: 2
56+
main:
57+
jobs:
58+
- php56-build
59+
- php70-build
60+
- php71-build
61+
- php72-build
62+
- php73-build
63+
- php74-build
7864
"""
7965

8066
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
133119
Scenario: Scaffold theme tests with Circle as the provider
134120
When I run `wp scaffold theme-tests p2child --ci=circle`
135121
Then STDOUT should not be empty
136-
And the {THEME_DIR}/p2child/.travis.yml file should not exist
137122
And the {THEME_DIR}/p2child/circle.yml file should not exist
138123
And the {THEME_DIR}/p2child/.circleci/config.yml file should contain:
139124
"""
@@ -167,7 +152,6 @@ Feature: Scaffold theme unit tests
167152
Scenario: Scaffold theme tests with Gitlab as the provider
168153
When I run `wp scaffold theme-tests p2child --ci=gitlab`
169154
Then STDOUT should not be empty
170-
And the {THEME_DIR}/p2child/.travis.yml file should not exist
171155
And the {THEME_DIR}/p2child/.gitlab-ci.yml file should contain:
172156
"""
173157
MYSQL_DATABASE
@@ -176,7 +160,6 @@ Feature: Scaffold theme unit tests
176160
Scenario: Scaffold theme tests with Bitbucket Pipelines as the provider
177161
When I run `wp scaffold theme-tests p2child --ci=bitbucket`
178162
Then STDOUT should not be empty
179-
And the {THEME_DIR}/p2child/.travis.yml file should not exist
180163
And the {THEME_DIR}/p2child/bitbucket-pipelines.yml file should contain:
181164
"""
182165
pipelines:

features/scaffold.feature

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ Feature: WordPress code scaffolding
276276
https://wp-cli.org
277277
https://wp-cli.org
278278
n
279-
travis
279+
circle
280280
Y
281281
n
282282
n
@@ -473,29 +473,19 @@ Feature: WordPress code scaffolding
473473
When I run `wp scaffold plugin hello-world`
474474
Then STDOUT should not be empty
475475
And the {PLUGIN_DIR}/hello-world/readme.txt file should exist
476-
And the {PLUGIN_DIR}/hello-world/.travis.yml file should exist
477-
And the {PLUGIN_DIR}/hello-world/.travis.yml file should contain:
478-
"""
479-
matrix:
480-
include:
481-
- php: 7.4
482-
env: WP_VERSION=latest
483-
- php: 7.3
484-
env: WP_VERSION=latest
485-
- php: 7.2
486-
env: WP_VERSION=latest
487-
- php: 7.1
488-
env: WP_VERSION=latest
489-
- php: 7.0
490-
env: WP_VERSION=latest
491-
- php: 5.6
492-
env: WP_VERSION=4.5
493-
- php: 5.6
494-
env: WP_VERSION=latest
495-
- php: 5.6
496-
env: WP_VERSION=trunk
497-
- php: 5.6
498-
env: WP_TRAVISCI=phpcs
476+
And the {PLUGIN_DIR}/hello-world/.circleci/config.yml file should exist
477+
And the {PLUGIN_DIR}/hello-world/.circleci/config.yml file should contain:
478+
"""
479+
workflows:
480+
version: 2
481+
main:
482+
jobs:
483+
- php56-build
484+
- php70-build
485+
- php71-build
486+
- php72-build
487+
- php73-build
488+
- php74-build
499489
"""
500490
501491
@require-php-5.6 @require-wp-4.6

src/Scaffold_Command.php

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -403,17 +403,6 @@ public function underscores( $args, $assoc_args ) {
403403

404404
$response = wp_remote_post( $url, $post_args );
405405

406-
// Workaround to get scaffolding to work within Travis CI.
407-
// See https://github.com/wp-cli/scaffold-command/issues/181
408-
if ( is_wp_error( $response )
409-
&& false !== strpos( $response->get_error_message(), 'gnutls_handshake() failed' )
410-
) {
411-
// Certificate problem, falling back to unsecured request instead.
412-
$alt_url = str_replace( 'https://', 'http://', $url );
413-
WP_CLI::warning( "Secured request to {$url} failed, using {$alt_url} as a fallback." );
414-
$response = wp_remote_post( $alt_url, $post_args );
415-
}
416-
417406
if ( is_wp_error( $response ) ) {
418407
WP_CLI::error( $response );
419408
}
@@ -580,7 +569,7 @@ private function get_output_path( $assoc_args, $subdir ) {
580569
* The following files are also included unless the `--skip-tests` is used:
581570
*
582571
* * `phpunit.xml.dist` is the configuration file for PHPUnit.
583-
* * `.travis.yml` is the configuration file for Travis CI. Use `--ci=<provider>` to select a different service.
572+
* * `.circleci/config.yml` is the configuration file for CircleCI. Use `--ci=<provider>` to select a different service.
584573
* * `bin/install-wp-tests.sh` configures the WordPress test suite and a test database.
585574
* * `tests/bootstrap.php` is the file that makes the current plugin active when running the test suite.
586575
* * `tests/test-sample.php` is a sample file containing test cases.
@@ -615,9 +604,8 @@ private function get_output_path( $assoc_args, $subdir ) {
615604
* [--ci=<provider>]
616605
* : Choose a configuration file for a continuous integration provider.
617606
* ---
618-
* default: travis
607+
* default: circle
619608
* options:
620-
* - travis
621609
* - circle
622610
* - gitlab
623611
* ---
@@ -716,7 +704,7 @@ public function plugin( $args, $assoc_args ) {
716704
* The following files are generated by default:
717705
*
718706
* * `phpunit.xml.dist` is the configuration file for PHPUnit.
719-
* * `.travis.yml` is the configuration file for Travis CI. Use `--ci=<provider>` to select a different service.
707+
* * `.circleci/config.yml` is the configuration file for CircleCI. Use `--ci=<provider>` to select a different service.
720708
* * `bin/install-wp-tests.sh` configures the WordPress test suite and a test database.
721709
* * `tests/bootstrap.php` is the file that makes the current plugin active when running the test suite.
722710
* * `tests/test-sample.php` is a sample file containing the actual tests.
@@ -740,9 +728,8 @@ public function plugin( $args, $assoc_args ) {
740728
* [--ci=<provider>]
741729
* : Choose a configuration file for a continuous integration provider.
742730
* ---
743-
* default: travis
731+
* default: circle
744732
* options:
745-
* - travis
746733
* - circle
747734
* - gitlab
748735
* - bitbucket
@@ -769,7 +756,7 @@ public function plugin_tests( $args, $assoc_args ) {
769756
* The following files are generated by default:
770757
*
771758
* * `phpunit.xml.dist` is the configuration file for PHPUnit.
772-
* * `.travis.yml` is the configuration file for Travis CI. Use `--ci=<provider>` to select a different service.
759+
* * `.circleci/config.yml` is the configuration file for CircleCI. Use `--ci=<provider>` to select a different service.
773760
* * `bin/install-wp-tests.sh` configures the WordPress test suite and a test database.
774761
* * `tests/bootstrap.php` is the file that makes the current theme active when running the test suite.
775762
* * `tests/test-sample.php` is a sample file containing the actual tests.
@@ -793,9 +780,8 @@ public function plugin_tests( $args, $assoc_args ) {
793780
* [--ci=<provider>]
794781
* : Choose a configuration file for a continuous integration provider.
795782
* ---
796-
* default: travis
783+
* default: circle
797784
* options:
798-
* - travis
799785
* - circle
800786
* - gitlab
801787
* - bitbucket
@@ -890,9 +876,7 @@ private function scaffold_plugin_theme_tests( $args, $assoc_args, $type ) {
890876
"{$tests_dir}/bootstrap.php" => self::mustache_render( "{$type}-bootstrap.mustache", $template_data ),
891877
"{$tests_dir}/test-sample.php" => self::mustache_render( "{$type}-test-sample.mustache", $template_data ),
892878
];
893-
if ( 'travis' === $assoc_args['ci'] ) {
894-
$files_to_create[ "{$target_dir}/.travis.yml" ] = self::mustache_render( 'plugin-travis.mustache', compact( 'wp_versions_to_test' ) );
895-
} elseif ( 'circle' === $assoc_args['ci'] ) {
879+
if ( 'circle' === $assoc_args['ci'] ) {
896880
$files_to_create[ "{$target_dir}/.circleci/config.yml" ] = self::mustache_render( 'plugin-circle.mustache', compact( 'wp_versions_to_test' ) );
897881
} elseif ( 'gitlab' === $assoc_args['ci'] ) {
898882
$files_to_create[ "{$target_dir}/.gitlab-ci.yml" ] = self::mustache_render( 'plugin-gitlab.mustache' );

0 commit comments

Comments
 (0)