-
Notifications
You must be signed in to change notification settings - Fork 308
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add code to generate a Python baseline snapshot
- Loading branch information
Showing
3 changed files
with
75 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
name: Make Python Baseline Snapshot | ||
|
||
permissions: | ||
id-token: write # This is required for requesting the JWT | ||
contents: read # This is required for actions/checkout | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
description: The release tag/version string | ||
dry-run: | ||
description: Actually upload or just test build step? | ||
default: false | ||
type: boolean | ||
push: | ||
branches: | ||
- 'hoodmane/pyodide-load-from-file' | ||
|
||
jobs: | ||
version: | ||
outputs: | ||
version: ${{ steps.echo.outputs.version }} | ||
# version job uses ubuntu 24.04, this way we don't have to install the updated clang while | ||
# the build job uses 20.04 for libc compatibility. | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- id: echo | ||
run: | | ||
echo "::set-output name=version::1.$(cat src/workerd/io/supported-compatibility-date.txt | tr -d '-').0" | ||
build: | ||
runs-on: ubuntu-20.04 | ||
name: build Python runtime | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
show-progress: false | ||
- name: Setup Linux | ||
if: runner.os == 'Linux' | ||
run: | | ||
export DEBIAN_FRONTEND=noninteractive | ||
wget https://apt.llvm.org/llvm.sh | ||
sed -i '/apt-get install/d' llvm.sh | ||
chmod +x llvm.sh | ||
sudo ./llvm.sh 15 | ||
sudo apt-get install -y --no-install-recommends clang-15 lld-15 libunwind-15 libc++abi1-15 libc++1-15 libc++-15-dev | ||
echo "build:linux --action_env=CC=/usr/lib/llvm-15/bin/clang --action_env=CXX=/usr/lib/llvm-15/bin/clang++" >> .bazelrc | ||
echo "build:linux --host_action_env=CC=/usr/lib/llvm-15/bin/clang --host_action_env=CXX=/usr/lib/llvm-15/bin/clang++" >> .bazelrc | ||
- name: Configure download mirrors | ||
shell: bash | ||
run: | | ||
if [ ! -z "${{ secrets.WORKERS_MIRROR_URL }}" ] ; then | ||
# Strip comment in front of WORKERS_MIRROR_URL, then substitute secret to use it. | ||
sed -e '/WORKERS_MIRROR_URL/ { s@# *@@; s@WORKERS_MIRROR_URL@${{ secrets.WORKERS_MIRROR_URL }}@; }' -i.bak WORKSPACE | ||
fi | ||
- name: Bazel build | ||
# Strip debug info here – we don't generate debug info but some is pulled in from external | ||
# static libraries, for example the Rust STL. This is equivalent to the -Wl,-S linker | ||
# option, symbols will not be removed. | ||
run: | | ||
bazelisk build --config=release_linux @workerd//src/workerd/server:workerd | ||
cd samples/pyodide | ||
../../bazel-bin/src/workerd/server/workerd test config.capnp \ | ||
--python-save-baseline-snapshot \ | ||
--pyodide-package-disk-cache-dir=save_dir \ | ||
| tee log.txt | ||
cat log.txt | grep inputs.tag | ||
cp save_dir/snapshot.bin pyodide_${{ inputs.tag }}.capnp.bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters