Merge pull request #645 from feryardiant/dependabot/npm_and_yarn/es5-… #1131
Workflow file for this run
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
name: Tests and Build | |
on: | |
pull_request: | |
branches: | |
- master | |
push: | |
branches: | |
- master | |
jobs: | |
run: | |
name: Runs on WordPress ${{ matrix.wp-versions }} | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mysql:5.7 | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: false | |
MYSQL_ROOT_PASSWORD: secret | |
MYSQL_DATABASE: wordpress | |
ports: | |
- 3306 | |
strategy: | |
matrix: | |
php-versions: ['7.3'] | |
wp-versions: ['5.0', '5.1', '5.2', '5.3', '5.4', '5.5'] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@master | |
- name: Set up PHP | |
uses: shivammathur/setup-php@master | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: exif, gd, gettext, imagick, mbstring, xmlrpc | |
coverage: xdebug | |
- name: Get composer cache directory | |
id: composer-cache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Cache composer dependencies | |
uses: actions/cache@v1 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Install composer dependencies | |
run: composer require roots/wordpress ${{ matrix.wp-versions }} --prefer-dist --no-progress --no-suggest | |
- name: Set up Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: '10.x' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Get yarn cache directory | |
id: yarn-cache | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- name: Cache yarn dependencies | |
uses: actions/cache@v1 | |
with: | |
path: ${{ steps.yarn-cache.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: ${{ runner.os }}-yarn- | |
- name: Install Dependencies | |
run: yarn --ignore-engines | |
- name: Install WordPress Core | |
env: | |
WP_ENV: testing | |
WP_HOME: http://localhost:8080 | |
DB_HOST: 127.0.0.1:${{ job.services.mysql.ports['3306'] }} | |
run: .github/setup.sh | |
- name: Unit Test | |
run: | | |
vendor/bin/phpcs --standard=packages/phpcs.xml packages | |
vendor/bin/phpunit -c tests/phpunit.xml --coverage-text | |
- name: End-to-end Tests | |
if: matrix.wp-versions == 5.4 | |
env: | |
BROWSERSTACK_PROJECT: "${{ github.repository }} - ${{ github.workflow }}" | |
BROWSERSTACK_BUILD: ${{ github.ref }} | |
BROWSERSTACK_USER: ${{ secrets.BROWSERSTACK_USER }} | |
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} | |
run: | | |
yarn gulp build --mode production | |
yarn gulp e2e --mode testing |