-
Notifications
You must be signed in to change notification settings - Fork 221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build wasm libraries separately from PHP #838
Conversation
The goal is to accelerate PHP builds to potentially handle them via GitHub actions.
# ↑ ↑ | ||
# ┌──────────┴─────────────┐ ┌──────────┴─────────────┐ | ||
# │ skip those flags when │ │ add these flags when │ | ||
# │ calling emcc │ │ calling emcc │ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adamziel Nitpick: This ascii art is broken
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
git apply --no-index /root/bison27.patch && \ | ||
./configure --prefix=/usr/local/bison --with-libiconv-prefix=/usr/local/libiconv/ && \ | ||
make && \ | ||
make install |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adamziel nitpick: Files should end in newlines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Just updated all Dockerfiles
@adamziel This looks awesome! But I notice that there are a lot of contributed files from other software packages being contributed to the repository. Do you think it would be better if we git/CURL them in during the build process? Let me know your thoughts. |
ed08c8d
to
2c517ff
Compare
This PR ships the pre-built WebAssembly output. The source code is downloaded via curl/wget. Some of the pre-built output maps 1:1 to the source code, but I'm hesitant of manually recreating parts of the build step to avoid shipping those files. I'd rather move all the pre-built files into something like GitHub releases later on – see #58. |
Rationale for this change
Separates the build pipeline of the libraries required by PHP from the build pipeline for PHP itself.
The goal is to accelerate the PHP builds. Right now, rebuilding PHP may involve rebuilding all the related libraries which takes forever and makes iterating on PHP challenging.
With this PR, PHP builds are much faster and perhaps could even be moved to GitHub actions.
Building PHP in GitHub CI
My initial attempt to recompile PHP via GitHub actions failed because the task timed out after 5 hours of rebuilding PHP dependencies. I don't think GitHub actually used Docker cache between builds, but even if it did then building the libraries took extremely long time.
With this PR,
npm run recompile:php:web:light:8.0
takes 4 – 5 minutes! This makes GitHub actions a much more viable build environment.Implementation details
This PR ships a Makefile with a task for each library. The following libraries are covered by the Makefile and shipped with this PR as pre-built binaries:
To remove the pre-built libraries on your computer, run:
cd packages/php-wasm/compile/ make clean
To rebuild the libraries on your computer, run:
cd packages/php-wasm/compile/ make all
Follow-up work
8.0.9
is shipped, but8.0.11
is available).wasm
from tracked git files into GitHub releases or any other GitHub facility that enables shipping files. This will likely require adding some kind ofnpm run update-php
local task that will automatically run when buildingwasm-wordpress-net
and after runningnpm install
.Testing instructions
cd packages/php-wasm/compile/ make clean make all
recompile:php:web
recompile:php:node
npm run dev
and confirm the local website still worksnpm run test
and confirm the unit tests still passnpm run e2e
and confirm the E2E tests still pass