-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tools: Move from Travis CI to GitHub Actions for PR tests (#674)
The WordPress project is moving away from Travis CI, so this migrates our CI checks to GitHub Actions. This only applies to automated linters and unit tests run on github PRs, nothing should change for local development.
- Loading branch information
Showing
5 changed files
with
144 additions
and
56 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
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,50 @@ | ||
name: Static Analysis (Linting) | ||
|
||
# Run on any changes in public_html | ||
on: | ||
pull_request: | ||
paths: | ||
- public_html/** | ||
push: | ||
branches: [production] | ||
paths: | ||
- public_html/** | ||
|
||
jobs: | ||
check: | ||
name: All | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: actions/cache@v2 | ||
with: | ||
path: '**/node_modules' | ||
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | ||
|
||
- name: Use Node.js 12.x | ||
uses: actions/setup-node@v2-beta | ||
with: | ||
node-version: 12.x | ||
|
||
- name: composer install | ||
run: | | ||
composer install | ||
- name: yarn install and build | ||
run: | | ||
yarn | ||
yarn workspaces run build | ||
- name: Lint JavaScript and Styles | ||
run: | | ||
yarn workspaces run lint:js | ||
yarn workspaces run lint:css | ||
- name: Lint PHP | ||
run: | | ||
BASE_REF=${{ github.base_ref }} php .github/bin/phpcs-branch.php |
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,86 @@ | ||
name: Unit Tests | ||
|
||
# Run on any changes in public_html | ||
on: | ||
pull_request: | ||
paths: | ||
- public_html/** | ||
push: | ||
branches: [production] | ||
paths: | ||
- public_html/** | ||
|
||
jobs: | ||
unit-js: | ||
name: JavaScript | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: actions/cache@v2 | ||
with: | ||
path: '**/node_modules' | ||
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | ||
|
||
- name: Use Node.js 12.x | ||
uses: actions/setup-node@v2-beta | ||
with: | ||
node-version: 12.x | ||
|
||
- name: Install dependencies | ||
# We don't need to build, since jest can interpret the source files. | ||
run: yarn | ||
|
||
# Run the Blocks unit tests. If/when other workspaces get tests, those would be added here. | ||
- name: Running the tests | ||
run: yarn workspace wordcamp-blocks run test | ||
|
||
unit-php: | ||
name: PHP Tests | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php-version: ['7.4'] # 8.0 -- Add back to matrix when 8.0 is supported. | ||
|
||
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: Set PHP version | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-version }} | ||
coverage: none | ||
tools: composer:v1 | ||
|
||
- name: Start mysql service | ||
run: sudo /etc/init.d/mysql start | ||
|
||
- name: Install dependencies | ||
run: composer install | ||
|
||
- name: Install WordPress | ||
run: | | ||
bash .docker/bin/install-wp-tests.sh wcorg_test root root 127.0.0.1 trunk | ||
- name: Install required plugins | ||
run: | | ||
svn export https://plugins.svn.wordpress.org/jetpack/trunk public_html/wp-content/plugins/jetpack | ||
- name: Running unit tests | ||
run: ./public_html/wp-content/mu-plugins/vendor/bin/phpunit -c phpunit.xml.dist |
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 |
---|---|---|
@@ -1 +1 @@ | ||
lts/* | ||
12 |
This file was deleted.
Oops, something went wrong.