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

Switching to reusable tests #113

Merged
merged 2 commits into from
Sep 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
55 changes: 6 additions & 49 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,13 @@
name: Coding Standards

on:
push:
branches:
- main
pull_request:
schedule:
- cron: '0 0 * * *'

jobs:
coding-standards:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php: [8.0]

name: Coding Standards

steps:
- name: Cancel previous runs of this workflow (pull requests only)
if: ${{ github.event_name == 'pull_request' }}
uses: styfle/cancel-workflow-action@0.10.0
with:
access_token: ${{ github.token }}

- name: Checkout code
uses: actions/checkout@v3

- name: Get Composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Set up Composer caching
uses: actions/cache@v3
env:
cache-name: cache-composer-dependencies
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd
tools: composer:v2
coverage: none

- name: Install dependencies
uses: nick-invision/retry@v2
with:
timeout_minutes: 5
max_attempts: 5
command: composer install

- name: Run phpcs
run: composer run lint
uses: alleyinteractive/.github/.github/workflows/php-coding-standards.yml@main
91 changes: 12 additions & 79 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,89 +1,22 @@
name: Unit Tests
name: Testing Suite

on:
push:
branches:
- main
pull_request:
schedule:
- cron: '0 0 * * *'

jobs:
tests:
runs-on: ubuntu-latest

services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
redis:
image: redis:5.0
ports:
- 6379:6379
options: --entrypoint redis-server
continue-on-error: ${{ matrix.can_fail }}
php-tests:
strategy:
fail-fast: true
matrix:
php: [7.4, 8.0]
wp_version: ["latest"]
can_fail: [false]

name: ${{ matrix.php }} @ ${{ matrix.wp_version }}
env:
CACHEDIR: /tmp/test-cache
WP_CORE_DIR: /tmp/wordpress
WP_VERSION: ${{ matrix.wp_version }}
WP_DB_HOST: 127.0.0.1
WP_DB_USER: root
WP_DB_PASSWORD: '""'

steps:
- name: Cancel previous runs of this workflow (pull requests only)
if: ${{ github.event_name == 'pull_request' }}
uses: styfle/cancel-workflow-action@0.10.0
with:
access_token: ${{ github.token }}

- name: Checkout code
uses: actions/checkout@v3

- name: Get Composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Set up Composer caching
uses: actions/cache@v3
env:
cache-name: cache-composer-dependencies
with:
path: |
${{ steps.composer-cache.outputs.dir }}
/tmp/test-cache
/tmp/wordpress
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd
tools: composer:v2
coverage: none

- name: Validate Composer
run: composer validate --strict

- name: Install dependencies
uses: nick-invision/retry@v2
with:
timeout_minutes: 5
max_attempts: 5
command: composer install

- name: Test Mantle
shell: bash
run: composer run phpunit
wordpress: ["latest"]
multisite: [true, false]
uses: alleyinteractive/.github/.github/workflows/php-tests.yml@main
with:
php: ${{ matrix.php }}
wordpress: ${{ matrix.wordpress }}
multisite: ${{ matrix.multisite }}