Skip to content

Ideas about UX and performance #187

Open
@dunglas

Description

Currently, users are encouraged to fork this repository and to set up GitHub Actions workflows in their own forks to build the static binaries they want. This causes several issues:

  1. forks are hard to maintain, they must be synced from time to time to get upstream fixes and improvements
  2. this means that every user must build PHP and all its dependencies again and again (which is slow and energy-greedy) while in most cases - except when using "micro combine" - downloading the resulting artifacts built once for every user would be good enough.

Now that static-php-cli will be distributed as a standalone executable and as a PHAR (#175, #179), I think that we can dramatically improve the user experience and performance.

Instead of forking the whole project, the user could just download the standalone binary and run a single command in its own GHA workflow to build its static PHP.

The project could also provide a standalone GitHub Action (instead of a whole workflow), similar to setup PHP or setup Go that will:

  • download pre-built SAPI binaries including all extensions from GitHub releases if no customizations are made (super-fast)
  • or download the SPC binary and build SAPIs locally if the user wants to use "micro combine" or to create a smaller binary containing less extensions

API proposal:

steps:
  - uses: crazywhalecc/setup-static-php@v1
    with:
      php-version: '8.2'
      zts: true # Optional, defaults to false
      sapi: [cli, fpm, embed, micro]
      extensions: [ opcache, sqlite ] # Optional, by default a binary containing all supported extensions will be downloaded
      combine: path/to/your/php/app/ # Optional, by default a static version of the requested SAPIs is just downloaded

In most cases, build steps will be skipped: up-to-date SAPIs can be built every night, uploaded as static-php-cli releases, and downloaded by the action. For advanced needs (custom extensions or combine), the build will still be done locally, but at least users will be sure that they are using an up-to-date version of static-php-cli. As an improvement for the custom extension or combined use case, it should also be possible to upload the content of buildroot/ to GitHub releases and let the action download and reuse up-to-date versions of .a files when doing a custom build instead of rebuilding everything.

cc @stloyd

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is neededkind/workflowIssues related to workflow or environment

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions