Skip to content

Commit

Permalink
Merge pull request #20309 from Yoast/JRF/ghactions-merge-test-workflows
Browse files Browse the repository at this point in the history
GH Actions: merge unit and integration test workflows
  • Loading branch information
jrfnl committed May 10, 2023
2 parents 32d2f75 + 0c281ed commit 2405388
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 87 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Integration Test
name: Test

on:
# Run on pushes to select branches and on all pull requests.
Expand All @@ -20,6 +20,69 @@ concurrency:
cancel-in-progress: true

jobs:
unit-test:
runs-on: ubuntu-latest

strategy:
matrix:
php_version: ["7.2", "7.4", "8.0", "8.1", "8.2"]

name: "Unit Test: PHP ${{ matrix.php_version }}"

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

# The prefix-dependencies task makes use of reflection-based PHP code that only works on PHP > 7.2.
- name: Install PHP 7.x for generating the vendor_prefixed directory and dependency injection
uses: shivammathur/setup-php@v2
with:
php-version: 7.2
coverage: none

- name: Install Composer dependencies, generate vendor_prefixed directory and run dependency injection
uses: ramsey/composer-install@v2
with:
# Bust the cache at least once a week - output format: YYYY-MM-DD.
custom-cache-suffix: $(/bin/date -u --date='last Mon' "+%F")

# Remove packages which are not PHP cross-version compatible and only used for the prefixing.
# - humbug/php-scoper is only needed to actually do the prefixing, so won't be shipped anyway.
- name: Delete dev dependencies which are not cross-version compatible
run: composer remove --dev --no-scripts humbug/php-scoper

- name: Remove vendor directory
run: rm -rf vendor/*

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php_version }}
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On
coverage: none

# The PHP platform requirement would prevent updating the test utilities to the appropriate versions.
# As long as the `composer update` is run selectively to only update the test utils, removing this is fine.
- name: "Composer: remove the PHP platform requirement"
run: composer config --unset platform.php

# Install dependencies and handle caching in one go.
# - Updates the test utilities (and only those!) to the most appropriate version
# for the PHP version on which the tests will be run.
# @link https://github.com/marketplace/actions/install-composer-dependencies
- name: Install Composer dependencies
uses: ramsey/composer-install@v2
with:
# Force a `composer update` run.
dependency-versions: "highest"
# But make it selective.
composer-options: "yoast/wp-test-utils --with-dependencies --no-scripts"
# Bust the cache at least once a week - output format: YYYY-MM-DD.
custom-cache-suffix: $(/bin/date -u --date='last Mon' "+%F")

- name: Run unit tests
run: composer test

integration-test:
runs-on: ubuntu-latest

Expand Down
84 changes: 0 additions & 84 deletions .github/workflows/unittest.yml

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
[![Lint](https://github.com/Yoast/wordpress-seo/actions/workflows/lint.yml/badge.svg)](https://github.com/Yoast/wordpress-seo/actions/workflows/lint.yml)
[![LintJS](https://github.com/Yoast/wordpress-seo/actions/workflows/jslint.yml/badge.svg)](https://github.com/Yoast/wordpress-seo/actions/workflows/jslint.yml)
[![TestJS](https://github.com/Yoast/wordpress-seo/actions/workflows/jstest.yml/badge.svg)](https://github.com/Yoast/wordpress-seo/actions/workflows/jstest.yml)
[![Unit Tests](https://github.com/Yoast/wordpress-seo/actions/workflows/unittest.yml/badge.svg)](https://github.com/Yoast/wordpress-seo/actions/workflows/unittest.yml)
[![Integration Tests](https://github.com/Yoast/wordpress-seo/actions/workflows/integrationtest.yml/badge.svg)](https://github.com/Yoast/wordpress-seo/actions/workflows/integrationtest.yml)
[![Test](https://github.com/Yoast/wordpress-seo/actions/workflows/test.yml/badge.svg)](https://github.com/Yoast/wordpress-seo/actions/workflows/test.yml)
[![Deployment](https://github.com/Yoast/wordpress-seo/actions/workflows/deploy.yml/badge.svg)](https://github.com/Yoast/wordpress-seo/actions/workflows/deploy.yml)

[![Stable Version](https://poser.pugx.org/yoast/wordpress-seo/v/stable.svg)](https://packagist.org/packages/yoast/wordpress-seo)
[![License](https://poser.pugx.org/yoast/wordpress-seo/license.svg)](https://packagist.org/packages/yoast/wordpress-seo)

Expand Down

0 comments on commit 2405388

Please sign in to comment.