-
Notifications
You must be signed in to change notification settings - Fork 806
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build: migrate from Travis to GH Actions (#17902)
* Add PHPUnit workflow * Try to tweak workflow name * try use preinstalled mysql * use proper mysql password * add mysql extension * add fail-fast: false * add imagick extension * move legacy full sync into separate job * use phpunit 6 in legacy sync tests * Update .github/workflows/phpunit.yml Co-authored-by: Brad Jorsch <[email protected]> * try fix syntax error * dont install phpunit in action * add code coverage and js tests actions * get rid of PLUGIN_SLUG env variable * remove travis config Co-authored-by: Brad Jorsch <[email protected]>
- Loading branch information
Showing
9 changed files
with
284 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: "PHP & JS Code coverage" | ||
on: pull_request | ||
|
||
env: | ||
DO_COVERAGE: true | ||
WP_BRANCH: latest | ||
TRAVIS_PHP_VERSION: "7.3" | ||
WP_TRAVISCI: 'phpunit' | ||
CC_TEST_REPORTER_ID: 683bd559e5214ca3b721092af177893f05765ba90d2589fcf35d7e85c6ea01e8 | ||
|
||
jobs: | ||
coverage: | ||
name: "Code coverage" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: "7.3" | ||
tools: composer | ||
coverage: none | ||
extensions: mysql, imagick | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: '12' | ||
|
||
- name: Get Composer cache directory | ||
id: composer-cache | ||
run: | | ||
echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
- name: Composer cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-composer- | ||
- name: Setup tests | ||
run: | | ||
sudo systemctl start mysql.service | ||
export PATH="$HOME/.config/composer/vendor/bin:$HOME/.composer/vendor/bin:$PATH" | ||
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter | ||
chmod +x ./cc-test-reporter | ||
./cc-test-reporter before-build | ||
./tests/setup-travis.sh | ||
yarn install | ||
- name: Run code coverage | ||
run: | | ||
./tests/run-travis.sh | ||
yarn nyc --reporter=lcov -x '_inc/**/**/test/*.js' --report-dir=coverage/adminpage yarn test-adminpage | ||
yarn test-extensions --coverage --collectCoverageFrom='extensions/**/*.js' | ||
- name: Process coverage results | ||
run: ./tests/process-coverage.sh | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: JS tests | ||
|
||
on: pull_request | ||
env: | ||
DANGER_GITHUB_API_TOKEN: ${{ secrets.DANGER_TOKEN }} | ||
jobs: | ||
lint: | ||
name: "JavaScript & CSS lint" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: '12' | ||
|
||
- name: Use yarn cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: /home/runner/.cache/yarn/v6 | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
- run: | | ||
yarn install | ||
yarn lint | ||
js-tests: | ||
name: "Danger CI, test dashboard, extensions and search" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: '12' | ||
|
||
- uses: actions/cache@v2 | ||
with: | ||
path: /home/runner/.cache/yarn/v6 | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
- run: | | ||
yarn install | ||
yarn test-dangerci-and-adminpage-and-extensions-and-search | ||
build: | ||
name: "Build dashboard & extensions" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: '12' | ||
|
||
- uses: actions/cache@v2 | ||
with: | ||
path: /home/runner/.cache/yarn/v6 | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
- run: | | ||
composer self-update | ||
yarn build-concurrently |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
name: PHPUnit tests | ||
|
||
on: pull_request | ||
|
||
### TODO whitelist branches: | ||
# branches: | ||
# only: | ||
# - master | ||
# - master-stable | ||
# - /^branch-.*$/ | ||
# - /^feature\/.*$/ | ||
|
||
env: | ||
WP_TRAVISCI: "phpunit" | ||
COMPOSER_ROOT_VERSION: "dev-master" | ||
|
||
jobs: | ||
phpunit: | ||
name: "PHPUnit tests: PHP ${{ matrix.php }} WP ${{ matrix.wp }}" | ||
runs-on: ubuntu-latest | ||
continue-on-error: ${{ matrix.experimental }} | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
# Run tests against current WP in all supported PHP versions. | ||
php: [ "5.6", "7.0", "7.2", "7.3", "7.4" ] | ||
wp: [ "latest" ] | ||
experimental: [ false ] | ||
|
||
include: | ||
# Run tests against WP previous and master in one PHP version. | ||
- php: "7.4" | ||
wp: "master" | ||
experimental: false | ||
- php: "7.4" | ||
wp: "previous" | ||
experimental: false | ||
|
||
# Experimental PHP 8 tests | ||
- php: "8.0" | ||
wp: "latest" | ||
experimental: true | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
tools: composer | ||
extensions: mysql, imagick | ||
coverage: none | ||
|
||
- name: Get Composer cache directory | ||
id: composer-cache | ||
run: | | ||
echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
- name: Composer cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-composer- | ||
- name: Tool versions | ||
run: | | ||
php --version | ||
composer --version | ||
- name: Setup and run tests | ||
env: | ||
WP_BRANCH: ${{ matrix.wp }} | ||
TRAVIS_PHP_VERSION: ${{ matrix.php }} | ||
run: | | ||
sudo systemctl start mysql.service | ||
export PLUGIN_SLUG=$(basename $(pwd)) | ||
export PATH="$HOME/.config/composer/vendor/bin:$HOME/.composer/vendor/bin:$PATH" | ||
./tests/setup-travis.sh | ||
./tests/run-travis.sh | ||
legacy_full_sync: | ||
name: "Legacy Full Sync" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: "7.0" | ||
tools: composer | ||
extensions: mysql, imagick | ||
coverage: none | ||
|
||
- name: Get Composer cache directory | ||
id: composer-cache | ||
run: | | ||
echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
- name: Composer cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-composer- | ||
- name: Setup and run tests | ||
env: | ||
WP_BRANCH: latest | ||
TRAVIS_PHP_VERSION: "7.0" | ||
LEGACY_FULL_SYNC: "1" | ||
run: | | ||
sudo systemctl start mysql.service | ||
export PLUGIN_SLUG=$(basename $(pwd)) | ||
export PATH="$HOME/.config/composer/vendor/bin:$HOME/.composer/vendor/bin:$PATH" | ||
./tests/setup-travis.sh | ||
./tests/run-travis.sh |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.