Skip to content

Add post-build smoke E2E against built .zip artifact#241

Merged
Mwalek merged 2 commits into
developfrom
tests/post-build-smoke
May 15, 2026
Merged

Add post-build smoke E2E against built .zip artifact#241
Mwalek merged 2 commits into
developfrom
tests/post-build-smoke

Conversation

@Mwalek
Copy link
Copy Markdown
Contributor

@Mwalek Mwalek commented May 15, 2026

Summary

  • Runs the @smoke-tagged activation suite against the packaged plugin zip in CI, gated between build_package_release and the new publish_release job — so a failed smoke now blocks the GitHub release + announcement.
  • Mirrors the canonical pipeline shape established in the sister plugin GravityExport (PR Export attached into a notification doesn't follow  #167) and originally GravityImport (PR #506).

Pipeline shape (workflow shape A)

prepare (single job) → run_e2e_tests (pre-build) / build_package_releaserun_post_build_smokepublish_release

prepare already installs deps AND writes .env, so the linear ancestor chain inherits the environment without conflict. No workspace surgery needed.

Changes

  • .circleci/config.yml
    • build_package_release: moved Collect build artifacts up, then persist_to_workspace exports both plugin/.release and the plugin/gf-entries-in-excel-*.zip glob (the latter is required because gktools release greps cwd, not .release/).
    • Added run_post_build_smoke job: machine + DLC, attaches workspace, invokes npx @gravitykit/e2e-bootstrap smoke --composer-cmd "npx @gravitykit/gktools composer install" (Composer must run inside gktools' PHP 7.4 Docker), uploads Playwright results/report + JUnit.
    • Extracted Create GitHub release + Announce build into a new publish_release job that requires: run_post_build_smoke.
    • Workflow wires run_post_build_smokebuild_package_release, publish_releaserun_post_build_smoke.
  • tests/E2E/tests/activation.spec.js — appended @smoke to the describe title so the bootstrap CLI grep picks it up.
  • package.json + package-lock.json — bumped @gravitykit/e2e-bootstrap from ^1.0.0 to ^1.1.0 (smoke subcommand). Lock diff scoped to this dep only.

Test plan

  • CircleCI workflow test_and_release runs on this branch; verify run_post_build_smoke job appears and consumes the built artifact (logs should show unzip of gf-entries-in-excel-*.zip, composer install via gktools Docker, wp-env boot, playwright test --grep=@smoke).
  • On smoke pass, publish_release runs; on smoke fail, publish_release is blocked.
  • Smoke runs only the @smoke-tagged describe (the three activation tests), not the full E2E suite.
  • tests/E2E/results/junit.xml is uploaded as test results.

Notes

  • Existing pre-build run_e2e_tests is untouched and continues to run the full suite against the source tree.
  • playwright.config.js already uses a single chromium project (no dependencies: ['chromium'] split), so no Playwright #22408 grep-bypass fix needed.
  • wp-env.config.js already hard-codes pluginPath: '../../..' (no BUILT_PLUGIN_PATH conditional); the bootstrap CLI rewrites this internally when unzipping the built artifact.

Summary by CodeRabbit

  • Tests

    • Smoke testing now runs automatically after builds to validate packaged content
    • Test organization improved with dedicated smoke test marker for activation smoke tests
  • Chores

    • CI/CD release pipeline enhanced: build artifacts are collected and persisted during the build phase
    • Added a dedicated post-build verification stage that runs against the packaged artifact before release
    • Release step now proceeds directly to creating the GitHub release (artifact collection moved earlier)
    • Testing framework dev dependency updated to ^1.1.0

Review Change Stack

💾 Build file (154e40c).

Runs the @smoke-tagged activation suite against the packaged plugin zip
in CI, after build_package_release and before publishing the release.

- Tag activation.spec.js describe with @smoke so the bootstrap CLI
  picks it up via Playwright's --grep.
- Bump @gravitykit/e2e-bootstrap to ^1.1.0 (smoke CLI subcommand).
- Persist .release and the gf-entries-in-excel-*.zip glob from
  build_package_release so downstream jobs can install the built artifact.
- Add run_post_build_smoke job: unzips the artifact, restores dev deps
  through gktools' Docker composer (PHP 7.4), boots wp-env, runs the
  smoke spec against the built plugin.
- Extract Create GitHub release + Announce build into a publish_release
  job gated on smoke success; release publishing now only happens when
  the built artifact actually activates cleanly.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 15, 2026

Walkthrough

This PR integrates post-build E2E smoke testing into the CircleCI pipeline: build collects and persists artifacts to the workspace, a new job runs @gravitykit/e2e-bootstrap smoke against those artifacts, publishing proceeds after smoke, and the E2E dependency and test are updated.

Changes

Post-Build Smoke Testing

Layer / File(s) Summary
Artifact collection in build job
.circleci/config.yml
build_package_release creates a .release dir, copies gf-entries-in-excel-*.zip, publishes artifacts, and persists plugin/.release and zip(s) to the workspace.
Post-build smoke testing job
.circleci/config.yml
New run_post_build_smoke job attaches the workspace, runs @gravitykit/e2e-bootstrap smoke, and stores E2E results and JUnit output as CircleCI artifacts.
Publish job adjustment
.circleci/config.yml
publish_release no longer collects build artifacts and proceeds to create the GitHub release and optional announcements.
Workflow orchestration
.circleci/config.yml
test_and_release workflow now runs run_post_build_smoke after build_package_release and requires it before publish_release.
E2E tooling and test labeling
package.json, tests/E2E/tests/activation.spec.js
@gravitykit/e2e-bootstrap devDependency bumped to ^1.1.0, and the activation test suite description is tagged with @smoke.

Sequence Diagram

sequenceDiagram
  participant BuildPackageRelease
  participant Workspace
  participant RunPostBuildSmoke
  participant PublishRelease
  participant GitHubRelease

  BuildPackageRelease->>Workspace: persist `plugin/.release` and `gf-entries-in-excel-*.zip`
  RunPostBuildSmoke->>Workspace: attach workspace and read artifacts
  RunPostBuildSmoke->>RunPostBuildSmoke: execute `@gravitykit/e2e-bootstrap smoke`
  RunPostBuildSmoke->>RunPostBuildSmoke: publish E2E results and JUnit artifacts
  PublishRelease->>Workspace: attach workspace (post-smoke)
  PublishRelease->>GitHubRelease: create GitHub release
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • GravityKit/GravityExport-Lite#236: Main PR's updates to the CircleCI flow to run a post-build @gravitykit/e2e-bootstrap smoke step, bump @gravitykit/e2e-bootstrap, and tag the activation.spec.js smoke test are directly aligned with the retrieved PR's E2E smoke-test infrastructure.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and specifically describes the main change: adding a post-build smoke E2E test against the built .zip artifact, which is the central feature of this PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tests/post-build-smoke

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
.circleci/config.yml (1)

137-137: 💤 Low value

Redundant working_directory declaration.

The working_directory is already set to /home/circleci/plugin in the default_job_config anchor (line 8). This explicit override is unnecessary.

♻️ Simplify by removing redundant declaration
 run_post_build_smoke:
   <<: *default_job_config
-  working_directory: /home/circleci/plugin
   machine:
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.circleci/config.yml at line 137, Remove the redundant working_directory
declaration by deleting the explicit "working_directory: /home/circleci/plugin"
entry in the job where you overrode it; the value is already provided by the
default_job_config anchor, so simply remove that line (leave the rest of the job
block and its indentation intact).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.circleci/config.yml:
- Line 125: The cp command currently swallows errors so missing artifacts don't
fail the job; edit the line that runs cp gf-entries-in-excel-*.zip .release/
2>/dev/null || true in .circleci/config.yml to remove the error suppression
(delete "2>/dev/null || true") so the step fails when no matching .zip is found,
or alternately replace it with an explicit existence check (e.g., test -e
gf-entries-in-excel-*.zip && cp ... ) so the pipeline fails fast if the
gf-entries-in-excel-*.zip artifact from the build step isn't produced.
- Around line 146-152: The comment over the "Post-build smoke" job is misleading
because the npx `@gravitykit/e2e-bootstrap` smoke command does not perform
retries; either implement CI-level retry behavior similar to the existing
run_e2e_tests job or update the comment to remove the "boots wp-env with retry"
claim. To fix, locate the "Post-build smoke" job in .circleci/config.yml where
the command uses npx `@gravitykit/e2e-bootstrap` smoke and either add a shell
retry loop with proper teardown/cleanup that mirrors run_e2e_tests' retry
pattern, or change the job comment to accurately describe that no retry is
performed and retries must be handled at the CI level.

---

Nitpick comments:
In @.circleci/config.yml:
- Line 137: Remove the redundant working_directory declaration by deleting the
explicit "working_directory: /home/circleci/plugin" entry in the job where you
overrode it; the value is already provided by the default_job_config anchor, so
simply remove that line (leave the rest of the job block and its indentation
intact).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1ad9e63d-ce38-4701-b10f-8f0f4273292a

📥 Commits

Reviewing files that changed from the base of the PR and between 11e672a and ad3a446.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (3)
  • .circleci/config.yml
  • package.json
  • tests/E2E/tests/activation.spec.js

Comment thread .circleci/config.yml Outdated
Comment thread .circleci/config.yml
Comment on lines +146 to +152
name: Post-build smoke
# Unzips .release/*.zip, restores dev deps via gktools' Docker composer,
# boots wp-env with retry, runs `playwright test --grep=@smoke` against
# the built artifact. See @gravitykit/e2e-bootstrap README for details.
command: |
npx @gravitykit/e2e-bootstrap smoke \
--composer-cmd "npx @gravitykit/gktools composer install"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check if `@gravitykit/e2e-bootstrap` smoke command handles retries internally

# Check the e2e-bootstrap package README or source for retry logic
gh repo clone gravitykit/e2e-bootstrap /tmp/e2e-bootstrap-check 2>/dev/null || true
if [ -d /tmp/e2e-bootstrap-check ]; then
  echo "=== Checking for retry logic in e2e-bootstrap ==="
  rg -i "retry|attempt" /tmp/e2e-bootstrap-check --type md --type js -C 3
fi

Repository: GravityKit/GravityExport-Lite

Length of output: 55


🏁 Script executed:

# Search for e2e-bootstrap references in the current repo to understand how it's used
rg "e2e-bootstrap" . -A 2 -B 2

Repository: GravityKit/GravityExport-Lite

Length of output: 2884


🏁 Script executed:

# Check the CircleCI config for dependency versions or references
cat -n .circleci/config.yml | sed -n '140,160p'

Repository: GravityKit/GravityExport-Lite

Length of output: 991


🌐 Web query:

@gravitykit/e2e-bootstrap smoke command retry wp-env setup

💡 Result:

The @gravitykit/e2e-bootstrap package is used in conjunction with wp-env to facilitate end-to-end (E2E) testing workflows, particularly in CI/CD environments like GitHub Actions [1]. There is no native "smoke command" or built-in "retry" flag within @gravitykit/e2e-bootstrap itself for wp-env setup. Instead, retry logic is typically implemented at the CI/CD workflow level (e.g., in.circleci/config.yml or GitHub Actions YAML) [1]. To implement a robust retry mechanism for wp-env setup, the following pattern is recommended: 1. Implement a loop in your CI configuration that attempts to run the setup command (e.g., npm run tests:e2e:setup) multiple times [1]. 2. Ensure that each retry attempt starts from a clean state. Simply deleting the local metadata directory (e.g., /home/circleci/.wp-env) is often insufficient because stale Docker containers or volumes may persist [1]. 3. The retry loop should explicitly invoke a teardown routine (such as wp-env stop or a custom npm run tests:e2e:teardown task) upon failure before attempting to clear the environment and retry [1]. For example, in a CI environment, you might structure your loop to: - Run the setup command. - If it fails, execute the teardown command. - Remove the.wp-env directory. - Sleep briefly. - Retry the setup [1]. This approach ensures that subsequent attempts do not inherit corrupted or stale configurations from failed previous runs [1].

Citations:


The comment claiming "boots wp-env with retry" is inaccurate; the @gravitykit/e2e-bootstrap smoke command does not implement retry logic internally.

Unlike run_e2e_tests (lines 62-75) which has an explicit retry loop, this job lacks retry handling for wp-env setup failures. The e2e-bootstrap package does not provide built-in retry functionality—retry logic must be implemented at the CI/CD level with proper teardown and cleanup on failure.

Consider adding a retry loop similar to run_e2e_tests, or update the comment to remove the misleading claim about retries.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.circleci/config.yml around lines 146 - 152, The comment over the
"Post-build smoke" job is misleading because the npx `@gravitykit/e2e-bootstrap`
smoke command does not perform retries; either implement CI-level retry behavior
similar to the existing run_e2e_tests job or update the comment to remove the
"boots wp-env with retry" claim. To fix, locate the "Post-build smoke" job in
.circleci/config.yml where the command uses npx `@gravitykit/e2e-bootstrap` smoke
and either add a shell retry loop with proper teardown/cleanup that mirrors
run_e2e_tests' retry pattern, or change the job comment to accurately describe
that no retry is performed and retries must be handled at the CI level.

- Remove '2>/dev/null || true' from 'cp gf-entries-in-excel-*.zip .release/'
  so the step fails loudly when the build produced no zip, instead of
  swallowing the cp error and surfacing the problem later.

- Drop the redundant 'working_directory: /home/circleci/plugin' from
  run_post_build_smoke. The default_job_config anchor already sets it;
  the duplicate was a copy-paste artifact from the prompt template.
@Mwalek Mwalek merged commit 9344b4d into develop May 15, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant