mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 06:58:56 +00:00
build_pyodide - use prebuilt pyodide build env
This commit is contained in:
@@ -14,15 +14,6 @@ jobs:
|
|||||||
submodules: recursive
|
submodules: recursive
|
||||||
path: IfcOpenShell
|
path: IfcOpenShell
|
||||||
|
|
||||||
- name: Checkout Pyodide
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
submodules: recursive
|
|
||||||
repository: pyodide/pyodide
|
|
||||||
ref: '0.28.0a3'
|
|
||||||
token: ${{ secrets.BUILD_REPO_TOKEN }}
|
|
||||||
path: pyodide
|
|
||||||
|
|
||||||
- name: Checkout Build Repository
|
- name: Checkout Build Repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
@@ -39,12 +30,9 @@ jobs:
|
|||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
VERSION=`cat IfcOpenShell/VERSION`
|
./IfcOpenShell/pyodide/build_pyodide.sh
|
||||||
sed -i s/0.8.0/$VERSION/g IfcOpenShell/pyodide/meta.yaml
|
|
||||||
sed -i s/--tty// pyodide/run_docker
|
|
||||||
pyodide/run_docker IfcOpenShell/pyodide/build_pyodide.sh
|
|
||||||
FILE=`echo dist/ifcopenshell-*.whl`
|
FILE=`echo dist/ifcopenshell-*.whl`
|
||||||
NEW_FILE=`echo $FILE | sed "s/$VERSION/$VERSION+${GITHUB_SHA:0:7}/"`
|
NEW_FILE=`echo $FILE | sed "s/-/+${GITHUB_SHA:0:7}-/2"`
|
||||||
mv $FILE $NEW_FILE
|
mv $FILE $NEW_FILE
|
||||||
|
|
||||||
- name: Upload Build Logs
|
- name: Upload Build Logs
|
||||||
|
|||||||
+4
-4
@@ -3,8 +3,8 @@ There are two ways to build pyodide ifcopenshell Python wrapper wheel.
|
|||||||
|
|
||||||
1. Using pyodide build system (`build_pyodide.yml` does it):
|
1. Using pyodide build system (`build_pyodide.yml` does it):
|
||||||
|
|
||||||
- setup pyodide environment in `pyodide_root` folder - either by using image or build it from source - see https://pyodide.org/en/stable/development/building-from-sources.html
|
- install prebuilt pyodide build and emscripten environment (see `build_pyodide.sh`)
|
||||||
- clone IfcOpenShell repo next to it to `IfcOpenShell` folder
|
- clone IfcOpenShell to `IfcOpenShell` folder
|
||||||
- create `packages/ifcopenshell` folder that will be used by pyodide build system
|
- create `packages/ifcopenshell` folder that will be used by pyodide build system
|
||||||
- from `IfcOpenShell` move building recipe `pyodide/meta.yaml` to `packages/ifcopenshell`
|
- from `IfcOpenShell` move building recipe `pyodide/meta.yaml` to `packages/ifcopenshell`
|
||||||
- run `pyodide build-recipes ifcopenshell --install`, it will
|
- run `pyodide build-recipes ifcopenshell --install`, it will
|
||||||
@@ -19,12 +19,12 @@ There are two ways to build pyodide ifcopenshell Python wrapper wheel.
|
|||||||
- copy the wheel next to `dist` folder (in root directory, next to `packages`)
|
- copy the wheel next to `dist` folder (in root directory, next to `packages`)
|
||||||
- add wheel to `dist/pyodide-lock.json`
|
- add wheel to `dist/pyodide-lock.json`
|
||||||
|
|
||||||
2. Build it outside of pyodide system.
|
2. Build it outside of pyodide build system.
|
||||||
|
|
||||||
Building inside pyodide build system should be preferred, option to build it outside is useful for debugging purposes,
|
Building inside pyodide build system should be preferred, option to build it outside is useful for debugging purposes,
|
||||||
since it's pure cmake without any additional moving parts.
|
since it's pure cmake without any additional moving parts.
|
||||||
|
|
||||||
- setup pyodide environment in `pyodide_root` folder, see above
|
- setup pyodide environment, see above
|
||||||
- clone IfcOpenShell repo next to it to `IfcOpenShell` folder
|
- clone IfcOpenShell repo next to it to `IfcOpenShell` folder
|
||||||
- setup debug build environment using `source pyodide/debug_build_env.sh /path/to/pyodide_root`
|
- setup debug build environment using `source pyodide/debug_build_env.sh /path/to/pyodide_root`
|
||||||
- run `python nix/build-all.py -wasm -py-313` in `IfcOpenShell`
|
- run `python nix/build-all.py -wasm -py-313` in `IfcOpenShell`
|
||||||
|
|||||||
@@ -1,17 +1,36 @@
|
|||||||
#!/usr/bin/bash
|
#!/usr/bin/bash
|
||||||
set -e
|
set -ex
|
||||||
cd pyodide
|
|
||||||
make
|
# Install uv.
|
||||||
cd ..
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
|
uv venv --python 3.13
|
||||||
|
source .venv/bin/activate
|
||||||
|
|
||||||
|
# Install pyodide cross build environment.
|
||||||
|
# Instructions: https://pyodide.org/en/stable/development/building-packages.html
|
||||||
|
uv pip install pyodide-build
|
||||||
|
# `uv run` is required, so xbuildenv would skip using `pip`.
|
||||||
|
uv run pyodide xbuildenv install
|
||||||
|
|
||||||
|
# Emscripten doesn't come with xbuildenv.
|
||||||
|
git clone https://github.com/emscripten-core/emsdk
|
||||||
|
pushd emsdk
|
||||||
|
PYODIDE_EMSCRIPTEN_VERSION=$(pyodide config get emscripten_version)
|
||||||
|
./emsdk install ${PYODIDE_EMSCRIPTEN_VERSION}
|
||||||
|
./emsdk activate ${PYODIDE_EMSCRIPTEN_VERSION}
|
||||||
|
source emsdk_env.sh
|
||||||
|
which emcc
|
||||||
|
popd
|
||||||
|
|
||||||
mkdir -p packages/ifcopenshell
|
mkdir -p packages/ifcopenshell
|
||||||
|
VERSION=`cat IfcOpenShell/VERSION`
|
||||||
cp IfcOpenShell/pyodide/meta.yaml packages/ifcopenshell
|
cp IfcOpenShell/pyodide/meta.yaml packages/ifcopenshell
|
||||||
# Required, otherwise pyodide will create new temp pyodide environment.
|
sed -i s/0.8.0/$VERSION/g packages/ifcopenshell/meta.yaml
|
||||||
export PYODIDE_ROOT=/src/pyodide
|
|
||||||
# Ensure emsdk tools are in PATH.
|
|
||||||
export PATH=$PYODIDE_ROOT/emsdk/emsdk:$PYODIDE_ROOT/emsdk/emsdk/node/22.16.0_64bit/bin:$PYODIDE_ROOT/emsdk/emsdk/upstream/emscripten:$PATH
|
|
||||||
# Use custom build ifcopenshell directory in build-all to make caching simpler
|
# Use custom build ifcopenshell directory in build-all to make caching simpler
|
||||||
# Otherwise pyodide build path typically includes package version, so cached cmake configs might break.
|
# Otherwise pyodide build path typically includes package version, so cached cmake configs might break.
|
||||||
export BUILD_DIR=/src/ifcopenshell_build
|
export BUILD_DIR=`readlink -f ifcopenshell_build`
|
||||||
|
|
||||||
# Use build-recipes-no-deps first, so logs would be printed to stdout.
|
# Use build-recipes-no-deps first, so logs would be printed to stdout.
|
||||||
pyodide build-recipes-no-deps ifcopenshell
|
pyodide build-recipes-no-deps ifcopenshell
|
||||||
pyodide build-recipes ifcopenshell --install
|
pyodide build-recipes ifcopenshell --install
|
||||||
|
|||||||
Reference in New Issue
Block a user