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
18 changes: 17 additions & 1 deletion .distignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,20 @@ playwright.config.js
/node_modules
/vendor
rave-payment-forms.zip

/client
eslint.config.cjs
phpcs.xml.dist
phpunit.xml.dist
phpunit-integration.xml.dist
.npmpackagejsonlintrc.json
/coverage
/playwright-report
/test-results
/.phpunit.cache
# Old integrations scaffolding, replaced by includes/integrations/class-flw-integrations.php.
src/Integrations
includes/integrations/class-flw-thirdparty-integrations.php
views/admin-integrations-page.php
assets/css/admin
assets/js/admin
/test-reports
17 changes: 0 additions & 17 deletions .env.e2e.example

This file was deleted.

12 changes: 0 additions & 12 deletions .eslintignore

This file was deleted.

22 changes: 0 additions & 22 deletions .eslintrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion .github/actions/make-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ runs:
env:
RELEASE_FILENAME: 'rave-payment-forms.zip'
run: |
npm install
npm ci
npm run build

if [[ ! -f $RELEASE_FILENAME ]]; then
Expand Down
60 changes: 0 additions & 60 deletions .github/workflows/change-review.yml

This file was deleted.

157 changes: 157 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
name: CI

on:
push:
branches: ['master', 'dev']
pull_request:

permissions:
contents: read

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

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
with:
php-version: '8.3'
coverage: none
tools: cs2pr
- uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: .nvmrc
cache: npm
- run: npm ci --ignore-scripts
- name: PHP coding standards
run: vendor/bin/phpcs -q --report=checkstyle | cs2pr
- name: JavaScript
run: npm run lint:js
- name: CSS
run: npm run lint:css
- name: package.json
run: npm run lint:pkg-json
- name: JavaScript unit tests
run: npm run test:js
- name: Build admin app
run: npm run build:admin

audit:
name: Dependency audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
with:
php-version: '8.3'
coverage: none
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: .nvmrc
- name: npm audit
run: npm audit --audit-level=moderate
- name: composer audit
run: composer audit --locked

unit:
name: Unit (PHP ${{ matrix.php }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['7.4', '8.1', '8.3', '8.4', '8.5']
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
with:
php-version: ${{ matrix.php }}
coverage: ${{ matrix.php == '8.3' && 'xdebug' || 'none' }}
- uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
- name: Run unit tests
if: matrix.php != '8.3'
run: vendor/bin/phpunit --testsuite unit
- name: Run unit tests with coverage
if: matrix.php == '8.3'
run: vendor/bin/phpunit --testsuite unit --coverage-text

integration:
name: Integration (WP ${{ matrix.wp }}, PHP ${{ matrix.php }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- wp: latest
php: '8.3'
- wp: latest
php: '7.4'
- wp: '6.4'
php: '8.1'
env:
WP_ENV_PHP_VERSION: ${{ matrix.php }}
# '' is falsy in expressions, so the branch must be the && operand, not the || fallback.
WP_ENV_CORE: ${{ matrix.wp != 'latest' && format('WordPress/WordPress#{0}-branch', matrix.wp) || '' }}
# Only the tests site is used here; the EDD and GiveWP activation in .wp-env.json is for e2e.
WP_ENV_LIFECYCLE_SCRIPT_AFTER_START: wp-env run tests-cli wp plugin activate rave-payment-forms
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
with:
php-version: '7.4'
coverage: none
- uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: .nvmrc
cache: npm
- run: npm ci --ignore-scripts
# build/ is not committed; without it the admin app tests are skipped.
- run: npm run build:admin
# wp-env activates every listed plugin on start, and EDD/GiveWP require newer WordPress than the matrix floor.
- run: |
echo '{ "plugins": [] }' > .wp-env.override.json
- run: npm run env:start
- run: npm run test:integration

e2e:
name: End-to-end
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
with:
php-version: '7.4'
coverage: none
- uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
with:
composer-options: '--no-dev'
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: .nvmrc
cache: npm
- run: npm ci --ignore-scripts
# build/ is not committed; the admin screens and blocks need it.
- run: npm run build:admin
- run: npm run test:e2e:install
- run: npm run env:start
- run: npm run test:e2e
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
id: report
if: always()
with:
name: playwright-report
path: |
playwright-report
test-reports
test-results
retention-days: 7
if-no-files-found: warn
- name: Summary
if: always()
run: node tests/e2e/report/summary.js test-reports/e2e-results.json "${{ steps.report.outputs.artifact-url }}" >> "$GITHUB_STEP_SUMMARY"
71 changes: 71 additions & 0 deletions .github/workflows/e2e-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: E2E report

# A weekly end-to-end run with a report, so breakage from new WordPress or
# browser releases shows up even in weeks without commits.
on:
schedule:
# Fridays at 12:00 UTC. GitHub schedules always run in UTC: for 12:00
# West Africa Time (UTC+1) use '0 11 * * 5'. Schedules only run on the
# default branch.
- cron: '0 12 * * 5'
workflow_dispatch:

permissions:
contents: read

concurrency:
group: e2e-report
cancel-in-progress: false

jobs:
e2e-report:
name: End-to-end report
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
with:
php-version: '7.4'
coverage: none
- uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
with:
composer-options: '--no-dev'
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: .nvmrc
cache: npm
- run: npm ci --ignore-scripts
- run: npm run build:admin
- run: npm run test:e2e:install
- run: npm run env:start

# Keep going when tests fail so the report is still published.
- name: Run end-to-end tests
id: e2e
continue-on-error: true
run: npm run test:e2e

- name: Upload report
id: report
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: e2e-report-${{ github.run_number }}
path: |
playwright-report
test-reports
test-results
retention-days: 30
if-no-files-found: warn

- name: Write the job summary
if: always()
run: node tests/e2e/report/summary.js test-reports/e2e-results.json "${{ steps.report.outputs.artifact-url }}" >> "$GITHUB_STEP_SUMMARY"

# Mark the run red after the report is out, so failures still notify.
- name: Fail when tests failed
if: steps.e2e.outcome == 'failure'
run: |
echo "::error::End-to-end tests failed. See the job summary and the e2e-report-${{ github.run_number }} artifact."
exit 1
Loading
Loading