-
Notifications
You must be signed in to change notification settings - Fork 29
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
WASM build #262
Draft
agriyakhetarpal
wants to merge
21
commits into
flintlib:main
Choose a base branch
from
agriyakhetarpal:bld/wasm
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
WASM build #262
Changes from 18 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
7072379
Add a CI job to build `libgmp`, `libmpfr`, `flint`, and `python-flint`
agriyakhetarpal a0c5c63
Find MPFR
agriyakhetarpal ffb88c4
Don't override Python's `PKG_CONFIG_PATH`
agriyakhetarpal d19caaf
Debug
agriyakhetarpal 443d008
Try to export WASM_LIBRARY_DIR properly
agriyakhetarpal 44ef505
Fix missing WASM lib dir
agriyakhetarpal 42f4069
Bump flint to 3.1.0
agriyakhetarpal 304a55c
Run the test suite
agriyakhetarpal 52a5674
Bump `flint` to version 3.1.2
agriyakhetarpal 5583688
is `is`/`is not` for comparison with `NoneType`
agriyakhetarpal cf5f246
Temporarily disable `test_polys` (FSM)
agriyakhetarpal a3af36a
Temporarily disable `test_factor_poly_mpoly`
agriyakhetarpal 35f811e
Cache WASM libs for CI speedups
agriyakhetarpal bcfeb29
Temporarily disable `test_fq_default`
agriyakhetarpal 5dc6770
Temporarily disable `test_fq_default_poly`
agriyakhetarpal 920e9fa
Merge branch 'main' into bld/wasm
agriyakhetarpal db1ef76
Bump to flint version 3.2.0-rc1 for WASM build
agriyakhetarpal c8b28af
Skip build if cache htis
agriyakhetarpal 7bbf568
Remove orphan `print(srcpath)` statement
agriyakhetarpal 6305a5d
Set host for Emscripten
agriyakhetarpal 4ef8028
Try passing `--disable-assembly`
agriyakhetarpal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,153 @@ | ||
name: Run Pyodide CI | ||
|
||
on: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
env: | ||
FORCE_COLOR: 3 | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
env: | ||
PYODIDE_VERSION: 0.27.3 | ||
# PYTHON_VERSION and EMSCRIPTEN_VERSION are determined by PYODIDE_VERSION. | ||
# The appropriate versions can be found in the Pyodide repodata.json | ||
# "info" field, or in Makefile.envs: | ||
# https://github.com/pyodide/pyodide/blob/main/Makefile.envs#L2 | ||
PYTHON_VERSION: 3.12 # any 3.12.x version works | ||
EMSCRIPTEN_VERSION: 3.1.58 | ||
NODE_VERSION: 20 | ||
steps: | ||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
||
- name: Set up Python ${{ env.PYTHON_VERSION }} | ||
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
|
||
- name: Set up Emscripten toolchain | ||
uses: mymindstorm/setup-emsdk@6ab9eb1bda2574c4ddb79809fc9247783eaf9021 # v14 | ||
with: | ||
version: ${{ env.EMSCRIPTEN_VERSION }} | ||
actions-cache-folder: emsdk-cache | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
|
||
- name: Install pyodide-build | ||
run: pip install pyodide-build | ||
|
||
- name: Restore WASM library directory from cache | ||
id: cache-wasm-library-dir | ||
uses: actions/cache/restore@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 | ||
with: | ||
path: ${{ github.workspace }}/wasm-library-dir | ||
key: wasm-library-dir-${{ hashFiles('.github/workflows/ci-emscripten.yml') }} | ||
|
||
- name: Build libgmp | ||
if: steps.cache-wasm-library-dir.outputs.cache-hit != 'true' | ||
env: | ||
CFLAGS: "-fPIC" | ||
WASM_LIBRARY_DIR: ${{ github.workspace }}/wasm-library-dir | ||
run: | | ||
curl -L https://ftp.gnu.org/gnu/gmp/gmp-6.3.0.tar.xz -o gmp-6.3.0.tar.xz | ||
tar -xf gmp-6.3.0.tar.xz | ||
|
||
cd gmp-6.3.0 | ||
|
||
emconfigure ./configure \ | ||
--disable-dependency-tracking \ | ||
--host none \ | ||
--disable-shared \ | ||
--enable-static \ | ||
--enable-cxx \ | ||
--prefix=${{ env.WASM_LIBRARY_DIR }} | ||
emmake make -j $(nproc) | ||
emmake make install | ||
|
||
- name: Build libmpfr | ||
if: steps.cache-wasm-library-dir.outputs.cache-hit != 'true' | ||
env: | ||
CFLAGS: "-fPIC" | ||
WASM_LIBRARY_DIR: ${{ github.workspace }}/wasm-library-dir | ||
run: | | ||
curl -L https://ftp.gnu.org/gnu/mpfr/mpfr-4.2.1.tar.xz -o mpfr-4.2.1.tar.xz | ||
tar -xf mpfr-4.2.1.tar.xz | ||
|
||
cd mpfr-4.2.1 | ||
|
||
emconfigure ./configure \ | ||
--disable-dependency-tracking \ | ||
--disable-shared \ | ||
--with-gmp="${{ env.WASM_LIBRARY_DIR }}" \ | ||
--prefix=${{ env.WASM_LIBRARY_DIR }} | ||
emmake make -j $(nproc) | ||
emmake make install | ||
|
||
# might need patch | ||
- name: Build flint | ||
if: steps.cache-wasm-library-dir.outputs.cache-hit != 'true' | ||
env: | ||
CFLAGS: "-fPIC" | ||
WASM_LIBRARY_DIR: ${{ github.workspace }}/wasm-library-dir | ||
run: | | ||
curl -L https://github.com/flintlib/flint/releases/download/v3.2.0-rc1/flint-3.2.0-rc1.tar.xz -o flint-3.2.0-rc1.tar.xz | ||
tar -xf flint-3.2.0-rc1.tar.xz | ||
|
||
cd flint-3.2.0-rc1 | ||
|
||
emconfigure ./configure \ | ||
--disable-dependency-tracking \ | ||
--disable-shared \ | ||
--prefix=${{ env.WASM_LIBRARY_DIR }} \ | ||
--with-gmp=${{ env.WASM_LIBRARY_DIR }} \ | ||
--with-mpfr=${{ env.WASM_LIBRARY_DIR }} | ||
emmake make -j $(nproc) | ||
emmake make install | ||
|
||
- name: Persist WASM library directory to cache | ||
uses: actions/cache/save@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 | ||
with: | ||
path: ${{ github.workspace }}/wasm-library-dir | ||
key: wasm-library-dir-${{ hashFiles('.github/workflows/ci-emscripten.yml') }} | ||
|
||
- name: Build python-flint | ||
env: | ||
WASM_LIBRARY_DIR: ${{ github.workspace }}/wasm-library-dir | ||
run: | | ||
export PKG_CONFIG_PATH="${{ env.WASM_LIBRARY_DIR }}/lib/pkgconfig:${PKG_CONFIG_PATH}" | ||
export CFLAGS="-I${{ env.WASM_LIBRARY_DIR }}/include ${CFLAGS:-}" | ||
export LDFLAGS="-L${{ env.WASM_LIBRARY_DIR }}/lib -lflint -lmpfr -lgmp ${LDFLAGS:-}" | ||
|
||
echo "PKG_CONFIG_PATH=${PKG_CONFIG_PATH}" | ||
echo "CFLAGS=${CFLAGS}" | ||
echo "LDFLAGS=${LDFLAGS}" | ||
|
||
pkg-config --modversion python3 | ||
pkg-config --modversion mpfr | ||
pkg-config --modversion flint | ||
|
||
pyodide build | ||
|
||
- name: Set up Pyodide virtual environment and test python-flint | ||
run: | | ||
pyodide xbuildenv install ${{ env.PYODIDE_VERSION }} | ||
pyodide venv .venv-pyodide | ||
|
||
source .venv-pyodide/bin/activate | ||
pip install dist/*.whl | ||
|
||
cd doc | ||
|
||
pip install pytest hypothesis | ||
# Don't use the cache provider plugin, as it doesn't work with Pyodide | ||
# right now: https://github.com/pypa/cibuildwheel/issues/1966 | ||
pytest -svra -p no:cacheprovider --pyargs flint |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think you need to set something like
--disable-assembly
or--host=...
here.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.
I don't know what the host triple is for WASM