Skip to content

Merge pull request #2 from Flutterwave/dev #3

Merge pull request #2 from Flutterwave/dev

Merge pull request #2 from Flutterwave/dev #3

Workflow file for this run

name: Tests
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: tests-${{ github.ref }}
cancel-in-progress: true
env:
MIN_COVERAGE: 90
# Unit tests mock Magento, so the PHP extensions a full Magento install needs are not required.
COMPOSER_OPTIONS: --ignore-platform-req=ext-* --no-scripts
jobs:
component:
name: ${{ matrix.component }} (coverage >= 90%)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
component: [Block, Controller, Gateway, Model]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
coverage: pcov
tools: composer:v2
- name: Install dependencies
uses: ramsey/composer-install@v3
with:
dependency-versions: highest
composer-options: ${{ env.COMPOSER_OPTIONS }}
- name: Run ${{ matrix.component }} tests
run: vendor/bin/phpunit --testsuite "${{ matrix.component }}" --coverage-clover "build/coverage/${{ matrix.component }}.xml"
- name: Enforce ${{ env.MIN_COVERAGE }}% line coverage
shell: bash
run: |
set -o pipefail
{
echo "### ${{ matrix.component }} coverage"
echo '```'
php Test/coverage-check.php "build/coverage/${{ matrix.component }}.xml" "$MIN_COVERAGE" "${{ matrix.component }}"
echo '```'
} | tee -a "$GITHUB_STEP_SUMMARY"
- name: Upload coverage report
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.component }}
path: build/coverage/${{ matrix.component }}.xml
if-no-files-found: ignore
compatibility:
name: PHP ${{ matrix.php }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Each PHP version resolves to the newest Magento framework release that supports it.
php: ['8.1', '8.2', '8.3', '8.4']
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
tools: composer:v2
- name: Install dependencies
uses: ramsey/composer-install@v3
with:
dependency-versions: highest
composer-options: ${{ env.COMPOSER_OPTIONS }}
- name: Run full test suite
run: vendor/bin/phpunit