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

Build: migrate from Travis to GH Actions #17902

Merged
merged 52 commits into from
Nov 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
4c6f528
Add PHPUnit workflow
brbrr Nov 25, 2020
8f6a6de
Try to tweak workflow name
brbrr Nov 25, 2020
d8bc65c
tweaking
brbrr Nov 25, 2020
faa751b
add mysql
brbrr Nov 25, 2020
4e61fbc
try use preinstalled mysql
brbrr Nov 25, 2020
962cb6b
:shrug:
brbrr Nov 25, 2020
de5c3f3
use proper mysql password
brbrr Nov 25, 2020
7cd3cce
this shoud work
brbrr Nov 25, 2020
6c99ac6
add mysql extension
brbrr Nov 25, 2020
8947dc0
add fail-fast: false
brbrr Nov 25, 2020
2a7472f
log data
brbrr Nov 25, 2020
fcb880c
add imagick extension
brbrr Nov 25, 2020
e4e425b
remove error_log
brbrr Nov 25, 2020
911a28f
add legacy sync
brbrr Nov 25, 2020
dcfa4c9
try this
brbrr Nov 25, 2020
5dd0473
try this one
brbrr Nov 25, 2020
99beab7
fix legacy sync logic
brbrr Nov 25, 2020
f8af305
try custom name
brbrr Nov 25, 2020
c42f374
move legacy full sync into separate job
brbrr Nov 25, 2020
d2c480b
use phpunit 6 in legacy sync tests
brbrr Nov 25, 2020
6a31c10
try fix php version
brbrr Nov 25, 2020
07e4d4b
should work now
brbrr Nov 25, 2020
f8043b9
Update .github/workflows/phpunit.yml
brbrr Nov 26, 2020
5f20c20
try fix syntax error
brbrr Nov 26, 2020
4e01ee8
dont install phpunit in action
brbrr Nov 26, 2020
af56a42
remove phpunit
brbrr Nov 26, 2020
28f20bf
revert #17895
brbrr Nov 26, 2020
5fdaf8d
revert the revert
brbrr Nov 26, 2020
c4591ea
add setUp back
brbrr Nov 26, 2020
b28acb7
mess with the tests a bit
brbrr Nov 26, 2020
6520533
add code coverage and js tests actions
brbrr Nov 26, 2020
5626b90
fix here and there
brbrr Nov 26, 2020
d743427
fix code coverage and danger
brbrr Nov 26, 2020
99f8d4b
try this
brbrr Nov 26, 2020
44bd2e2
Try new token
brbrr Nov 26, 2020
d4b881f
update path
brbrr Nov 26, 2020
6ff76e4
:shrug:
brbrr Nov 26, 2020
761a22b
.
brbrr Nov 26, 2020
86262b5
try disabling some tests
brbrr Nov 26, 2020
1b20a63
some more
brbrr Nov 26, 2020
dad0cb0
.
brbrr Nov 26, 2020
279cbb0
try workaround?
brbrr Nov 26, 2020
b2a4e9a
.
brbrr Nov 26, 2020
0a6acd2
try cd into workspace directory
brbrr Nov 27, 2020
61985d2
add some debugging logging
brbrr Nov 27, 2020
90dfcc6
update setup php step
brbrr Nov 27, 2020
62d5303
This should do it
brbrr Nov 27, 2020
ebe04eb
this should work v2
brbrr Nov 27, 2020
c6e0d48
not sure what I'm doing
brbrr Nov 27, 2020
056a6ef
this should definitely work
brbrr Nov 27, 2020
28363f4
get rid of PLUGIN_SLUG env variable
brbrr Nov 27, 2020
5858684
remove travis config
brbrr Nov 27, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/code-coverage.yml
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


65 changes: 65 additions & 0 deletions .github/workflows/js-tests.yml
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
121 changes: 121 additions & 0 deletions .github/workflows/phpunit.yml
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
brbrr marked this conversation as resolved.
Show resolved Hide resolved

- 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
Copy link
Contributor

Choose a reason for hiding this comment

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

It's up to you, but I'd recommend moving all the stuff from setup-travis.sh and run-travis.sh in here into this file, or into .github/actions/ that are then called from here.

run-travis.sh, in particular, seems kind of spaghetti-ish and seems like it would be more clear split up into steps.

If you don't want to, that's fine with me but I may well do it in a followup 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, totally! I'll look at what can be done

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess I'm going to refactor it in a follow-up PR.


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
146 changes: 0 additions & 146 deletions .travis.yml

This file was deleted.

Loading