Skip to content

Merge pull request #444 from justlevine/chore/misc-fixes #567

Merge pull request #444 from justlevine/chore/misc-fixes

Merge pull request #444 from justlevine/chore/misc-fixes #567

name: Integration Testing
on:
push:
branches:
- develop
- main
pull_request_target:
branches:
- develop
- main
paths:
- "**.php"
- ".github/workflows/*.yml"
- "!docs/**"
types: [ opened, synchronize, reopened, labeled ]
# Cancel previous workflow run groups that have not completed.
concurrency:
# Group workflow runs by workflow name, along with the head branch ref of the pull request
# or otherwise the branch or tag ref.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
continuous_integration:
runs-on: ubuntu-latest
name: WordPress ${{ matrix.wordpress }} on PHP ${{ matrix.php }}
if: contains(github.event.pull_request.labels.*.name, 'safe to test ✔') || github.repository == github.event.repository.full_name || github.event_name == 'push'
strategy:
matrix:
php: [ '8.2', '8.1', '8.0' ]
wordpress: [ '6.5', '6.4','6.3', '6.2']
include:
- php: '8.2'
wordpress: '6.5'
coverage: 1
- php: '8.0'
wordpress: '6.1'
- php: '8.0'
wordpress: '6.0'
- php: '7.4'
wordpress: '6.1'
- php: '7.4'
wordpress: '6.0'
exclude:
# New WP versions that dont support older PHP versions
- php: "8.0"
wordpress: "6.5"
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: json, mbstring
tools: composer:v2
- name: Install dependencies
uses: ramsey/composer-install@v3
- name: Build "testing" Docker Image
env:
PHP_VERSION: ${{ matrix.php }}
WP_VERSION: ${{ matrix.wordpress }}
GF_KEY: ${{ secrets.GF_KEY }}
run: |
cp .env.dist .env
echo GF_KEY=${{ secrets.GF_KEY }} >> .env
composer build-test
- name: Run Acceptance Tests w/ Docker
env:
COVERAGE: ${{ matrix.coverage }}
USING_XDEBUG: ${{ matrix.coverage }}
DEBUG: ${{ secrets.ACTIONS_STEP_DEBUG || matrix.debug }}
SKIP_TESTS_CLEANUP: ${{ matrix.coverage }}
SUITES: acceptance
PHP_VERSION: ${{ matrix.php }}
WP_VERSION: ${{ matrix.wordpress }}
GF_KEY: ${{ secrets.GF_KEY }}
run: |
cp .env.dist .env
echo GF_KEY=${{ secrets.GF_KEY }} >> .env
composer run-test
- name: Run Unit Tests w/ Docker
env:
COVERAGE: ${{ matrix.coverage }}
USING_XDEBUG: ${{ matrix.coverage }}
DEBUG: ${{ secrets.ACTIONS_STEP_DEBUG || matrix.debug }}
SKIP_TESTS_CLEANUP: ${{ matrix.coverage }}
SUITES: unit
PHP_VERSION: ${{ matrix.php }}
WP_VERSION: ${{ matrix.wordpress }}
GF_KEY: ${{ secrets.GF_KEY }}
run: |
cp .env.dist .env
echo GF_KEY=${{ secrets.GF_KEY }} >> .env
composer run-test
- name: Run WPUnit Tests w/ Docker
env:
COVERAGE: ${{ matrix.coverage }}
USING_XDEBUG: ${{ matrix.coverage }}
DEBUG: ${{ secrets.ACTIONS_STEP_DEBUG || matrix.debug }}
SKIP_TESTS_CLEANUP: ${{ matrix.coverage }}
PHP_VERSION: ${{ matrix.php }}
WP_VERSION: ${{ matrix.wordpress }}
GF_KEY: ${{ secrets.GF_KEY }}
run: |
cp .env.dist .env
echo GF_KEY=${{ secrets.GF_KEY }} >> .env
composer run-test
- name: Push Codecoverage to Coveralls.io
if: ${{ matrix.coverage == 1 }}
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: vendor/bin/php-coveralls -v
- name: Push CodeCoverage to CodeClimate
if: ${{ matrix.coverage == 1 }}
uses: paambaati/codeclimate-action@v5
env:
CC_TEST_REPORTER_ID: c8f992fb9d2400821643b093de584af5a3c8d0a8f1f6f4e000592ccf0270ee29
with:
coverageLocations: |
${{github.workspace}}/tests/_output/*.xml:clover