Merge pull request #35 from Abraham-Flutterwave/master #27
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Review changes on Dev (Commits/PRs) | |
on: | |
push: | |
branches: ['master'] | |
pull_request: | |
branches: ['dev'] | |
types: [opened, synchronize, reopened] | |
env: | |
WC_MIN_SUPPORTED_VERSION: '7.4.1' | |
WP_MIN_SUPPORTED_VERSION: '6.0' | |
PHP_MIN_SUPPORTED_VERSION: '7.4' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
generate-wc-compat-matrix: | |
name: "Generate the matrix for woocommerce compatibility dynamically" | |
runs-on: ubuntu-20.04 | |
outputs: | |
matrix: ${{ steps.generate_matrix.outputs.matrix }} | |
steps: | |
- name: "Generate matrix" | |
id: generate_matrix | |
run: | | |
WC_VERSIONS=$( echo "[\"$WC_MIN_SUPPORTED_VERSION\", \"latest\", \"beta\"]" ) | |
MATRIX_INCLUDE=$( echo "[{\"woocommerce\":\"$WC_MIN_SUPPORTED_VERSION\",\"wordpress\":\"$WP_MIN_SUPPORTED_VERSION\",\"gutenberg\":\"13.6.0\",\"php\":\"$PHP_MIN_SUPPORTED_VERSION\"}]" ) | |
echo "matrix={\"woocommerce\":$WC_VERSIONS,\"wordpress\":[\"latest\"],\"gutenberg\":[\"latest\"],\"php\":[\"7.4\"], \"include\":$MATRIX_INCLUDE}" >> $GITHUB_OUTPUT | |
woocommerce-compatibility: | |
name: "WC compatibility" | |
needs: generate-wc-compat-matrix | |
runs-on: ubuntu-20.04 | |
env: | |
WP_VERSION: ${{ matrix.wordpress }} | |
WC_VERSION: ${{ matrix.woocommerce }} | |
GUTENBERG_VERSION: ${{ matrix.gutenberg }} | |
strategy: | |
fail-fast: false | |
max-parallel: 10 | |
matrix: ${{ fromJSON(needs.generate-wc-compat-matrix.outputs.matrix) }} | |
steps: | |
# clone the repository | |
- uses: actions/checkout@v3 | |
# enable dependencies caching | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.cache/composer/ | |
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }} | |
# setup PHP, but without debug extensions for reasonable performance | |
- uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
tools: composer | |
coverage: xdebug | |
# run CI checks | |
- run: bash bin/run-ci-tests.bash | |
# report to codecov | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODE_COV_TOKEN }} | |
files: ./coverage.xml | |
verbose: true | |
generate-wc-compat-beta-matrix: | |
name: "Generate the matrix for compatibility-woocommerce-beta dynamically" | |
runs-on: ubuntu-20.04 | |
outputs: | |
matrix: ${{ steps.generate_matrix.outputs.matrix }} | |
steps: | |
- name: "Generate matrix" | |
id: generate_matrix | |
run: | | |
PHP_VERSIONS=$( echo "[\"$PHP_MIN_SUPPORTED_VERSION\", \"8.0\", \"8.1\"]" ) | |
echo "matrix={\"woocommerce\":[\"beta\"],\"wordpress\":[\"latest\"],\"gutenberg\":[\"latest\"],\"php\":$PHP_VERSIONS}" >> $GITHUB_OUTPUT | |
# a dedicated job, as allowed to fail | |
compatibility-woocommerce-beta: | |
name: Environment - WC beta | |
needs: generate-wc-compat-beta-matrix | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJSON(needs.generate-wc-compat-beta-matrix.outputs.matrix) }} | |
env: | |
WP_VERSION: ${{ matrix.wordpress }} | |
WC_VERSION: ${{ matrix.woocommerce }} | |
GUTENBERG_VERSION: ${{ matrix.gutenberg }} | |
steps: | |
# clone the repository | |
- uses: actions/checkout@v3 | |
# enable dependencies caching | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.cache/composer/ | |
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }} | |
# setup PHP, but without debug extensions for reasonable performance | |
- uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
tools: composer | |
coverage: none | |
# Check if php version is greater than 8.0 and install phpunit 9 | |
- uses: ./.github/actions/check-php-version-phpunit-support | |
with: | |
php-version: ${{ matrix.php }} | |
# run CI checks | |
- run: bash bin/run-ci-tests.bash | |
phpcs: | |
name: PHPCS | |
strategy: | |
matrix: | |
operating-system: [ 'ubuntu-latest' ] | |
php-versions: ['7.4','8.0' ,'8.1' ] | |
phpunit-versions: ['7.5.20','latest'] | |
runs-on: ${{ matrix.operating-system }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: "Validate composer.json and composer.lock" | |
run: composer validate --strict | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
ini-values: "memory_limit=1G" | |
coverage: none | |
tools: cs2pr | |
- name: Install Composer dependencies | |
uses: "ramsey/composer-install@v2" | |
- name: Run PHPCS checks | |
continue-on-error: true | |
run: vendor/bin/phpcs --ignore=*/tests/*,*/data/*,*/assets/* --report-full --report-checkstyle=./phpcs-report.xml | |
- name: Git Blame | |
continue-on-error: true | |
run: vendor/bin/phpcs -s --report=gitblame --ignore=*/tests/*,*/data/*,*/assets/* . | |
- name: Show PHPCS results in PR | |
run: cs2pr ./phpcs-report.xml | |
- name: Run WordPress Checks | |
continue-on-error: true | |
run: composer run standards:check | |
- name: Run WooCommerce Checks | |
continue-on-error: true | |
run: composer run woocommerce:check |