mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-04-16 08:33:43 +03:00
Tools: Move from Travis to GitHub Actions for CI checks (#154)
This commit is contained in:
parent
13a417ce8e
commit
ee8583d91d
110
.github/workflows/ci.yml
vendored
Normal file
110
.github/workflows/ci.yml
vendored
Normal file
|
@ -0,0 +1,110 @@
|
|||
name: CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches: [production]
|
||||
|
||||
jobs:
|
||||
phpcs:
|
||||
name: PHP CodeSniffer
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get Composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
|
||||
- name: Set up Composer caching
|
||||
uses: actions/cache@v2
|
||||
env:
|
||||
cache-name: cache-composer-dependencies
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-composer-
|
||||
|
||||
- name: Set up PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
coverage: none
|
||||
tools: composer, cs2pr
|
||||
|
||||
- name: Install Composer dependencies
|
||||
run: |
|
||||
composer install --prefer-dist --no-suggest --no-progress --no-ansi --no-interaction
|
||||
echo "${PWD}/mu-plugins/vendor/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Run PHPCS on changed files
|
||||
run: |
|
||||
touch $GITHUB_WORKSPACE/tmp.php
|
||||
export CHANGED_FILES=$(git diff --name-only --diff-filter=AM remotes/origin/${{ github.base_ref }} | tr '\n' ' ')
|
||||
phpcs -q -n --report=checkstyle $GITHUB_WORKSPACE/tmp.php $(echo $CHANGED_FILES) | cs2pr
|
||||
|
||||
phpunit:
|
||||
name: PHP Unit Tests
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php-version: ['7.4']
|
||||
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:5.7
|
||||
env:
|
||||
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
||||
MYSQL_ROOT_PASSWORD: root
|
||||
MYSQL_DATABASE: wcorg_test
|
||||
ports:
|
||||
- 3306/tcp
|
||||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Get Composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
|
||||
- name: Set up Composer caching
|
||||
uses: actions/cache@v2
|
||||
env:
|
||||
cache-name: cache-composer-dependencies
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-composer-
|
||||
|
||||
- name: Set up PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php-version }}
|
||||
coverage: none
|
||||
tools: composer
|
||||
|
||||
- name: Install Composer dependencies
|
||||
run: |
|
||||
composer install --prefer-dist --no-suggest --no-progress --no-ansi --no-interaction
|
||||
echo "${PWD}/mu-plugins/vendor/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Start mysql service
|
||||
run: sudo /etc/init.d/mysql start
|
||||
|
||||
- name: Install WordPress
|
||||
run: |
|
||||
bash bin/install-wp-tests.sh wporg_5ftf_test root root 127.0.0.1 trunk
|
||||
|
||||
- name: Running unit tests
|
||||
run: composer run-script test -- -c phpunit.xml.dist
|
16
.travis.yml
16
.travis.yml
|
@ -1,16 +0,0 @@
|
|||
sudo: required
|
||||
dist: trusty
|
||||
language: php
|
||||
php: 7.2
|
||||
env: WP_VERSION=latest WP_MULTISITE=1 WP_CORE_DIR=/tmp/wordpress
|
||||
|
||||
install:
|
||||
- bash bin/install-wp-tests.sh wporg_5ftf_test root '' localhost $WP_VERSION
|
||||
- composer install
|
||||
|
||||
script:
|
||||
- composer run-script test -- --version
|
||||
- composer run-script test -- -c phpunit.xml.dist
|
||||
- touch $TRAVIS_BUILD_DIR/tmp.php
|
||||
- export CHANGED_FILES=$(git diff --name-only --diff-filter=AM $TRAVIS_BRANCH...HEAD | tr '\n' ' ')
|
||||
- composer run-script phpcs $TRAVIS_BUILD_DIR/tmp.php $(echo $CHANGED_FILES) -- -n
|
|
@ -17,10 +17,10 @@
|
|||
"require": {},
|
||||
"_comment" : "PHPUnit 7.x is the latest version that's compatible with Core, see https://core.trac.wordpress.org/ticket/46149",
|
||||
"require-dev" : {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": "0.5.0",
|
||||
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
|
||||
"wp-coding-standards/wpcs": "2.1.1",
|
||||
"phpunit/phpunit" : "^7",
|
||||
"spatie/phpunit-watcher" : "^1.12"
|
||||
"phpunit/phpunit": "^7",
|
||||
"spatie/phpunit-watcher": "^1.23"
|
||||
},
|
||||
"scripts": {
|
||||
"phpcs": [
|
||||
|
|
996
composer.lock
generated
996
composer.lock
generated
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue