Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move from Travis CI to GitHub Actions #635

Merged
merged 4 commits into from May 4, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/e2e-and-js-tests.yml
@@ -0,0 +1,43 @@
name: E2E and JS tests

on: push

jobs:
test:
runs-on: ubuntu-latest
continue-on-error: false

env:
# Currently these tests are being run for PHP 7.4 only
# TODO: When a new version of wp-env (after 4.0.2) including this https://github.com/WordPress/gutenberg/pull/30651
# is released, we can switch all PHP tests using wp-env
WP_ENV_PHP_VERSION: 7.4

strategy:
fail-fast: false

steps:
- name: Checkout code
uses: actions/checkout@master

- name: Set up NodeJS 14.x
uses: actions/setup-node@v2
with:
node-version: '14'

- name: Build Edit Flow
run: |
npm ci
npm run build

- name: Install WordPress with wp-env
run: npm run wp-env start

- name: Run Lint JS
run: npm run lint-js

- name: Run JS tests (Jest)
run: npm run test-jest

- name: Run E2E tests
run: npm run test-e2e
66 changes: 66 additions & 0 deletions .github/workflows/php-tests.yml
@@ -0,0 +1,66 @@
name: PHP Tests

on: push

jobs:
test:
name: WP ${{ matrix.wp }} and PHP ${{ matrix.php }}
# Ubuntu-20.x includes MySQL 8.0, which causes `caching_sha2_password` issues with PHP < 7.4
# https://www.php.net/manual/en/mysqli.requirements.php
# TODO: change to ubuntu-latest when we no longer support PHP < 7.4
runs-on: ubuntu-16.04
continue-on-error: ${{ matrix.allowed_failure }}

strategy:
fail-fast: false
matrix:
php: [ '5.6', '7.0', '7.1', '7.2', '7.3', '7.4' ]
wp: [ '5.6', '5.7' ]
allowed_failure: [ false ]
include:
- php: '8.0'
htdat marked this conversation as resolved.
Show resolved Hide resolved
wp: '5.6'
allowed_failure: true
- php: '8.0'
wp: '5.7'
allowed_failure: true
# PHP nightly.
- php: '8.1'
wp: '5.7'
allowed_failure: true
steps:
- name: Checkout code
uses: actions/checkout@master

- name: Setup PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: pcov
# https://make.wordpress.org/hosting/handbook/handbook/server-environment/#php-extensions
extensions: curl, dom, exif, fileinfo, hash, json, mbstring, mysqli, libsodium, openssl, pcre, imagick, xml, zip

- name: Install Composer dependencies (PHP < 8.0 )
if: ${{ matrix.php < 8.0 }}
uses: ramsey/composer-install@v1

- name: Install Composer dependencies (PHP >= 8.0)
if: ${{ matrix.php >= 8.0 }}
uses: ramsey/composer-install@v1
with:
composer-options: --ignore-platform-reqs

- name: Start MySQL service
run: sudo systemctl start mysql.service

- name: Install WordPress test site
run: bash bin/install-wp-tests.sh wordpress_test root root localhost ${{ matrix.wp }}

- name: Run PHPCS diff tests
run: bash bin/phpcs-diff.sh

- name: Run PHPUnit tests (single site)
run: composer integration

- name: Run PHPUnit tests (multisite)
run: composer integration-ms
102 changes: 0 additions & 102 deletions .travis.yml

This file was deleted.

19 changes: 15 additions & 4 deletions composer.json
Expand Up @@ -10,11 +10,22 @@
"source": "https://github.com/Automattic/edit-flow"
},
"require" : {
"composer/installers": "~1.0"
"composer/installers": "~1.0",
"php": ">=5.6"
},
"require-dev": {
"automattic/vipwpcs": "^2.0",
"dealerdirect/phpcodesniffer-composer-installer": "^0.5.0",
"exussum12/coverage-checker": "^0.11.2"
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7",
"exussum12/coverage-checker": "^0.11.2",
"phpunit/phpunit": "^4 || ^5 || ^6 || ^7"
Comment on lines +18 to +20
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change and removing composer.json help handle different PHPUnit and PHP versions.

},
"scripts": {
"integration": [
"@php ./vendor/bin/phpunit --testsuite WP_Tests"
],
"integration-ms": [
"@putenv WP_MULTISITE=1",
"@composer integration"
]
}
}
}