Skip to content

Build codecept.phar with Box and attach it to GitHub releases - #6960

Merged
W0rma merged 2 commits into
Codeception:mainfrom
W0rma:phar-build-box
Nov 17, 2026
Merged

W0rma merged 2 commits into
Codeception:mainfrom
W0rma:phar-build-box

Conversation

@W0rma

@W0rma W0rma commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Build codecept.phar with Box and attach it to GitHub releases

Up to now the phar was built by hand with Robo in codeception.github.com. This PR builds it automatically in this repo with Box and
uploads it to the GitHub release. The Robo build stays as a manual fallback.

Changes

  • phar/build.sh <tag> builds the phar from git archive <tag>, so export-ignore rules apply. It bundles the same modules as the Robo build plus laravel-zero/phar-updater, resolves dependencies for PHP 8.2.0, and ignores ext-apcu, ext-mongodb and ext-phalcon.
  • phar/box.json uses the same stub as before (Phar::mapPhar('codecept.phar')) and per-file GZ compression.
    • Vendor code is compacted. Files from codeception/* (core and modules) are added unchanged, because their docblocks are read at runtime (@part, generated actor actions).
    • Instead of a file-type whitelist, the phar includes everything except docs, Composer metadata, dev tool configs and test/benchmark/demo folders. A whitelist had dropped the shell completion scripts of symfony/console, which broke every command.
    • The Box requirement checker is off so optional extensions don't become hard requirements. Composer's optimized autoloader is used instead of Box's authoritative classmap.
  • .github/workflows/phar.yml runs on release: published and on workflow_dispatch with a tag input (for backfills). It builds the phar, smoke-tests it in an empty directory (--version, bootstrap, build, run), and uploads codecept.phar and codecept.phar.sha256 with gh release upload --clobber.
  • .gitattributes: /phar is export-ignored.

Notes

  • Security blocking is temporarily turned off for composer update: module-ftp depends on a phpseclib version with a security advisory (Add support for phpseclib v3 and v4 module-ftp#12 already fixed that but a new release is still missing).
  • On a release event the build config (build.sh, box.json) comes from the release tag. With workflow_dispatch it comes from the selected branch. That's needed for older tags that don't contain it, and for rebuilding a release after fixing the build config.
  • Only tags like 5.3.7 are accepted. A pre-release or v-prefixed tag makes the workflow fail without attaching a phar. Could be added if we want to start creating tags for release candidates etc.
  • Switching self-update to GitHub releases is planned for a separate PR.

Testing

Follow-ups

  • Attach the phar to the 5.3.7 release in this repo: Actions → phar → Run workflow with tag: 5.3.7
  • Switch self-update to GitHub releases (phar-updater GithubStrategy), separate PR
  • Keep self-update working for phars already installed: they fetch https://codeception.com/php80/codecept.version and codecept.phar, so these must stay current or point to the latest GitHub release
  • Point the download links on codeception.com (quickstart.html, builds.markdown, thanks*.html, docs/reference/Commands.md) to
    https://github.com/Codeception/Codeception/releases/latest/download/codecept.phar
  • Remove COMPOSER_NO_SECURITY_BLOCKING from phar/build.sh once module-ftp allows a phpseclib version without security advisories (see above, a new release for codeception/module-ftp is necessary)
  • Remove the Robo phar build (buildPhar82, package/) from codeception/codeception.github.com once a few releases have been built by this workflow

Generated with Claude Code

Fixes #6864

The phar is built by phar/build.sh from `git archive <tag>`, bundled with
the same modules as the Robo build in codeception.github.com. The workflow
runs on published releases and via workflow_dispatch for backfills.

Codeception and module files are added uncompacted because their docblocks
are read at runtime (@part, generated actor actions).
The extension whitelist dropped runtime resources such as the shell
completion scripts of symfony/console, which broke every command. Now all
files are included except documentation and development metadata, so
resources of bundled packages cannot go missing unnoticed.
@W0rma
W0rma merged commit aa2b1e5 into Codeception:main Nov 17, 2026
10 checks passed
@W0rma
W0rma deleted the phar-build-box branch November 17, 2026 21:24
W0rma added a commit to W0rma/Codeception that referenced this pull request Nov 19, 2026
self-update read codecept.phar and codecept.version from
codeception.com/php80/, which hasn't been updated since 5.1. The phar is
now attached to GitHub releases (Codeception#6960), so self-update uses those.

GithubReleaseStrategy reads the released versions from Packagist and
updates to the newest release which
- is stable and newer than the installed version,
- has the same major version,
- supports the running PHP version (require.php of the release),
- has a phar attached (releases still being built are skipped).

The download is verified against the codecept.phar.sha256 of the release.
W0rma added a commit to W0rma/codeception.github.com that referenced this pull request Nov 19, 2026
The phar is now built automatically and attached to GitHub releases
(Codeception/Codeception#6960), so link downloads there and remove the
local phar build tasks.
W0rma added a commit to W0rma/codeception.github.com that referenced this pull request Nov 19, 2026
The phar is now built automatically and attached to GitHub releases
(Codeception/Codeception#6960), so link downloads there and remove the
local phar build tasks.
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.

Missing Builds on Homepage

2 participants