Skip to content
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
70 changes: 0 additions & 70 deletions .github/actions/ci-setup/action.yml

This file was deleted.

56 changes: 30 additions & 26 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
name: Main PHP Version(s) CI
name: CI Setup

on:
push:
branches:
- develop
pull_request:

# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

jobs:
Expand All @@ -21,11 +18,11 @@ jobs:
php-version: [ "8.3", "8.4" ]
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Setup
id: ci-setup
uses: ./.github/actions/ci-setup
uses: thefrosty/ci-setup@main
with:
extensions: 'curl'
extensions-cache-key: run-phpcs-${{ matrix.php-version }}
Expand All @@ -48,50 +45,57 @@ jobs:
run-phpunit:
name: Run PHPUnit
runs-on: ubuntu-latest
strategy:
matrix:
php-version: [ "8.3" ]
wp-version: [ 'latest' ]
coverage: [ true ]
services:
mysql:
image: mysql:8.0
env:
MYSQL_DATABASE: wordpress_test
MYSQL_ROOT_PASSWORD: root
ports:
- 3306/tcp
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
matrix:
php-version: [ "8.3" ]
wp-versions: [ 'latest' ]
coverage: [ true ]
- "3306:3306"
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=10s --health-retries=10
env:
WORDPRESS_DB_NAME: wordpress_test
WORDPRESS_DB_PASS: root
WORDPRESS_DB_USER: root

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Install SVN
run: sudo apt-get update && sudo apt-get install -y subversion

- name: Setup
- name: Setup PHP ${{ matrix.php-version }}
id: ci-setup
uses: ./.github/actions/ci-setup
uses: thefrosty/ci-setup@main
with:
extensions: 'curl, pdo, sqlite, pdo_sqlite, mysql, mysqli, pdo_mysql, tar, zip'
extensions-cache-key: run-phpunit-${{ matrix.php-version }}
extensions: 'curl, mysql, mysqli, zip'
extensions-cache-key: run-phpunit-${{ matrix.wp-version }}-${{ matrix.php-version }}
php-version: ${{ matrix.php-version }}
token: ${{ secrets.GITHUB_TOKEN }}
tools: 'composer, phpunit'
tools: 'composer, phpunit:11'

- name: Run PHPUnit
id: phpunit
- name: Setup WordPress ${{ matrix.wp-version }}
run: |
chmod u+x vendor/thefrosty/wp-utilities/bin/install-wp-tests.sh
./vendor/thefrosty/wp-utilities/bin/install-wp-tests.sh wordpress_test root root 127.0.0.1:${{ job.services.mysql.ports['3306'] }} ${{ matrix.wp-versions }} true
composer phpunit
./vendor/thefrosty/wp-utilities/bin/install-wp-tests.sh ${{ env.WORDPRESS_DB_NAME }} ${{ env.WORDPRESS_DB_USER }} ${{ env.WORDPRESS_DB_PASS }} 127.0.0.1:${{ job.services.mysql.ports['3306'] }} ${{ matrix.wp-version }} true

- name: Run PHPUnit
continue-on-error: false
id: phpunit
run: composer phpunit
env:
CHANGED_FILES: ${{ steps.ci-setup.outputs.files }}
WORDPRESS_DB_HOST: 127.0.0.1:${{ job.services.mysql.ports['3306'] }}
DB_PORT: ${{ job.services.mysql.ports[3306] }}

- name: Upload coverage to Codecov
if: ${{ github.event_name == 'pull_request' }}
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
5 changes: 2 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Set Release Version env
run: |
VERSION=${{ github.event.release.tag_name }}
echo "Release Version: ${VERSION//v}"
echo "RELEASE_VERSION=${VERSION//v}" >> $GITHUB_ENV

# see https://github.com/shivammathur/setup-php
- name: Use PHP 8.3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.3"
Expand Down
Loading