Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 35 additions & 23 deletions .azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
displayName: Fetch cargo dependencies

# Build and test all features except for lightbeam
- bash: cargo test --all --exclude lightbeam --exclude wasmtime-wasi-c
- bash: cargo test --all --exclude lightbeam --exclude wasmtime-wasi-c --exclude wasmtime-py
displayName: Cargo test
env:
RUST_BACKTRACE: 1
Expand Down Expand Up @@ -117,34 +117,46 @@ jobs:
image: centos:6
options: "--name ci-container -v /usr/bin/docker:/tmp/docker:ro"
steps:
# We're executing in the container as non-root but `yum` requires root. We
# need to install `sudo` but to do that we need `sudo`. Do a bit of a weird
# hack where we use the host `docker` executable to re-execute in our own
# container with the root user to install `sudo`
- bash: /tmp/docker exec -t -u 0 ci-container sh -c "yum install -y sudo"
displayName: Configure sudo

# See https://edwards.sdsu.edu/research/c11-on-centos-6/ for where these
# various commands came from.
- bash: |
set -e
sudo yum install -y centos-release-scl cmake xz
sudo yum install -y devtoolset-8-gcc devtoolset-8-binutils devtoolset-8-gcc-c++
echo "##vso[task.prependpath]/opt/rh/devtoolset-8/root/usr/bin"
displayName: Install system dependencies

# Delete `libstdc++.so` to force gcc to link against `libstdc++.a` instead.
# This is a hack and not the right way to do this, but it ends up doing the
# right thing for now.
- bash: sudo rm -f /opt/rh/devtoolset-8/root/usr/lib/gcc/x86_64-redhat-linux/8/libstdc++.so
displayName: Force a static libstdc++

- template: ci/azure-prepare-centos-6.yml
- template: ci/azure-build-release.yml

# Build the `wasmtime-py` python extension in the same manner we build the
# binaries above, since these wheels are also native code that we're
# distributing.
#
# Note that the builds here are using a nightly compiler, not a stable compiler,
# since this is what PyO3 requires.
- job: Build_wheels
strategy:
matrix:
windows:
imageName: 'vs2017-win2016'
RUSTFLAGS: -Ctarget-feature=+crt-static
mac:
imageName: 'macos-10.14'
MACOSX_DEPLOYMENT_TARGET: 10.9
variables:
toolchain: nightly-2019-08-15
pool:
vmImage: $(imageName)
steps:
- template: ci/azure-build-wheels.yml
- job: Build_linux_wheels
variables:
toolchain: nightly-2019-08-15
container:
image: centos:6
options: "--name ci-container -v /usr/bin/docker:/tmp/docker:ro"
steps:
- template: ci/azure-prepare-centos-6.yml
- template: ci/azure-build-wheels.yml

