Removed Travis

This commit is contained in:
Claudio Sanches 2021-03-13 21:58:42 -03:00
parent 87a18620eb
commit 16823082aa
5 changed files with 6 additions and 129 deletions

View File

@ -48,4 +48,5 @@ jobs:
- name: Run unit tests with code coverage. Allow to fail. - name: Run unit tests with code coverage. Allow to fail.
run: | run: |
RUN_CODE_COVERAGE=1 bash ./tests/bin/phpunit.sh RUN_CODE_COVERAGE=1 bash ./tests/bin/phpunit.sh
bash <(curl -s https://codecov.io/bash)
exit 0 exit 0

View File

@ -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

View File

@ -5,7 +5,7 @@
<a href="https://packagist.org/packages/woocommerce/woocommerce"><img src="https://poser.pugx.org/woocommerce/woocommerce/v/stable" alt="Latest Stable Version"></a> <a href="https://packagist.org/packages/woocommerce/woocommerce"><img src="https://poser.pugx.org/woocommerce/woocommerce/v/stable" alt="Latest Stable Version"></a>
<img src="https://img.shields.io/wordpress/plugin/dt/woocommerce.svg" alt="WordPress.org downloads"> <img src="https://img.shields.io/wordpress/plugin/dt/woocommerce.svg" alt="WordPress.org downloads">
<img src="https://img.shields.io/wordpress/plugin/r/woocommerce.svg" alt="WordPress.org rating"> <img src="https://img.shields.io/wordpress/plugin/r/woocommerce.svg" alt="WordPress.org rating">
<a href="https://travis-ci.com/woocommerce/woocommerce"><img src="https://travis-ci.com/woocommerce/woocommerce.svg?branch=trunk" alt="Build Status"></a> <a href="https://github.com/woocommerce/woocommerce/actions/workflows/ci.yml"><img src="https://github.com/woocommerce/woocommerce/actions/workflows/ci.yml/badge.svg?branch=trunk" alt="Build Status"></a>
<a href="https://codecov.io/gh/woocommerce/woocommerce"><img src="https://codecov.io/gh/woocommerce/woocommerce/branch/trunk/graph/badge.svg" alt="codecov"></a> <a href="https://codecov.io/gh/woocommerce/woocommerce"><img src="https://codecov.io/gh/woocommerce/woocommerce/branch/trunk/graph/badge.svg" alt="codecov"></a>
</p> </p>

View File

@ -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. 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 ## Table of contents
- [WooCommerce Tests](#woocommerce-tests) - [WooCommerce Tests](#woocommerce-tests)
@ -51,7 +50,6 @@ Example:
**Important**: The `<db-name>` database will be created if it doesn't exist and all data will be removed during testing. **Important**: The `<db-name>` database will be created if it doesn't exist and all data will be removed during testing.
## Running Tests ## Running Tests
Change to the plugin root directory and type: 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: To workaround this, the testing strategy used by WooCommerce is as follows:
* We normally use PHPUnit 6.5.14 * 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 ```shell
curl -L https://github.com/woocommerce/phpunit/archive/add-compatibility-with-php8-to-phpunit-7.zip -o /tmp/phpunit-7.5-fork.zip 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! Just remember that you can't include the modified `composer.json` in any commit!
## Writing Tests ## Writing Tests
There are three different unit test directories: 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. * 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). * 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 ## 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
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.

View File

@ -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