Skip to content

ci: update github workflows #19

ci: update github workflows

ci: update github workflows #19

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.event_name == 'push' && ( github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main' ) )
strategy:
matrix:
php: [ '8.1', '8.0', '7.4' ]
wordpress: [ '6.2', '6.1', '6.0', '5.9' ]
include:
- php: '8.1'
wordpress: '6.2'
extensions: 'true'
coverage: 1
# Older versions of WordPress
- php: '8.0'
wordpress: '5.8'
- php: '8.0'
wordpress: '5.7'
- php: '7.4'
wordpress: '5.8'
- php: '7.4'
wordpress: '5.7'
- php: '7.4'
wordpress: '5.6'
exclude:
- php: '7.4'
wordpress: '6.2'
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 }}
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
run: |
cp .env.dist .env
echo GIT_TOKEN=${{ secrets.GIT_TOKEN }} >> .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 }}
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
run: |
cp .env.dist .env
echo GIT_TOKEN=${{ secrets.GIT_TOKEN }} >> .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 }}
# GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
# run: |
# cp .env.dist .env
# echo GIT_TOKEN=${{ secrets.GIT_TOKEN }} >> .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 }}
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
run: |
cp .env.dist .env
echo GIT_TOKEN=${{ secrets.GIT_TOKEN }} >> .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