-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TST Add integration tests for building recipes (#16)
This adds an integration test for `pyodide-build`, which builds a few selected recipes. Unlike unit test, integration tests are not run in CI by default. So users ned to run it locally, or include `[integration]` in the commit message to trigger the test. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
fac0109
commit e73f75e
Showing
10 changed files
with
231 additions
and
1 deletion.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
all: | ||
@echo "Please specify a target" | ||
@exit 1 | ||
|
||
.PHONY: test-recipe | ||
test-recipe: check | ||
@echo "... Running integration tests for building recipes" | ||
|
||
pyodide build-recipes --recipe-dir=recipes --force-rebuild "*" | ||
|
||
@echo "... Passed" | ||
|
||
.PHONY: check | ||
check: | ||
@echo "... Checking dependencies" | ||
|
||
@which pyodide > /dev/null || (echo "pyodide-build is not installd"; exit 1) | ||
@which emsdk > /dev/null || (echo "emscripten is not installed"; exit 1) | ||
|
||
@echo "... Passed" | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf .pyodide-xbuildenv* | ||
rm -rf recipes/*/build | ||
rm -rf dist |
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,11 @@ | ||
This directory contains assets to run integration tests for pyodide-build. | ||
|
||
Tests in this directory are not run by default in CI. To run these tests, add `[integration]` in the commit message. | ||
|
||
## Running integration tests locally | ||
|
||
To run the integration tests locally, use `make` command in this directory. | ||
|
||
```bash | ||
make test-recipe | ||
``` |
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,13 @@ | ||
This directory contains a few curated recipes to test the build process of pyodide-build. | ||
|
||
### List of recipes and their purpose | ||
|
||
- numpy: The most popular and widely used library in the scientific computing community. | ||
- orjson: Tests rust extension modules. | ||
- zlib: Tests static libraries. | ||
- geos: Tests shared libraries. | ||
|
||
### For maintainers | ||
|
||
- Do not put too many recipes in this directory. It is meant to be a small collection of recipes that are representative of the build process. | ||
- The recipes in this directory is originally copied from `pyodide/pyodide`. It does not need to be updated frequently unless there is a change in the build process. |
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,28 @@ | ||
package: | ||
name: geos | ||
version: 3.12.1 | ||
tag: | ||
- library | ||
source: | ||
url: https://github.com/libgeos/geos/releases/download/3.12.1/geos-3.12.1.tar.bz2 | ||
sha256: d6ea7e492224b51193e8244fe3ec17c4d44d0777f3c32ca4fb171140549a0d03 | ||
|
||
build: | ||
type: shared_library | ||
script: | | ||
LDFLAGS="${SIDE_MODULE_LDFLAGS}" emcmake cmake \ | ||
-DDISABLE_GEOS_INLINE=ON \ | ||
-DBUILD_TESTING=OFF \ | ||
-DBUILD_BENCHMARKS=OFF \ | ||
-DBUILD_DOCUMENTATION=OFF \ | ||
-DBUILD_GEOSOP=OFF \ | ||
-DCMAKE_C_FLAGS="-fPIC" \ | ||
-DCMAKE_CXX_FLAGS="-fPIC" \ | ||
-DCMAKE_INSTALL_PREFIX=${WASM_LIBRARY_DIR} \ | ||
./ | ||
emmake make -j ${PYODIDE_JOBS:-3} | ||
emmake make install | ||
mkdir -p dist | ||
cp ${WASM_LIBRARY_DIR}/lib/libgeos* dist/ |
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,33 @@ | ||
package: | ||
name: numpy | ||
version: 1.26.4 | ||
tag: | ||
- min-scipy-stack | ||
top-level: | ||
- numpy | ||
source: | ||
url: https://files.pythonhosted.org/packages/65/6e/09db70a523a96d25e115e71cc56a6f9031e7b8cd166c1ac8438307c14058/numpy-1.26.4.tar.gz | ||
sha256: 2a02aba9ed12e4ac4eb3ea9421c420301a0c6460d9830d74a9df87efa4912010 | ||
|
||
build: | ||
# numpy uses vendored meson, so we need to pass the cross file manually | ||
backend-flags: | | ||
setup-args=-Dallow-noblas=true | ||
setup-args=--cross-file=${MESON_CROSS_FILE} | ||
# numpy creates numpy/distutils/__pycache__ directory during the build. | ||
# It breaks our test because there is a .pyc in the directory. | ||
post: | | ||
rm -rf numpy/distutils/__pycache__ | ||
cflags: | | ||
-Wno-return-type | ||
cross-build-env: true | ||
cross-build-files: | ||
- numpy/core/include/numpy/numpyconfig.h | ||
- numpy/core/include/numpy/_numpyconfig.h | ||
- numpy/core/lib/libnpymath.a | ||
- numpy/random/lib/libnpyrandom.a | ||
about: | ||
home: https://www.numpy.org | ||
PyPI: https://pypi.org/project/numpy | ||
summary: NumPy is the fundamental package for array computing with Python. | ||
license: BSD |
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,20 @@ | ||
package: | ||
name: orjson | ||
version: 3.10.1 | ||
top-level: | ||
- orjson | ||
source: | ||
url: https://files.pythonhosted.org/packages/f5/af/0daa12a907215a5af6d97db8adf301ef14a1b1c651f7e176ee04e0998433/orjson-3.10.1.tar.gz | ||
sha256: a883b28d73370df23ed995c466b4f6c708c1f7a9bdc400fe89165c96c7603204 | ||
requirements: | ||
executable: | ||
- rustup | ||
build: | ||
script: export RUSTFLAGS="-Z link-native-libraries=yes" | ||
about: | ||
home: https://github.com/ijl/orjson | ||
PyPI: https://pypi.org/project/orjson | ||
summary: | ||
Fast, correct Python JSON library supporting dataclasses, datetimes, and | ||
numpy | ||
license: Apache-2.0 OR MIT |
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,25 @@ | ||
package: | ||
name: zlib | ||
version: 1.3.1 | ||
tag: | ||
- library | ||
source: | ||
sha256: 9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23 | ||
url: https://github.com/madler/zlib/releases/download/v1.3.1/zlib-1.3.1.tar.gz | ||
|
||
build: | ||
type: static_library | ||
script: | | ||
mkdir -p "build" | ||
pushd "build" | ||
LDFLAGS="${SIDE_MODULE_LDFLAGS}" emcmake cmake \ | ||
-DBUILD_TESTING=OFF \ | ||
-DBUILD_BENCHMARKS=OFF \ | ||
-DBUILD_DOCUMENTATION=OFF \ | ||
-DCMAKE_C_FLAGS="-fPIC -Wno-deprecated-non-prototype" \ | ||
-DCMAKE_CXX_FLAGS="-fPIC -Wno-deprecated-non-prototype" \ | ||
-DCMAKE_INSTALL_PREFIX=${WASM_LIBRARY_DIR} \ | ||
../ | ||
emmake make -j ${PYODIDE_JOBS:-3} | ||
emmake make install | ||
popd |
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,13 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
set -x | ||
|
||
COMMIT_MSG=$(git log --no-merges -1 --oneline) | ||
|
||
# The integration tests will be triggered on push or on pull_request when the commit | ||
# message contains "[integration]" | ||
if [[ "$GITHUB_EVENT_NAME" == push || | ||
"$COMMIT_MSG" =~ \[integration\] ]]; then | ||
echo "trigger=true" >> "$GITHUB_OUTPUT" | ||
fi |