Skip to content
Open
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
101 changes: 97 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,116 @@ anchors:
machine:
image: default

test_job_config: &test_job_config
<<: *context
requires:
- prepare_test_and_build_environment

jobs:
build_package_release:
prepare_test_and_build_environment:
<<: *default_job_config
steps:
- checkout
- run: date +%F > .date
- run:
name: Getting GK test/build tools
command: |
git clone git@github.com:GravityKit/Tooling.git /home/circleci/tooling
- run:
name: Create .npmrc
command: |
echo "//npm.pkg.github.com/:_authToken=${GH_AUTH_TOKEN}" >> ~/.npmrc
echo "@gravitykit:registry=https://npm.pkg.github.com" >> ~/.npmrc
Comment on lines +28 to +31
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 | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

git ls-files | grep -E "\.circleci|circleci"

Repository: GravityKit/Dashboard-Views

Length of output: 90


🏁 Script executed:

cat -n .circleci/config.yml | head -100

Repository: GravityKit/Dashboard-Views

Length of output: 4772


🌐 Web query:

CircleCI persist_to_workspace paths root configuration documentation

💡 Result:

In CircleCI config, persist_to_workspace has two required keys:

  • root: a directory on the container that becomes the workspace root for this step. It can be an absolute path or relative to working_directory. [1]
  • paths: a list of files/globs or directories to upload, interpreted relative to root (the workspace root). It must not be the workspace root itself (so paths: ['.'] is invalid if root is .). Patterns use Go’s filepath.Match globbing rules. [1]

Minimal example (persist one file created under workspace/):

- persist_to_workspace:
    root: workspace
    paths:
      - echo-output

A downstream job then downloads the entire workspace and copies it into the directory you choose via attach_workspace:

- attach_workspace:
    at: /tmp/workspace

So the file above becomes available at /tmp/workspace/echo-output. [2]

Sources: CircleCI configuration reference (persist_to_workspace, attach_workspace) [1]; CircleCI “Using workspaces to share data between jobs” guide (end-to-end example) [2].


🏁 Script executed:

cat -n .circleci/config.yml | tail -50

Repository: GravityKit/Dashboard-Views

Length of output: 2668


🏁 Script executed:

# Check for any other setup that creates files in /home/circleci root
rg "home/circleci|~/" .circleci/config.yml -A 2 -B 2

Repository: GravityKit/Dashboard-Views

Length of output: 3975


Remove paths: - . from persist_to_workspace as it violates CircleCI's documented constraint.

CircleCI's configuration reference explicitly states that persist_to_workspace.paths must not reference the workspace root itself. With root: /home/circleci and paths: - ., the configuration attempts to persist the root directory, which is unsupported and will fail.

Beyond the constraint violation, this persists unintended files: the .npmrc file containing the auth token, the .env file with license keys, temporary .tmp artifacts, and other temporary state. Persist only the directories needed downstream (plugin and tooling), and generate the E2E-specific .env inside run_e2e_tests instead.

Suggested change
      - persist_to_workspace:
          root: /home/circleci
          paths:
-           - .
+           - plugin
+           - tooling

Also applies to: 54-57 (move .env creation to run_e2e_tests), 67-70 (workspace paths)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.circleci/config.yml around lines 28 - 31, The persist_to_workspace
configuration currently uses paths: - . which attempts to persist the workspace
root and leaks secrets and temp files; update the persist_to_workspace entries
(the workspace persistence steps) to remove paths: - . and instead list only the
needed directories (e.g., plugin and tooling) so only those folders are passed
between jobs, and move creation of the E2E-specific .env (currently created
earlier alongside the Create .npmrc step) into the run_e2e_tests job so the auth
token/.env are not persisted; ensure all workspace persistence blocks (the ones
that currently include '.') are updated consistently and that run_e2e_tests
generates the .env before using it.

