Skip to content

Commit

Permalink
Merge pull request #1 from mikkamp/dev/manual-workflow-run-unit-tests
Browse files Browse the repository at this point in the history
Dev/manual workflow run unit tests
  • Loading branch information
mikkamp authored Apr 5, 2024
2 parents 4c5e19a + 59b6a52 commit cb71c69
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ trim_trailing_whitespace = false
insert_final_newline = false
indent_size = 2
tab_width = 2

[*.yml]
indent_size = 2
indent_style = spaces
40 changes: 38 additions & 2 deletions .github/workflows/php-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,25 @@ on:
- composer.json
- composer.lock
- .github/workflows/php-unit-tests.yml
workflow_dispatch:
inputs:
php-version:
description: 'PHP Version'
default: '8.2'
wp-rc-version:
description: 'WordPress version for Release Candidate (ex. 6.5-RC3)'
default: 'latest'
wc-rc-version:
description: 'WooCommerce version for Release Candidate (ex. 8.7.0-rc.1)'
default: 'latest'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
GetMatrix:
GetMatrix:
if: github.event_name != 'workflow_dispatch'
name: Get WP and WC version Matrix
runs-on: ubuntu-latest
outputs:
Expand All @@ -39,7 +51,8 @@ jobs:
with:
slug: woocommerce

UnitTests:
UnitTests:
if: github.event_name != 'workflow_dispatch'
name: PHP unit tests - PHP ${{ matrix.php }}, WP ${{ matrix.wp-version || 'latest' }}, WC ${{ matrix.wc-versions || 'latest' }}
runs-on: ubuntu-latest
needs: GetMatrix
Expand Down Expand Up @@ -95,3 +108,26 @@ jobs:
done
git config --global --unset $URL_CONFIG
ReleaseCandidateUnitTests:
if: github.event_name == 'workflow_dispatch'
name: PHP unit tests (for Release Candidates)
runs-on: ubuntu-latest

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

- name: Prepare PHP
uses: woocommerce/grow/prepare-php@actions-v1
with:
php-version: "${{ inputs.php-version }}"

- name: Prepare MySQL
uses: woocommerce/grow/prepare-mysql@actions-v1

- name: Install WP tests
run: ./bin/install-unit-tests.sh wordpress_test root root localhost ${{ inputs.wp-rc-version }} ${{ inputs.wc-rc-version }}

- name: Run PHP unit tests
run: vendor/bin/phpunit

0 comments on commit cb71c69

Please sign in to comment.