CircleCI Orb


#CircleCI Orb

#Introduction

The PrestaFlow CircleCI Orb runs your PrestaFlow test suites in CircleCI. It is a straight port of the GitHub Action and the GitLab CI/CD component — same inputs, same upload endpoint on the backend (POST /ci/github-action, provider-agnostic), same PR/MR comment format. Optionally boot a full PrestaShop Flashlight instance, execute your suite, upload the report (with error and visual-regression screenshots), and post the run summary on the pull request.

#Installation

Copied!
1version: 2.1
2orbs:
3 prestaflow: prestaflow/prestaflow@1.0.0

While iterating, use the dev channel:

Copied!
1orbs:
2 prestaflow: prestaflow/prestaflow@volatile

#Quick start

The opinionated one-job wrapper prestaflow/test covers the 90% case:

Copied!
1version: 2.1
2orbs:
3 prestaflow: prestaflow/prestaflow@1.0.0
4 
5workflows:
6 test:
7 jobs:
8 - prestaflow/test:
9 project_id: pk_01ABCDEFGHIJKLMNOPQR
10 flashlight: true
11 ps_version: "9.0.0"
12 context: prestaflow

Provide PRESTAFLOW_TOKEN (and optionally GITHUB_TOKEN / BITBUCKET_ACCESS_TOKEN for PR comments) as environment variables in the CircleCI project or an org context.

#Compose your own job

Copied!
1version: 2.1
2orbs:
3 prestaflow: prestaflow/prestaflow@1.0.0
4 
5jobs:
6 test:
7 executor: prestaflow/machine
8 steps:
9 - checkout
10 - prestaflow/push:
11 project_id: pk_01ABCDEFGHIJKLMNOPQR
12 flashlight: true
13 ps_version: "9.0.0"
14 suites: "BackOffice,FrontOffice"
15 
16workflows:
17 test:
18 jobs:
19 - test

#Executors

Executor Base When to use
prestaflow/default cimg/php:8.3 (docker) Pure test-upload flow. No Flashlight.
prestaflow/machine ubuntu-2404:current (machine) Required when flashlight: true — Docker bind mounts from the checkout are not supported inside setup_remote_docker.

#Parameters reference (prestaflow/push)

Parameter Default Description
api_url "https://api.prestaflow.io" PrestaFlow API base URL.
token PRESTAFLOW_TOKEN (env var name) Env var holding the PrestaFlow API token.
project_id "" PrestaFlow project Product Key (pk_...). Optional if the token is scoped.
execute true Run composer run prestaflow:json:file before upload.
suites "" Comma-separated suite list (empty = all).
flashlight false Start a PrestaShop Flashlight Docker instance. Requires the machine executor.
ps_version "latest" Flashlight image tag (9.0.0, 8.1.7, latest).
flashlight_mount "auto" auto | root | modules | themes. Where the workspace is mounted inside PrestaShop.
flashlight_init_scripts "" Path (absolute or relative to the workspace) to a dir of init scripts, mounted at /tmp/init-scripts read-only.
pr_comment "" (auto) Post/update the PR comment. Auto: true when CIRCLE_PULL_REQUEST is set, false otherwise.
github_token GITHUB_TOKEN (env var name) Token used for PR comments on github.com projects.
bitbucket_token BITBUCKET_ACCESS_TOKEN (env var name) Token used for PR comments on bitbucket.org projects.
upload_artifacts true Store results.json + screenshots as CircleCI artifacts.
visual true Enable the visual-regression round-trip (download baselines before, upload actual/diff after).
install_deps true Install curl/jq/git/bash (and composer if execute=true) up-front. Disable to bring your own image.

#Required environment variables

Variable Required for Notes
PRESTAFLOW_TOKEN Uploading results Set in project or context. Passed via the token param.
GITHUB_TOKEN PR comments on github.com Personal access token with repo:write. CircleCI does not inject one automatically — you must create it.
BITBUCKET_ACCESS_TOKEN PR comments on bitbucket.org Repository access token with pull-request write.

The comment-pr step detects the provider from CIRCLE_PULL_REQUEST and picks the matching token; if it can't find one, it prints a warning and skips (never fails the job).