- restore_cache:
key: node-dependencies-{{ checksum "package-lock.json" }}
keys:
- node-dependencies-{{ .Environment.CACHE_VERSION }}-{{ checksum "package-lock.json" }}
- restore_cache:
keys:
- composer-dependencies-{{ .Environment.CACHE_VERSION }}-{{ checksum "composer.lock" }}
- run:
name: Installing dependencies
command: |
/home/circleci/tooling/build-tools/build_tools.sh npm -o install
/home/circleci/tooling/build-tools/build_tools.sh composer -o "install --no-dev"
/home/circleci/tooling/build-tools/build_tools.sh composer -o install
- run:
name: Configure E2E environment
command: |
# GravityForms — required by every GK plugin
/home/circleci/tooling/build-tools/build_tools.sh gh -o 'release download -R gravityforms/gravityforms --clobber --pattern "*.zip" --dir .tmp'
unzip .tmp/gravityforms*.zip -d .tmp
# GravityView — Dashboard Views hooks into `gravityview/loaded` to register Foundation,
# so without GravityView active the GK licenses admin page is never registered and the
# license activation smoke test cannot find the product card.
/home/circleci/tooling/build-tools/build_tools.sh gh -o 'release download -R GravityKit/GravityView --clobber --pattern "gravityview-*.zip" --dir .tmp'
unzip .tmp/gravityview-*.zip -d .tmp
Comment on lines +47 to +53
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 | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, let's look at the .circleci/config.yml file and the specific lines mentioned
cat -n .circleci/config.yml | sed -n '40,60p'

Repository: GravityKit/Dashboard-Views

Length of output: 1701


🏁 Script executed:

# Also check the broader context around those lines
cat -n .circleci/config.yml | sed -n '1,70p'

Repository: GravityKit/Dashboard-Views

Length of output: 3497


🌐 Web query:

gh release download default version no tag specified cli.github.com

💡 Result:

With gh release download, the positional argument is the release tag. If you don’t specify a tag, GitHub CLI targets the repo’s latest release, but it requires you to also provide either --pattern or --archive. [1]

Examples:

  • Download a specific asset (or assets) from the latest release:
gh release download --pattern '*.deb'

This works because omitting <tag> means “latest release”. [1]

  • Download the source archive for the latest release:
gh release download --archive=zip

[1]

  • Download all assets from the latest release (by first resolving the latest tag, then downloading by tag):
tag="$(gh release view --json tagName --jq .tagName)"
gh release download "$tag"

gh release view shows the latest release when no tag is provided, and tagName is available via --json. [2]

Sources:
[1] gh release download manual (GitHub CLI)
[2] gh release view manual (GitHub CLI)


🏁 Script executed:

# Search for GRAVITYFORMS_RELEASE and GRAVITYVIEW_RELEASE in the config
rg 'GRAVITYFORMS_RELEASE|GRAVITYVIEW_RELEASE' .circleci/config.yml

Repository: GravityKit/Dashboard-Views

Length of output: 52


🏁 Script executed:

# Check if there are any environment variable definitions in the config
grep -n "env:" .circleci/config.yml | head -20

Repository: GravityKit/Dashboard-Views

Length of output: 52


🏁 Script executed:

# Look for any variables section or environment setup
cat -n .circleci/config.yml | grep -A 5 -B 5 "variables:\|environment:"

Repository: GravityKit/Dashboard-Views

Length of output: 1258


🏁 Script executed:

# Search the entire repo for GRAVITYFORMS_RELEASE or GRAVITYVIEW_RELEASE
rg 'GRAVITYFORMS_RELEASE|GRAVITYVIEW_RELEASE' --type yml --type yaml --type md

Repository: GravityKit/Dashboard-Views

Length of output: 97


🏁 Script executed:

# Check the README or any documentation for E2E setup
find . -maxdepth 2 -name "README*" -o -name "*.md" | head -10

Repository: GravityKit/Dashboard-Views

Length of output: 81


🏁 Script executed:

# Search more broadly for these variables
rg 'GRAVITYFORMS_RELEASE|GRAVITYVIEW_RELEASE'

Repository: GravityKit/Dashboard-Views

Length of output: 52


🏁 Script executed:

# Check the README for E2E setup instructions
cat readme.md | grep -A 10 -B 5 -i "gravityforms\|gravityview\|e2e\|release"

Repository: GravityKit/Dashboard-Views

Length of output: 1106


🏁 Script executed:

# Check if there's a .env.sample mentioned in config
cat -n .env.sample 2>/dev/null | head -30

Repository: GravityKit/Dashboard-Views

Length of output: 677


🏁 Script executed:

# Check CircleCI documentation/scripts to see if there's any release pinning mechanism
find . -name "*.sh" -o -name "*circleci*" | head -20

Repository: GravityKit/Dashboard-Views

Length of output: 81


🏁 Script executed:

# Look for any other CircleCI configuration files that might define variables
find . -path "./.circleci*" -type f

Repository: GravityKit/Dashboard-Views

Length of output: 92


🌐 Web query:

gh release download tag syntax --pattern example

💡 Result:

gh release download syntax:

  • With an explicit tag:
    gh release download <tag> [--pattern <glob> ...]
  • Without a tag (downloads “latest” release): you must pass either --pattern or --archive. [1]

