From 16823082aaf28c89babe34b2966742f41ad8f3ae Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Sat, 13 Mar 2021 21:58:42 -0300 Subject: [PATCH] Removed Travis --- .github/workflows/pr-code-coverage.yml | 1 + .travis.yml | 106 ------------------------- README.md | 2 +- tests/README.md | 13 +-- tests/bin/travis.sh | 13 --- 5 files changed, 6 insertions(+), 129 deletions(-) delete mode 100644 .travis.yml delete mode 100755 tests/bin/travis.sh diff --git a/.github/workflows/pr-code-coverage.yml b/.github/workflows/pr-code-coverage.yml index 0b12def78ac..7e496238da8 100644 --- a/.github/workflows/pr-code-coverage.yml +++ b/.github/workflows/pr-code-coverage.yml @@ -48,4 +48,5 @@ jobs: - name: Run unit tests with code coverage. Allow to fail. run: | RUN_CODE_COVERAGE=1 bash ./tests/bin/phpunit.sh + bash <(curl -s https://codecov.io/bash) exit 0 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 73ce6b65b3c..00000000000 --- a/.travis.yml +++ /dev/null @@ -1,106 +0,0 @@ -version: ~> 1.0 - -# Specifies that Travis should create builds for trunk and release branches and also tags. -branches: - only: - - trunk - - /^\d+\.\d+(\.\d+)?(-\S*)?$/ - - /^release\// - -language: php -os: - - linux -dist: xenial - -# Test main supported versions of PHP against latest WP. -php: - - "7.0" - - "7.1" - - "7.2" - - "7.3" - - "7.4" - - "8.0" - -env: - - WP_VERSION=latest WP_MULTISITE=0 - -# Additional tests against stable PHP (min version is 7.0) -# and code coverage report. -jobs: - fast_finish: true - include: - - name: "Core E2E Tests" - env: WP_VERSION=latest WP_MULTISITE=0 RUN_E2E=1 - install: - - nvm install - - npm install - - composer install --no-dev - script: - - npm run build:assets - - npm run docker:up - - npm run test:e2e - after_script: - - npm run docker:down - - name: "WP Nightly" - php: "7.4" - env: WP_VERSION=nightly WP_MULTISITE=0 - - name: "WP Latest - 1" - php: "7.2" - env: WP_VERSION=5.5 WP_MULTISITE=0 - - name: "WP Latest - 2" - php: "7.2" - env: WP_VERSION=5.4 WP_MULTISITE=0 - - name: "Code Coverage" - php: "7.4" - env: WP_VERSION=latest WP_MULTISITE=0 RUN_CODE_COVERAGE=1 - allow_failures: - - php: "7.4" - env: WP_VERSION=latest WP_MULTISITE=0 RUN_CODE_COVERAGE=1 - -# Git clone depth -# By default Travis CI clones repositories to a depth of 50 commits. Using a depth of 1 makes this step a bit faster. -git: - depth: 1 - -# Since Xenial services are not started by default, we need to instruct it below to start. -services: - - mysql - - docker - -cache: - directories: - - $HOME/.composer/cache - -# Composer 2.0.7 introduced a change that broke the jetpack autoloader in PHP 7.0 - 7.3. -before_install: - - composer self-update 2.0.6 - -install: - - export PATH="$HOME/.composer/vendor/bin:$PATH" - - | - # Remove Xdebug for a huge performance increase: - 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 - - composer install - - | - if [ "$(php -r "echo version_compare(PHP_VERSION,'8.0','>=');")" ]; then - curl -L https://github.com/woocommerce/phpunit/archive/add-compatibility-with-php8-to-phpunit-7.zip -o /tmp/phpunit-7.5-fork.zip - unzip -d /tmp/phpunit-7.5-fork /tmp/phpunit-7.5-fork.zip - composer bin phpunit config --unset platform - composer bin phpunit config repositories.0 '{"type": "path", "url": "/tmp/phpunit-7.5-fork/phpunit-add-compatibility-with-php8-to-phpunit-7", "options": {"symlink": false}}' - composer bin phpunit require --dev -W phpunit/phpunit:@dev --ignore-platform-reqs - fi - - | - # Install WP Test suite: - if [[ ! -z "$WP_VERSION" ]]; then - bash tests/bin/install.sh woocommerce_test root '' localhost $WP_VERSION - fi - -script: - - bash tests/bin/phpunit.sh - -after_script: - - bash tests/bin/travis.sh after diff --git a/README.md b/README.md index b24fb96bff1..667fabd3cd8 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Latest Stable Version WordPress.org downloads WordPress.org rating -Build Status +Build Status codecov

diff --git a/tests/README.md b/tests/README.md index e15a9485241..099f6f4c6d0 100644 --- a/tests/README.md +++ b/tests/README.md @@ -2,7 +2,6 @@ This document discusses unit tests. See [the e2e README](https://github.com/woocommerce/woocommerce/tree/trunk/tests/e2e) to learn how to setup testing environment for running e2e tests and run them. - ## Table of contents - [WooCommerce Tests](#woocommerce-tests) @@ -51,7 +50,6 @@ Example: **Important**: The `` database will be created if it doesn't exist and all data will be removed during testing. - ## Running Tests Change to the plugin root directory and type: @@ -78,9 +76,9 @@ WooCommerce currently supports PHP versions from 7.0 up to 8.0, and this poses a To workaround this, the testing strategy used by WooCommerce is as follows: * We normally use PHPUnit 6.5.14 -* For PHP 8 we use [a custom fork of PHPUnit 7.5.20 with support for PHP 8](https://github.com/woocommerce/phpunit/pull/1). The Travis build is configured to use this fork instead of the old version 6 when running in PHP 8. +* For PHP 8 we use [a custom fork of PHPUnit 7.5.20 with support for PHP 8](https://github.com/woocommerce/phpunit/pull/1). WooCommerce's GitHub Actions CI workflow is configured to use this fork instead of the old version 6 when running in PHP 8. -If you want to run the tests locally under PHP 8 you'll need to temporarily modify `composer.json` to use the custom PHPUnit fork in the same way that the Travis setup script does. These are the commands that you'll need (run them after a regular `composer install`): +If you want to run the tests locally under PHP 8 you'll need to temporarily modify `composer.json` to use the custom PHPUnit fork in the same way that the GitHub Actions CI workflow file does. These are the commands that you'll need (run them after a regular `composer install`): ```shell curl -L https://github.com/woocommerce/phpunit/archive/add-compatibility-with-php8-to-phpunit-7.zip -o /tmp/phpunit-7.5-fork.zip @@ -92,7 +90,6 @@ composer bin phpunit require --dev -W phpunit/phpunit:@dev --ignore-platform-req Just remember that you can't include the modified `composer.json` in any commit! - ## Writing Tests There are three different unit test directories: @@ -122,12 +119,10 @@ General guidelines for all the unit tests: * Filters persist between test cases so be sure to remove them in your test method or in the `tearDown()` method. * Use data providers where possible. Be sure that their name is like `data_provider_function_to_test` (i.e. the data provider for `test_is_postcode` would be `data_provider_test_is_postcode`). Read more about data providers [here](https://phpunit.de/manual/current/en/writing-tests-for-phpunit.html#writing-tests-for-phpunit.data-providers). - ## Automated Tests -Tests are automatically run with [Travis-CI](https://travis-ci.org/woocommerce/woocommerce) for each commit and pull request. - +Tests are automatically run with [GitHub Actions](https://github.com/woocommerce/woocommerce/actions/workflows/ci.yml) for each commit and pull request. ## Code Coverage -Code coverage is available on [Codecov](https://codecov.io/gh/woocommerce/woocommerce/) which receives updated data after each Travis build. +Code coverage is available on [Codecov](https://codecov.io/gh/woocommerce/woocommerce/) which receives updated data after each build. diff --git a/tests/bin/travis.sh b/tests/bin/travis.sh deleted file mode 100755 index 2c5d161160e..00000000000 --- a/tests/bin/travis.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash -# usage: travis.sh before|after - -if [ $1 == 'after' ]; then - - if [[ ${RUN_CODE_COVERAGE} == 1 ]]; then - bash <(curl -s https://codecov.io/bash) - wget https://scrutinizer-ci.com/ocular.phar - chmod +x ocular.phar - php ocular.phar code-coverage:upload --format=php-clover coverage.clover - fi - -fi