-
Notifications
You must be signed in to change notification settings - Fork 3
Try cypress tests in parallel #252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
0875f0b
156272d
1505e1f
2a57027
5b59dfb
d357020
878276a
ec7636c
8fe3d32
7bd1fa6
33c968e
da56658
48e3a44
a938988
d3a3a10
5b3e252
396debf
25c428a
fa2d879
5c902ce
b9fed32
c1c5672
96e289d
367e62c
6144c59
f66118f
3a94227
3e24d31
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,203 @@ | ||
name: Parallel Cypress Tests | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- master | ||
- trunk | ||
- develop | ||
- release/* | ||
- feature/* | ||
- add/* | ||
- update/* | ||
- fix/* | ||
- try/* | ||
pull_request: | ||
types: [opened, edited, reopened, ready_for_review] | ||
workflow_dispatch: | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} | ||
cancel-in-progress: true | ||
permissions: | ||
pull-requests: write | ||
|
||
jobs: | ||
build: | ||
name: Build Plugin | ||
runs-on: ubuntu-24.04 | ||
outputs: | ||
dist: ${{ steps.workflow.outputs.DIST }} | ||
package: ${{ steps.workflow.outputs.PACKAGE }} | ||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
Comment on lines
+33
to
+34
Check warningCode scanning / zizmor credential persistence through GitHub Actions artifacts Warning
credential persistence through GitHub Actions artifacts
|
||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@9e72090525849c5e82e596468b86eb55e9cc5401 # v2.32.0 | ||
with: | ||
php-version: '8.1' | ||
coverage: none | ||
tools: composer | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0 | ||
with: | ||
node-version: 20.x | ||
|
||
- name: Show versions | ||
run: | | ||
php --version | ||
composer --version | ||
node --version | ||
npm --version | ||
|
||
- name: Validate composer.json and composer.lock files | ||
run: composer validate | ||
|
||
- name: Install PHP Dependencies | ||
uses: ramsey/composer-install@a2636af0004d1c0499ffca16ac0b4cc94df70565 # v3.1.0 | ||
with: | ||
composer-options: "--no-dev --optimize-autoloader --verbose" | ||
|
||
- name: Install JS Dependencies | ||
run: npm ci --legacy-peer-deps | ||
|
||
- name: Build JavaScript | ||
run: npm run build | ||
|
||
- name: Setup workflow context | ||
id: workflow | ||
working-directory: ${{ runner.temp }} | ||
env: | ||
REPO: ${{ github.repository }} | ||
run: | | ||
mkdir dist | ||
echo "DIST=${PWD}/dist" >> $GITHUB_OUTPUT | ||
echo "PACKAGE=bluehost-wordpress-plugin" >> $GITHUB_OUTPUT | ||
|
||
- name: Create Distribution Copy | ||
run: rsync -r --include-from=.distinclude --exclude-from=.distignore . ${{ steps.workflow.outputs.DIST }}/${{ steps.workflow.outputs.PACKAGE }} | ||
Check failureCode scanning / octoscan Expression injection, "steps..outputs." is potentially untrusted. Error
Expression injection, "steps.**.outputs.**" is potentially untrusted.
Check noticeCode scanning / zizmor code injection via template expansion Note
code injection via template expansion
Check noticeCode scanning / zizmor code injection via template expansion Note
code injection via template expansion
|
||
|
||
- name: List Distribution Files | ||
working-directory: ${{ steps.workflow.outputs.DIST }} | ||
Check failureCode scanning / octoscan Expression injection, "steps..outputs." is potentially untrusted. Error
Expression injection, "steps.**.outputs.**" is potentially untrusted.
|
||
run: find . | ||
|
||
- name: Upload distribution artifact | ||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | ||
with: | ||
path: ${{ steps.workflow.outputs.dist }} | ||
name: ${{ steps.workflow.outputs.package }} | ||
|
||
test: | ||
name: Test (${{ matrix.containers }}) | ||
needs: build | ||
runs-on: ubuntu-24.04 | ||
timeout-minutes: 20 | ||
strategy: | ||
# when one test fails, DO NOT cancel the other | ||
# containers, because this will kill Cypress processes | ||
# leaving Cypress Cloud hanging ... | ||
# https://github.com/cypress-io/github-action/issues/48 | ||
fail-fast: false | ||
matrix: | ||
# run 4 parallel containers to speed up the tests | ||
# https://docs.cypress.io/guides/guides/parallelization#Parallelization | ||
containers: [1, 2, 3, 4] | ||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
Comment on lines
+109
to
+110
Check warningCode scanning / zizmor credential persistence through GitHub Actions artifacts Warning
credential persistence through GitHub Actions artifacts
|
||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@9e72090525849c5e82e596468b86eb55e9cc5401 # v2.32.0 | ||
with: | ||
php-version: '8.1' | ||
coverage: none | ||
tools: composer | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0 | ||
with: | ||
node-version: 20.x | ||
|
||
- name: Show versions | ||
run: | | ||
php --version | ||
composer --version | ||
node --version | ||
npm --version | ||
|
||
- name: Validate composer.json and composer.lock files | ||
run: composer validate | ||
|
||
- name: Install PHP Dependencies | ||
uses: ramsey/composer-install@a2636af0004d1c0499ffca16ac0b4cc94df70565 # v3.1.0 | ||
with: | ||
composer-options: "--no-dev --optimize-autoloader --verbose" | ||
|
||
- name: Install JS Dependencies | ||
run: npm ci --legacy-peer-deps | ||
|
||
- name: Setup workflow context | ||
id: workflow | ||
working-directory: ${{ runner.temp }} | ||
env: | ||
REPO: ${{ github.repository }} | ||
run: | | ||
mkdir dist | ||
echo "DIST=${PWD}/dist" >> $GITHUB_OUTPUT | ||
|
||
- name: Download plugin into dist directory | ||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | ||
with: | ||
path: ${{ steps.workflow.outputs.DIST }} | ||
name: ${{ needs.build.outputs.PACKAGE }} | ||
|
||
- name: Configure WordPress | ||
run: echo '{"plugins":["${{ steps.workflow.outputs.DIST }}/${{ needs.build.outputs.PACKAGE }}"]}' > .wp-env.override.json | ||
Check failureCode scanning / octoscan Expression injection, "steps..outputs." is potentially untrusted. Error
Expression injection, "steps.**.outputs.**" is potentially untrusted.
Check noticeCode scanning / zizmor code injection via template expansion Note
code injection via template expansion
Check noticeCode scanning / zizmor code injection via template expansion Note
code injection via template expansion
|
||
|
||
- name: Start WordPress | ||
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2 | ||
with: | ||
timeout_minutes: 4 | ||
max_attempts: 3 | ||
command: npx wp-env start --debug | ||
|
||
- name: Run Cypress Tests (Container ${{ matrix.containers }}) | ||
uses: cypress-io/github-action@0ee1130f05f69098ab5c560bd198fecf5a14d75b # v6.9.0 | ||
with: | ||
record: true | ||
parallel: true | ||
group: parallel | ||
publish-summary: true | ||
tag: bluehost | ||
# plugin tests, module tests, nested module tests | ||
spec: | | ||
tests/cypress/integration/**/*.cy.js | ||
vendor/newfold-labs/**/tests/cypress/integration/*.cy.js | ||
vendor/newfold-labs/**/tests/cypress/integration/**/*.cy.js | ||
env: | ||
# pass the Cypress Cloud record key as an environment variable | ||
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | ||
# Recommended: pass the GitHub token lets this action correctly | ||
# determine the unique run id necessary to re-run the checks | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Store screenshots of test failures | ||
if: ${{ failure() }} | ||
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 | ||
with: | ||
path: ./tests/cypress/screenshots | ||
name: ${{ needs.build.outputs.PACKAGE }}-${{ matrix.containers }}-screenshots | ||
|
||
- name: Output debug.log file contents | ||
if: ${{ always() }} | ||
continue-on-error: true | ||
run: npx wp-env run wordpress cat /var/www/html/wp-content/debug.log | ||
|
||
- name: Output wordpress docker logs | ||
if: always() | ||
continue-on-error: true | ||
run: | | ||
npx wp-env logs --watch=false --debug=true |
Check failure
Code scanning / zizmor
overly broad permissions Error