Skip to content

Add/badges

Add/badges #1591

Workflow file for this run

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 16.x
uses: actions/setup-node@v2-beta
with:
node-version: 16.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 latest
- name: Running unit tests
run: ./public_html/wp-content/mu-plugins/vendor/bin/phpunit -c phpunit.xml.dist