Skip to content

Prepare next release #129

Prepare next release

Prepare next release #129

name: Continuous Integration
on:
push:
branches: [ "develop", "master" ]
pull_request:
branches: [ "develop", "master" ]
permissions:
contents: read
jobs:
compliance:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup PHP
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # 2.31.1
with:
php-version: '8.3'
coverage: none
tools: cs2pr
- name: Validate composer.json and composer.lock
run: composer validate --strict
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Check style and compatibility
id: phpcs
run: composer exec phpcs -- --report-full --report-checkstyle=./phpcs-report.xml
- name: Show PHPCS results in PR
if: ${{ always() && steps.phpcs.outcome == 'failure' }}
run: cs2pr ./phpcs-report.xml
test-latest:
runs-on: ubuntu-latest
needs:
- compliance
services:
mysql:
image: mariadb:11.5.2@sha256:4a1de8fa2a929944373d7421105500ff6f889ce90dcb883fbb2fdb070e4d427e
env:
MARIADB_USER: wptestuser
MARIADB_PASSWORD: wptestpass
MARIADB_ROOT_PASSWORD: wptestroot
MARIADB_DATABASE: wptest_latest
TZ: Europe/Berlin
ports:
- 3306/tcp
options: --health-cmd="mariadb-admin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup PHP
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # 2.31.1
with:
php-version: '8.3'
coverage: xdebug
extensions: mysqli
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Run unit tests
run: composer exec phpunit
- name: Set up integration test
run: ./bin/install-wp-tests.sh wptest_latest wptestuser wptestpass 127.0.0.1:${{ job.services.mysql.ports['3306'] }} latest true
- name: Run integration tests
run: composer exec phpunit -- -c phpunit-integration.xml
- name: Upload code coverage to Code Climate
uses: paambaati/codeclimate-action@7c100bd1ed15de0bdee476b38ca759d8c94207b5 # v8.0.0
env:
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
with:
coverageLocations: |
${{github.workspace}}/build/logs/clover.xml:clover
${{github.workspace}}/build/logs/clover-integration.xml:clover
- name: Upload code coverage to Codecov (unit)
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
disable_search: true
file: ${{github.workspace}}/build/logs/clover.xml
flags: unit
- name: Upload code coverage to Codecov (integration)
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
disable_search: true
file: ${{github.workspace}}/build/logs/clover-integration.xml
flags: integration
test-minimum:
runs-on: ubuntu-latest
needs:
- compliance
services:
mysql:
image: mariadb:11.5.2@sha256:4a1de8fa2a929944373d7421105500ff6f889ce90dcb883fbb2fdb070e4d427e
env:
MARIADB_USER: wptestuser
MARIADB_PASSWORD: wptestpass
MARIADB_ROOT_PASSWORD: wptestroot
MARIADB_DATABASE: wptest_minimum
TZ: Europe/Berlin
ports:
- 3306/tcp
options: --health-cmd="mariadb-admin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup PHP
id: setup-minimum-php
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # 2.31.1
with:
php-version: '7.1'
coverage: none
extensions: mysqli
- name: Install minimal test requirements
run: |
rm composer.json composer.lock
composer require --dev --no-progress "phpunit/phpunit:^6" "yoast/phpunit-polyfills:1.1.1" "brain/monkey:2.6.1"
- name: Set up integration test
run: ./bin/install-wp-tests.sh wptest_minimum wptestuser wptestpass 127.0.0.1:${{ job.services.mysql.ports['3306'] }} 5.6 true
- name: Run integration tests
run: composer exec phpunit -- -c phpunit-integration.xml --no-coverage