--pattern takes glob patterns (you can repeat it):

# Download all assets from tag v1.2.3
gh release download v1.2.3
# Download only matching assets from the latest release
gh release download --pattern '*.deb'
# Multiple patterns
gh release download -p '*.deb' -p '*.rpm'
# Filter assets from a specific tag
gh release download v1.2.3 --pattern '*linux*amd64*.tar.gz'

[1]


Pin the upstream plugin releases used by E2E.

gh release download pulls assets from the latest release when no tag is provided. These two downloads will drift as GravityForms or GravityView publish new releases, so the smoke suite can start failing on unrelated upstream changes and become hard to reproduce. Pass explicit release tags/versions into both commands instead of relying on "latest."

Suggested change
+            : "${GRAVITYFORMS_RELEASE:?Missing GRAVITYFORMS_RELEASE}"
+            : "${GRAVITYVIEW_RELEASE:?Missing GRAVITYVIEW_RELEASE}"
-            /home/circleci/tooling/build-tools/build_tools.sh gh -o 'release download -R gravityforms/gravityforms --clobber --pattern "*.zip" --dir .tmp'
+            /home/circleci/tooling/build-tools/build_tools.sh gh -o "release download ${GRAVITYFORMS_RELEASE} -R gravityforms/gravityforms --clobber --pattern '*.zip' --dir .tmp"
             unzip .tmp/gravityforms*.zip -d .tmp
