-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #104 from alexcrichton/components
Merge component bindings generation into this repository
- Loading branch information
Showing
38 changed files
with
5,120 additions
and
47 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 |
---|---|---|
@@ -1,4 +1,8 @@ | ||
[flake8] | ||
ignore = F405,F403 | ||
max-line-length = 160 | ||
exclude = wasmtime/__init__.py,tests/__init__.py | ||
exclude = wasmtime/__init__.py,tests/__init__.py,wasmtime/bindgen/generated/*,tests/codegen/generated/* | ||
|
||
per-file-ignores = | ||
# Codegen tests intentionally have some imports not at the top | ||
tests/codegen/*:E402 |
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,64 @@ | ||
name: 'Setup wasmtime-py CI' | ||
runs: | ||
using: "composite" | ||
steps: | ||
# Setup Python and the Python dependencies of this project | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.x' | ||
- run: pip install -e ".[testing]" | ||
shell: bash | ||
|
||
# Download precompiled wasmtime binaries for running the project | ||
- run: python ci/download-wasmtime.py | ||
shell: bash | ||
|
||
# https://github.com/actions/cache/blob/main/workarounds.md#improving-cache-restore-performance-on-windows-using-cross-os-caching | ||
- if: ${{ runner.os == 'Windows' }} | ||
name: Use GNU tar | ||
shell: cmd | ||
run: | | ||
echo "Adding GNU tar to PATH" | ||
echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%" | ||
# Ensure the Rust lockfile is up-to-date | ||
- uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cargo/registry/index | ||
~/.cargo/git/db | ||
key: cargo-registry-${{ hashFiles('rust/Cargo.lock') }} | ||
- run: cargo fetch --manifest-path rust/Cargo.toml --locked | ||
shell: bash | ||
|
||
# Install the `wasm-tools` binary with the `component` subcommand that is all | ||
# that's needed here. | ||
- uses: actions/cache@v3 | ||
with: | ||
path: ${{ runner.tool_cache }}/wasm-tools | ||
key: wasm-tools-bin-e15e768a346c30738103d372e8ccf442646628c9-${{ runner.os }} | ||
- run: echo '${{ runner.tool_cache }}/wasm-tools/bin' >> $GITHUB_PATH | ||
shell: bash | ||
- run: | | ||
cargo install \ | ||
wasm-tools \ | ||
--root '${{ runner.tool_cache }}/wasm-tools' \ | ||
--git https://github.com/bytecodealliance/wasm-tools \ | ||
--rev e15e768a346c30738103d372e8ccf442646628c9 \ | ||
--no-default-features \ | ||
--features component | ||
shell: bash | ||
# Build the bindgen wasm blob with some extra Rust targets. | ||
- run: | | ||
rustup target add wasm32-unknown-unknown wasm32-wasi | ||
echo CARGO_INCREMENTAL=0 >> $GITHUB_ENV | ||
echo CARGO_PROFILE_DEV_DEBUG=0 >> $GITHUB_ENV | ||
echo RUSTC_VERSION=`rustc --version` >> $GITHUB_ENV | ||
shell: bash | ||
- uses: actions/cache@v3 | ||
with: | ||
path: rust/target | ||
key: rust-target-${{ env.RUSTC_VERSION }}-${{ runner.os }}-${{ hashFiles('rust/Cargo.lock') }} | ||
- run: python ci/build-rust.py | ||
shell: bash |
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 |
---|---|---|
|
@@ -27,46 +27,51 @@ jobs: | |
- os: windows-latest | ||
python-version: pypy3 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v1 | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/setup | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- run: python download-wasmtime.py | ||
- run: pip install -e ".[testing]" | ||
# Tests are flaky on Windows. It's something to do with generating modules | ||
# on-the-go in the component codegen tests. I have no idea how to fix it. | ||
# This is a last-ditch attempt to get things working. | ||
- run: pytest --setup-only | ||
continue-on-error: true | ||
- run: pytest | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-python@v1 | ||
with: | ||
python-version: '3.x' | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/setup | ||
- run: pip install setuptools wheel | ||
# If this is a tagged build use real version numbers | ||
- run: echo "PROD=true" >> $GITHUB_ENV | ||
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') | ||
- run: | | ||
git clean -fdx wasmtime build | ||
python download-wasmtime.py linux x86_64 | ||
python ci/download-wasmtime.py linux x86_64 | ||
python ci/build-rust.py | ||
python setup.py bdist_wheel --plat-name manylinux1-x86_64 | ||
- run: | | ||
git clean -fdx wasmtime build | ||
python download-wasmtime.py linux aarch64 | ||
python ci/download-wasmtime.py linux aarch64 | ||
python ci/build-rust.py | ||
python setup.py bdist_wheel --plat-name manylinux2014_aarch64 | ||
- run: | | ||
git clean -fdx wasmtime build | ||
python download-wasmtime.py darwin x86_64 | ||
python ci/download-wasmtime.py darwin x86_64 | ||
python ci/build-rust.py | ||
python setup.py bdist_wheel --plat-name macosx-10-13-x86_64 | ||
- run: | | ||
git clean -fdx wasmtime build | ||
python download-wasmtime.py darwin arm64 | ||
python ci/download-wasmtime.py darwin arm64 | ||
python setup.py bdist_wheel --plat-name macosx-11-0-arm64 | ||
python ci/build-rust.py | ||
- run: | | ||
git clean -fdx wasmtime build | ||
python download-wasmtime.py win32 x86_64 | ||
python ci/download-wasmtime.py win32 x86_64 | ||
python ci/build-rust.py | ||
python setup.py bdist_wheel --plat-name win-amd64 | ||
# Build an "any" wheel with: | ||
|
@@ -80,41 +85,35 @@ jobs: | |
# shared libraries. | ||
- run: | | ||
git clean -fdx wasmtime build | ||
python download-wasmtime.py win32 x86_64 | ||
python ci/download-wasmtime.py win32 x86_64 | ||
python ci/build-rust.py | ||
python setup.py bdist_wheel | ||
- uses: actions/upload-artifact@v1 | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: wheels | ||
path: dist | ||
|
||
docs: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v1 | ||
with: | ||
python-version: '3.x' | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/setup | ||
- run: pip install pdoc3 | ||
- run: python download-wasmtime.py | ||
- run: pdoc --html wasmtime | ||
- uses: actions/upload-artifact@v1 | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: generated-docs | ||
path: html/wasmtime | ||
|
||
coverage: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v1 | ||
with: | ||
python-version: '3.x' | ||
- run: python download-wasmtime.py | ||
- run: pip install -e ".[testing]" | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/setup | ||
- run: coverage run -m pytest | ||
- run: coverage html | ||
- uses: actions/upload-artifact@v1 | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: coverage | ||
path: htmlcov | ||
|
@@ -123,15 +122,16 @@ jobs: | |
needs: [coverage, docs] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/download-artifact@v1 | ||
- uses: actions/checkout@v3 | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: coverage | ||
- uses: actions/download-artifact@v1 | ||
path: generated-docs/coverage | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: generated-docs | ||
path: generated-docs | ||
- run: find . | ||
- run: mv coverage generated-docs | ||
- uses: JamesIves/[email protected] | ||
with: | ||
branch: gh-pages | ||
|
@@ -143,15 +143,13 @@ jobs: | |
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v1 | ||
with: | ||
python-version: '3.x' | ||
- uses: actions/download-artifact@v1 | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/setup | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: wheels | ||
path: dist | ||
- run: find . | ||
- run: mv wheels dist | ||
|
||
- name: Publish distribution 📦 to Test PyPI | ||
if: github.event_name == 'push' | ||
|
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 |
---|---|---|
@@ -1,3 +1 @@ | ||
recursive-include wasmtime *.so | ||
recursive-include wasmtime *.dll | ||
recursive-include wasmtime *.dylib | ||
recursive-include wasmtime *.py *.wasm *.so *.dll *.dylib |
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
Oops, something went wrong.