-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'trunk' into fix/89-phpcs-sniffs
- Loading branch information
Showing
37 changed files
with
4,336 additions
and
3,143 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,31 @@ | ||
<!-- Source of this Pull Request. Remove any that are not applicable. --> | ||
### All Submissions: | ||
|
||
**Issue**: # | ||
|
||
**Ticket**: | ||
|
||
**Slack Thread**: | ||
<!-- Mark completed items with an [x] --> | ||
* [ ] Does your code follow the [WooCommerce Sniffs](https://github.com/woocommerce/woocommerce-sniffs/) variant of WordPress coding standards? | ||
* [ ] Have you written new tests for your changes, as applicable? | ||
* [ ] Have you successfully run tests with your changes locally? | ||
* [ ] Will this change require new documentation or changes to existing documentation? | ||
|
||
--- | ||
|
||
### Description | ||
|
||
<!-- Describe the changes made in this Pull Request and the reason for these changes. --> | ||
|
||
### Steps to Test | ||
|
||
<!-- Describe the steps to replicate the issue and confirm the fix. --> | ||
<!-- Include as many details as possible. --> | ||
### Changes proposed in this Pull Request: | ||
<!-- Describe the changes made to this Pull Request and the reason for such changes. --> | ||
|
||
1. Go to '…' | ||
2. Click on '…' | ||
3. Scroll down to …' | ||
|
||
### Documentation | ||
|
||
<!-- Will this change require new documentation or changes to existing documentation? --> | ||
<!-- A good way to answer it is to ask: will more than one customer ever need to know about this? --> | ||
- [ ] This PR needs documentation (has the "Documentation" label). | ||
<!-- For an extra 💯 include further details about which change requires documentation. --> | ||
Closes # . | ||
|
||
### Changelog Entry | ||
### Steps to test the changes in this Pull Request: | ||
<!-- Describe the steps to replicate the issue and confirm the fix --> | ||
<!-- Try to include as many details as possible. --> | ||
|
||
> Enter a summary of all changes on this Pull Request. This will appear in the changelog if accepted. | ||
1. | ||
1. | ||
1. | ||
|
||
Closes # . | ||
### Changelog entry | ||
<!-- | ||
Each line should start with change type prefix`(Add|Fix|Dev) - `. | ||
If you remove the "Changelog entry" header, the Pull Request title will be used as the changelog entry. | ||
Add the `changelog: none` label if no changelog entry is needed. | ||
--> | ||
|
||
> Add - Enter a summary of all changes on this Pull Request. This will appear in the changelog if accepted. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Basic set up for three package managers | ||
# - Disables version-updates | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: 'github-actions' | ||
directory: '/' | ||
schedule: | ||
interval: 'weekly' | ||
# Disable version updates for GitHub Actions dependencies | ||
open-pull-requests-limit: 0 | ||
labels: | ||
- "changelog: none" | ||
- "type: dependency" | ||
- "github_actions" | ||
|
||
# Maintain dependencies for npm | ||
- package-ecosystem: 'npm' | ||
directory: '/' | ||
schedule: | ||
interval: 'weekly' | ||
# Disable version updates for npm dependencies | ||
open-pull-requests-limit: 0 | ||
labels: | ||
- "changelog: none" | ||
- "type: dependency" | ||
- "javascript" | ||
|
||
# Maintain dependencies for Composer | ||
- package-ecosystem: 'composer' | ||
directory: '/' | ||
schedule: | ||
interval: 'weekly' | ||
# Disable version updates for Composer dependencies | ||
open-pull-requests-limit: 0 | ||
labels: | ||
- "changelog: none" | ||
- "type: dependencies" | ||
- "php" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
name: E2E test | ||
|
||
on: | ||
push: | ||
branches: | ||
- smoke-testing | ||
pull_request: | ||
types: [ opened, synchronize, reopened, labeled ] | ||
branches: | ||
- trunk | ||
|
||
jobs: | ||
e2e: | ||
if: "${{ ( github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'needs: e2e testing') ) || github.event_name == 'push' }}" | ||
name: E2E Test | ||
runs-on: ubuntu-latest | ||
env: | ||
PAYFAST_MERCHANT_ID: ${{secrets.PAYFAST_MERCHANT_ID}} | ||
PAYFAST_MERCHANT_KEY: ${{secrets.PAYFAST_MERCHANT_KEY}} | ||
PAYFAST_PASSPHRASE: ${{secrets.PAYFAST_PASSPHRASE}} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: '.nvmrc' | ||
|
||
- name: Node cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
node_modules | ||
~/.npm | ||
key: node-${{ hashFiles('package-lock.json') }} | ||
|
||
- name: Node install | ||
run: npm install | ||
|
||
- name: Build | ||
run: npm run build | ||
|
||
- name: Install Playwright Browsers | ||
run: npx playwright install chromium | ||
|
||
- name: Install required WP plugins | ||
run: | | ||
URL_CONFIG="url.https://${{ secrets.BOT_GITHUB_TOKEN }}:[email protected]/.insteadOf [email protected]:" | ||
git config --global $URL_CONFIG | ||
npm run env:install-plugins | ||
git config --global --unset $URL_CONFIG | ||
- name: Setup WP environment | ||
run: npm run env:start | ||
|
||
- name: Run E2E Foundational Test | ||
id: payfast_e2e_tests | ||
if: ${{ github.event_name == 'pull_request' }} | ||
run: npm run test:e2e-foundational | ||
|
||
- name: Update Success Label | ||
if: | | ||
always() && | ||
steps.payfast_e2e_tests.conclusion == 'success' | ||
uses: actions/github-script@v6 | ||
continue-on-error: true | ||
with: | ||
script: | | ||
github.rest.issues.removeLabel({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
name: ['needs: e2e testing'] | ||
}) | ||
github.rest.issues.addLabels({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
labels: ['status: e2e tests passing'] | ||
}) | ||
- name: Update Failure Label | ||
if: | | ||
always() && | ||
steps.payfast_e2e_tests.conclusion == 'failure' | ||
uses: actions/github-script@v6 | ||
continue-on-error: true | ||
with: | ||
script: | | ||
github.rest.issues.removeLabel({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
name: ['needs: testing'] | ||
}) | ||
github.rest.issues.addLabels({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
labels: ['status: e2e tests failing'] | ||
}) | ||
- name: Run E2E Smoke Test | ||
if: ${{ github.event_name == 'push' }} | ||
run: npm run test:e2e | ||
|
||
- uses: actions/upload-artifact@v3 | ||
if: always() | ||
with: | ||
name: playwright-report | ||
path: tests/e2e/test-results/report | ||
retention-days: 2 |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: PHP Compatibility | ||
|
||
on: pull_request | ||
|
||
jobs: | ||
php-compatibility: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup proper PHP version | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 7.3 | ||
tools: composer | ||
|
||
- name: Validate composer.json and composer.lock | ||
run: composer validate --strict | ||
|
||
- name: Get composer cache directory | ||
id: composer-cache | ||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | ||
|
||
- name: Cache dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
|
||
- name: Install dependencies | ||
run: composer install | ||
|
||
- name: Run PHP Compatibility | ||
run: ./vendor/bin/phpcs --standard=phpcs-compat.xml.dist -p . |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: PHP Coding Standards | ||
|
||
on: pull_request | ||
|
||
jobs: | ||
phpcs: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup proper PHP version | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 7.3 | ||
tools: composer | ||
|
||
- name: Validate composer.json and composer.lock | ||
run: composer validate --strict | ||
|
||
- name: Get composer cache directory | ||
id: composer-cache | ||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | ||
|
||
- name: Cache dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
|
||
- name: Get changed files | ||
id: changed-files | ||
uses: tj-actions/changed-files@v35 | ||
with: | ||
files: | | ||
**/*.php | ||
- name: Install dependencies | ||
if: ${{ steps.changed-files.outputs.any_changed == 'true' }} | ||
run: composer install | ||
|
||
- name: Run PHP_CodeSniffer | ||
if: ${{ steps.changed-files.outputs.any_changed == 'true' }} | ||
run: | | ||
HEAD_REF=$(git rev-parse HEAD) | ||
git checkout $HEAD_REF | ||
./vendor/bin/phpcs-changed -s --git --git-base origin/${{ github.base_ref }} ${{ steps.changed-files.outputs.all_changed_files }} |
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
Oops, something went wrong.