-            /home/circleci/tooling/build-tools/build_tools.sh gh -o 'release download -R GravityKit/GravityView --clobber --pattern "gravityview-*.zip" --dir .tmp'
+            /home/circleci/tooling/build-tools/build_tools.sh gh -o "release download ${GRAVITYVIEW_RELEASE} -R GravityKit/GravityView --clobber --pattern 'gravityview-*.zip' --dir .tmp"
             unzip .tmp/gravityview-*.zip -d .tmp
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/home/circleci/tooling/build-tools/build_tools.sh gh -o 'release download -R gravityforms/gravityforms --clobber --pattern "*.zip" --dir .tmp'
unzip .tmp/gravityforms*.zip -d .tmp
# GravityView — Dashboard Views hooks into `gravityview/loaded` to register Foundation,
# so without GravityView active the GK licenses admin page is never registered and the
# license activation smoke test cannot find the product card.
/home/circleci/tooling/build-tools/build_tools.sh gh -o 'release download -R GravityKit/GravityView --clobber --pattern "gravityview-*.zip" --dir .tmp'
unzip .tmp/gravityview-*.zip -d .tmp
: "${GRAVITYFORMS_RELEASE:?Missing GRAVITYFORMS_RELEASE}"
: "${GRAVITYVIEW_RELEASE:?Missing GRAVITYVIEW_RELEASE}"
/home/circleci/tooling/build-tools/build_tools.sh gh -o "release download ${GRAVITYFORMS_RELEASE} -R gravityforms/gravityforms --clobber --pattern '*.zip' --dir .tmp"
unzip .tmp/gravityforms*.zip -d .tmp
# GravityView — Dashboard Views hooks into `gravityview/loaded` to register Foundation,
# so without GravityView active the GK licenses admin page is never registered and the
# license activation smoke test cannot find the product card.
/home/circleci/tooling/build-tools/build_tools.sh gh -o "release download ${GRAVITYVIEW_RELEASE} -R GravityKit/GravityView --clobber --pattern 'gravityview-*.zip' --dir .tmp"
unzip .tmp/gravityview-*.zip -d .tmp
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.circleci/config.yml around lines 47 - 53, The GH release download commands
for GravityForms and GravityView currently omit explicit tags, causing them to
fetch the latest release and drift; update the two invocations of build_tools.sh
(the commands that call "gh -o 'release download -R gravityforms/gravityforms
...'" and "gh -o 'release download -R GravityKit/GravityView ...'") to include
explicit release tags/versions (e.g., use shell variables like GF_TAG/GV_TAG or
hardcoded tags) passed into the 'release download -R ... --clobber --pattern ...
--dir ...' arguments so the E2E job consistently downloads pinned artifact
versions.

cp .env.sample .env
sed -i "s|WP_ENV_PLUGINS=.*|WP_ENV_PLUGINS=${PWD}/.tmp/gravityforms,${PWD}/.tmp/gravityview|" .env
sed -i "s|GRAVITY_FORMS_LICENSE_KEY=.*|GRAVITY_FORMS_LICENSE_KEY=${GRAVITYFORMS_KEY}|" .env
sed -i "s|GRAVITYKIT_LICENSE_KEY=.*|GRAVITYKIT_LICENSE_KEY=${GRAVITYVIEW_KEY}|" .env
- save_cache:
key: node-dependencies-{{ checksum "package-lock.json" }}
key: node-dependencies-{{ .Environment.CACHE_VERSION }}-{{ checksum "package-lock.json" }}
paths:
- node_modules
- save_cache:
key: composer-dependencies-{{ .Environment.CACHE_VERSION }}-{{ checksum "composer.lock" }}
paths:
- vendor
- vendor_prefixed
- persist_to_workspace:
root: /home/circleci
paths:
- .

run_e2e_tests:
<<: *default_job_config
parallelism: 1
resource_class: xlarge
steps:
- attach_workspace:
at: /home/circleci
- run:
name: Run E2E tests
command: |
attempt=0
max_attempts=3
sleep_time=5
while [ $attempt -lt $max_attempts ]; do
npm run tests:e2e:setup && break
attempt=$(( attempt + 1 ))
rm -rf /home/circleci/.wp-env
echo "Retrying WP-ENV setup in $sleep_time seconds… (attempt $attempt/$max_attempts)"
sleep $sleep_time
done
if [ $attempt -eq $max_attempts ]; then
echo "WP-ENV setup failed."
exit 1
fi
TESTFILES=$(circleci tests glob "tests/E2E/tests/**/*.spec.js")
echo "$TESTFILES" | circleci tests run --command="xargs npx playwright test --config=tests/E2E/setup/playwright.config.js" --verbose
- store_artifacts:
path: tests/E2E/results
- store_artifacts:
path: tests/E2E/report
- store_test_results:
path: tests/E2E/results/junit.xml
Comment on lines +102 to +103
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

store_test_results expects a directory path, not a file.

CircleCI's store_test_results requires a directory containing test result files, not a direct file path. The current path tests/E2E/results/junit.xml should be changed to the directory.

Proposed fix
       - store_test_results:
-          path: tests/E2E/results/junit.xml
+          path: tests/E2E/results
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.circleci/config.yml around lines 96 - 97, The CircleCI job uses
store_test_results with a file path; change the value under store_test_results
(the store_test_results key) to the directory containing the results (e.g.,
"tests/E2E/results" or "tests/E2E/results/") instead of
"tests/E2E/results/junit.xml" so CircleCI can collect all test result files.


build_package_release:
<<: *default_job_config
environment:
# Disable husky pre-commit hooks during CI. `package_build` makes a
# git commit, which fires .husky/pre-commit → lint-staged →
# `vendor/bin/phpcs`. Since `composer install --no-dev` strips phpcs
# (it is a dev dependency), the hook fails with ENOENT and CI dies.
# This bug has existed on develop since CI was first configured —
# see GravityKit/Dashboard-Views#29 for the full root-cause analysis.
HUSKY: "0"
steps:
- attach_workspace:
at: /home/circleci
- run:
name: Building
command: |
/home/circleci/tooling/build-tools/build_tools.sh composer -o "install --no-dev"
/home/circleci/tooling/build-tools/build_tools.sh grunt
- run:
name: Trigger translation pipeline
Expand Down Expand Up @@ -77,5 +164,11 @@ workflows:
version: 2
test_and_package:
jobs:
- prepare_test_and_build_environment:
<<: *context
- run_e2e_tests:
<<: *test_job_config
- build_package_release:
<<: *context
requires:
- run_e2e_tests
12 changes: 12 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Comma-separated absolute paths to extra plugins to mount into the wp-env test environment.
# Example: WP_ENV_PLUGINS=/path/to/gravityforms
WP_ENV_PLUGINS=

# License keys injected into the test environment.
GRAVITY_FORMS_LICENSE_KEY=
GRAVITYKIT_LICENSE_KEY=

# Optional tunables
# E2E_KEEP_DATA=0 Skip cleanup of test data between runs.
# USE_LOCAL_BROWSER=0 Use local Chromium instead of the Docker Playwright container.
# SLOW_MO=0 Slow down Playwright actions by N milliseconds (useful for debugging).
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
.DS_Store
node_modules
vendor
vendor_prefixed
.sass-cache
build
.env

# E2E Testing
tests/E2E/setup/.wp-env.json
tests/E2E/setup/.state.json
tests/E2E/setup/.e2e-ports.json
tests/E2E/results/
tests/E2E/report/
Loading