- job: Publish
dependsOn:
- Build
- Build_wheels
- Build_linux
- Build_linux_wheels
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI'))
steps:
# Checking out the sources is needed to be able to delete the "dev" tag, see below.
Expand Down
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ cranelift-entity = { version = "0.38.0", features = ["enable-serde"] }
cranelift-wasm = { version = "0.38.0", features = ["enable-serde"] }
wasmtime-debug = { path = "wasmtime-debug" }
wasmtime-environ = { path = "wasmtime-environ" }
wasmtime-interface-types = { path = "wasmtime-interface-types" }
wasmtime-runtime = { path = "wasmtime-runtime" }
wasmtime-jit = { path = "wasmtime-jit" }
wasmtime-obj = { path = "wasmtime-obj" }
Expand All @@ -26,15 +27,18 @@ wasi-common = { git = "https://github.com/CraneStation/wasi-common", rev = "8ea7
docopt = "1.0.1"
serde = { "version" = "1.0.94", features = ["derive"] }
faerie = "0.10.1"
failure = "0.1"
target-lexicon = { version = "0.4.0", default-features = false }
pretty_env_logger = "0.3.0"
file-per-thread-logger = "0.1.1"
wabt = "0.7"
libc = "0.2.60"
errno = "0.2.4"
rayon = "1.1"
wasm-webidl-bindings = "0.4"

[workspace]
members = ["misc/wasmtime-py"]

[features]
lightbeam = ["wasmtime-environ/lightbeam", "wasmtime-jit/lightbeam"]
Expand Down
3 changes: 1 addition & 2 deletions ci/azure-build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ steps:

# Test what we're about to release in release mode itself. This tests
# everything except lightbeam which requires nightly which happens above.
- bash: cargo test --release --all --exclude lightbeam --exclude wasmtime-wasi-c
- bash: cargo test --release --all --exclude lightbeam --exclude wasmtime-wasi-c --exclude wasmtime-py
displayName: Cargo test
env:
RUST_BACKTRACE: 1
Expand Down Expand Up @@ -100,4 +100,3 @@ steps:
inputs:
path: $(Build.ArtifactStagingDirectory)/
artifactName: 'bundle-$(Agent.OS)'

73 changes: 73 additions & 0 deletions ci/azure-build-wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
steps:
- checkout: self
submodules: true

- template: azure-install-rust.yml

- bash: mkdir misc/wasmtime-py/wheelhouse
displayName: Pre-create wheelhouse directory

# Note that we skip this on Linux because Python 3.6 is pre-installed in the
# CentOS container.
- task: UsePythonVersion@0
inputs:
versionSpec: '3.6'
addToPath: true
condition: and(succeeded(), ne(variables['Agent.OS'], 'Linux'))

# Install Python dependencies needed for our `setup.py` scripts
- bash: sudo pip3 install setuptools wheel==0.31.1 setuptools-rust auditwheel
displayName: Install Python dependencies (Linux)
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
- bash: pip3 install setuptools wheel==0.31.1 setuptools-rust
displayName: Install Python dependencies (not Linux)
condition: and(succeeded(), ne(variables['Agent.OS'], 'Linux'))

- bash: python setup.py bdist_wheel
workingDirectory: misc/wasmtime-py
displayName: Build wheels py36

# Clear the build directory between building different wheels for different
# Python versions to ensure that we don't package dynamic libraries twice by
# accident.
- bash: rm -rf build
workingDirectory: misc/wasmtime-py
displayName: Clear build directory

# Note that 3.7 isn't installed on Linux so we don't do this a second time
# around.
- task: UsePythonVersion@0
inputs:
versionSpec: '3.7'
addToPath: true
condition: and(succeeded(), ne(variables['Agent.OS'], 'Linux'))
- bash: |
set -e
pip3 install setuptools wheel==0.31.1 setuptools-rust
python setup.py bdist_wheel
workingDirectory: misc/wasmtime-py
displayName: Build wheels py37
condition: and(succeeded(), ne(variables['Agent.OS'], 'Linux'))

# Move `dist/*.whl` into `wheelhouse/` so we can deploy them, but on Linux we
# need to run an `auditwheel` command as well to turn these into "manylinux"
# wheels to run across a number of distributions.
- bash: mv dist/*.whl wheelhouse/
workingDirectory: misc/wasmtime-py
displayName: Move wheels to wheelhouse (not Linux)
condition: and(succeeded(), ne(variables['Agent.OS'], 'Linux'))
- bash: |
set -e
for whl in dist/*.whl; do
auditwheel repair "$whl" -w wheelhouse/
done
workingDirectory: misc/wasmtime-py
displayName: Move wheels to wheelhouse (Linux)
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))

# Publish our wheelhouse to azure pipelines which will later get published to
# github releases
- task: PublishPipelineArtifact@1
inputs:
path: misc/wasmtime-py/wheelhouse
artifactName: 'wheels-$(Agent.OS)'
24 changes: 24 additions & 0 deletions ci/azure-prepare-centos-6.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
steps:
# We're executing in the container as non-root but `yum` requires root. We
# need to install `sudo` but to do that we need `sudo`. Do a bit of a weird
# hack where we use the host `docker` executable to re-execute in our own
# container with the root user to install `sudo`
- bash: /tmp/docker exec -t -u 0 ci-container sh -c "yum install -y sudo"
displayName: Configure sudo

# See https://edwards.sdsu.edu/research/c11-on-centos-6/ for where these
# various commands came from.
- bash: |
set -e
sudo yum install -y centos-release-scl cmake xz epel-release
sudo yum install -y rh-python36 patchelf unzip
sudo yum install -y devtoolset-8-gcc devtoolset-8-binutils devtoolset-8-gcc-c++
echo "##vso[task.prependpath]/opt/rh/devtoolset-8/root/usr/bin"
echo "##vso[task.prependpath]/opt/rh/rh-python36/root/usr/bin"
displayName: Install system dependencies

# Delete `libstdc++.so` to force gcc to link against `libstdc++.a` instead.
# This is a hack and not the right way to do this, but it ends up doing the
# right thing for now.
- bash: sudo rm -f /opt/rh/devtoolset-8/root/usr/lib/gcc/x86_64-redhat-linux/8/libstdc++.so
displayName: Force a static libstdc++
15 changes: 15 additions & 0 deletions misc/wasmtime-py/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
*.bk
*.swp
*.swo
*.swx
tags
target
Cargo.lock
.*.rustfmt
cranelift.dbg*
rusty-tags.*
*~
\#*\#
build
dist
*.egg-info
32 changes: 32 additions & 0 deletions misc/wasmtime-py/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[package]
name = "wasmtime-py"
version = "0.3.0"
authors = ["The Wasmtime Project Developers"]
description = "Python extension for the wasmtime"
license = "Apache-2.0 WITH LLVM-exception"
categories = ["wasm", "python"]
edition = "2018"
publish = false

[lib]
name = "_wasmtime"
crate-type = ["cdylib"]

[dependencies]
cranelift-codegen = "0.38.0"
cranelift-native = "0.38.0"
cranelift-entity = "0.38.0"
cranelift-wasm = "0.38.0"
cranelift-frontend = "0.38.0"
wasmtime-environ = { path = "../../wasmtime-environ" }
wasmtime-interface-types = { path = "../../wasmtime-interface-types" }
wasmtime-jit = { path = "../../wasmtime-jit" }
wasmtime-runtime = { path = "../../wasmtime-runtime" }
target-lexicon = { version = "0.4.0", default-features = false }
failure = "0.1"
region = "2.0.0"
wasmparser = "0.35.3"

[dependencies.pyo3]
version = "0.7.0-alpha.1"
features = ["extension-module"]
Loading