#Outputs

The push command writes prestaflow.env in the job workspace and exports each value into BASH_ENV, so any subsequent step in the same job can consume them as environment variables:

Variable Description
PRESTAFLOW_REPORT_ID PrestaFlow report ID.
PRESTAFLOW_REPORT_URL URL of the report on prestaflow.io.
PRESTAFLOW_PASSED Number of passing tests.
PRESTAFLOW_FAILED Number of failing tests.
PRESTAFLOW_SKIPPED Number of skipped tests.
PRESTAFLOW_TOTAL Total number of tests.
PRESTAFLOW_DURATION_MS Total execution duration in milliseconds.
PRESTAFLOW_STATUS success if failed==0, else failure.

To share them across jobs, use persist_to_workspace on prestaflow.env and attach_workspace + source prestaflow.env in the downstream job.

#Commands

Command Purpose
prestaflow/push Full pipeline: flashlight (opt) → visual-download → run-tests → upload → comment-pr → set-outputs → artifacts.
prestaflow/flashlight Boot PrestaShop Flashlight and export PRESTAFLOW_FO_URL.
prestaflow/run-tests composer run prestaflow:json:file.
prestaflow/visual-download Fetch baseline manifest for the branch, download PNGs.
prestaflow/visual-upload No-op (visual PNGs travel with upload); kept for symmetry.
prestaflow/upload POST results.json + screenshots to the API. Sets PRESTAFLOW_REPORT_*.
prestaflow/comment-pr Post/update the PR summary comment. Provider-detected.
prestaflow/set-outputs Parse results.json, export counters, exit non-zero on failures.
prestaflow/install-deps Install curl/jq/git/bash (and optionally composer).

#Publishing (maintainer notes)

Copied!
1# Pack and lint locally
2circleci orb pack src/ > orb.yml
3circleci orb validate orb.yml
4 
5# First-time dev publish (requires namespace + token)
6circleci orb publish orb.yml prestaflow/prestaflow@dev:first
7 
8# Promote to production on a tag
9git tag v0.1.0 && git push --tags
10circleci orb publish orb.yml prestaflow/prestaflow@0.1.0

CI (.circleci/config.yml) uses circleci/orb-tools to lint, pack, review, and publish. Production releases fire on v*.*.* tags via the orb-publishing context.

#Behavior differences vs the GitHub Action

The port is behavior-for-behavior with a few platform-imposed changes:

  1. PR-comment auth. The GitHub Action uses the auto-injected GITHUB_TOKEN. CircleCI does not inject one, so you must provide GITHUB_TOKEN (github.com) or BITBUCKET_ACCESS_TOKEN (bitbucket.org) as a project or context variable.
  2. Executor for Flashlight. The GitHub Action uses docker service actions; the GitLab component uses docker:dind. CircleCI's setup_remote_docker forbids bind mounts from the job workspace, so flashlight: true requires the machine executor.
  3. Outputs. The Action sets step outputs via core.setOutput. CircleCI has no such API, so outputs are exported via BASH_ENV for the current job and written to prestaflow.env for persist_to_workspace handoff.
  4. PR detection. The Action uses github.event.pull_request. CircleCI exposes CIRCLE_PULL_REQUEST (a URL). The orb parses the URL for the PR number and the provider host.

Everything else — inputs, Flashlight boot, visual round-trip, results upload, comment marker format (<!-- prestaflow-run:<projectKey> -->) — matches the GitHub Action.

#Troubleshooting

  • flashlight: true fails on the docker executor — use prestaflow/machine. Bind mounts from the checkout are not supported inside setup_remote_docker.
  • PR comment not posted — CircleCI does not inject a GITHUB_TOKEN. Create one (or BITBUCKET_ACCESS_TOKEN for bitbucket.org projects) as a project or context env var. Without it, the orb warns and continues.
  • Outputs missing in a downstream job — outputs are exported via BASH_ENV for the current job only. To share across jobs, use persist_to_workspace on prestaflow.env and source it with attach_workspace in the next job.
  • Flashlight not ready after 240000ms — see the GitHub Action troubleshooting section; the same causes and remedies apply.