* Remove cmake/bindgen/llvm from wasmtime-runtime This commit removes the cmake/bindgen dependency (which removes the need for `llvm-config`) from the `wasmtime-runtime` crate. The C++ code is instead compiled with the `cc` crate (it's just one file anyway) and the interface is handwritten since it's quite small anyway. Some other changes are: * The `TrapContext` type in C++ was removed since it was unused, and it was moved to Rust with a `Cell` on each field. * Functions between Rust/C++ now return `int` instead of `bool` to make them a bit more FFI compatible portably. * The `jmp_buf` type has a workaround that will be fixed in the next commit. * Move setjmp/longjmp to C++ This commit moves the definition of setjmp and longjmp into C++. This is primarily done because it's [debatable whether it's possible to call `setjmp` from Rust][rfc]. The semantics of `setjmp` are that it returns twice but LLVM doesn't actually know about this because rustc isn't telling LLVM this information, so it's unclear whether it can ever be safe. Additionally this removes the need for Rust code to know the definition of `jmp_buf` which is a pretty hairy type to define in Rust across platforms. The solution in this commit is to move all setjmp/longjmp code to C++, and that way we should be able to guarantee that jumps over wasm JIT code should always go from C++ to C++, removing Rust from the equation for now from needing to get any fiddly bits working across platforms. This should overall help it be a bit more portable and also means Rust doesn't have to know about `jmp_buf` as a type. The previous `Vec` of `jmp_buf` is now replaced with one thread-local pointer where previous values are stored on the stack and restored when the function returns. This is intended to be functionally the same as the previous implementation. [rfc]: https://github.com/rust-lang/rfcs/issues/2625 * rustfmt * Use volatile loads/stores * Remove mention of cmake from README
278 lines
9.8 KiB
YAML
278 lines
9.8 KiB
YAML
name: $(Build.SourceBranch)-$(date:yyyyMMdd)$(rev:.r)
|
|
trigger:
|
|
branches:
|
|
include:
|
|
- 'master'
|
|
tags:
|
|
include:
|
|
- '*'
|
|
exclude:
|
|
- 'dev'
|
|
|
|
jobs:
|
|
- job: rustfmt
|
|
pool:
|
|
vmImage: 'macos-10.14'
|
|
steps:
|
|
- checkout: self
|
|
submodules: true
|
|
- template: ci/azure-install-rust.yml
|
|
- script: rustup component add rustfmt
|
|
displayName: Add rustfmt
|
|
- script: cargo fmt --all -- --check
|
|
displayName: Check formatting
|
|
variables:
|
|
toolchain: stable
|
|
|
|
# Smoke test to build docs on one builder, using OSX for now since it's the
|
|
# fastest
|
|
- job: docs
|
|
pool:
|
|
vmImage: 'macos-10.14'
|
|
steps:
|
|
- checkout: self
|
|
submodules: true
|
|
- template: ci/azure-install-rust.yml
|
|
- script: cargo doc
|
|
displayName: Build documentation
|
|
variables:
|
|
toolchain: stable
|
|
|
|
- job: Test
|
|
strategy:
|
|
matrix:
|
|
windows-stable:
|
|
imageName: 'vs2017-win2016'
|
|
toolchain: stable
|
|
linux-stable:
|
|
imageName: 'ubuntu-16.04'
|
|
toolchain: stable
|
|
mac-stable:
|
|
imageName: 'macos-10.14'
|
|
toolchain: stable
|
|
mac-beta:
|
|
imageName: 'macos-10.14'
|
|
toolchain: beta
|
|
mac-nightly:
|
|
imageName: 'macos-10.14'
|
|
toolchain: nightly
|
|
|
|
pool:
|
|
vmImage: $(imageName)
|
|
|
|
steps:
|
|
- checkout: self
|
|
submodules: true
|
|
- template: ci/azure-install-rust.yml
|
|
|
|
- script: cargo fetch
|
|
displayName: Fetch cargo dependencies
|
|
|
|
# Build and test all features except for lightbeam
|
|
- bash: cargo test --all --exclude lightbeam --exclude wasmtime-wasi-c
|
|
displayName: Cargo test
|
|
env:
|
|
RUST_BACKTRACE: 1
|
|
|
|
# Build and test lightbeam if we're using the nightly toolchain
|
|
- bash: cargo build --package lightbeam
|
|
displayName: Cargo build lightbeam
|
|
condition: and(succeeded(), eq(variables['toolchain'], 'nightly'))
|
|
- bash: cargo test --package lightbeam
|
|
displayName: Cargo test lightbeam
|
|
# Lightbeam tests fail right now, but we don't want to block on that.
|
|
continueOnError: true
|
|
condition: and(succeeded(), eq(variables['toolchain'], 'nightly'))
|
|
env:
|
|
RUST_BACKTRACE: 1
|
|
|
|
- job: Build
|
|
strategy:
|
|
matrix:
|
|
windows:
|
|
imageName: 'vs2017-win2016'
|
|
# Statically link against msvcrt to produce slightly more portable
|
|
# binaries on Windows by reducing our binary compatibility requirements.
|
|
RUSTFLAGS: -Ctarget-feature=+crt-static
|
|
linux:
|
|
imageName: 'ubuntu-16.04'
|
|
mac:
|
|
imageName: 'macos-10.14'
|
|
# Lower the deployment target from our build image in an attempt to
|
|
# build more portable binaries that run on older releases. Note that
|
|
# 10.9 here is arbitrarily chosen and just happens to be the lowest that
|
|
# works at this time. Raising this is probably fine.
|
|
MACOSX_DEPLOYMENT_TARGET: 10.9
|
|
|
|
variables:
|
|
toolchain: stable
|
|
|
|
pool:
|
|
vmImage: $(imageName)
|
|
|
|
# variables:
|
|
# SCCACHE_DIR: $(Pipeline.Workspace)/.sccache
|
|
# RUSTC_WRAPPER: sccache
|
|
|
|
steps:
|
|
- checkout: self
|
|
submodules: true
|
|
- template: ci/azure-install-rust.yml
|
|
|
|
- bash: echo "##vso[task.setvariable variable=RUSTC_VERSION;]`rustc --version`"
|
|
displayName: Set rustc version string for caching
|
|
|
|
# - bash: |
|
|
# set -e
|
|
# curl -Lfo sccache.tar.gz https://github.com/mozilla/sccache/releases/download/0.2.9/sccache-0.2.9-x86_64-apple-darwin.tar.gz
|
|
# tar -xzf sccache.tar.gz
|
|
# cp sccache-*/sccache /usr/local/bin/
|
|
# displayName: Install sccache (OSX)
|
|
# condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin'))
|
|
|
|
# - bash: |
|
|
# set -e
|
|
# curl -Lfo sccache.tar.gz https://github.com/mozilla/sccache/releases/download/0.2.9/sccache-0.2.9-x86_64-unknown-linux-musl.tar.gz
|
|
# tar -xzf sccache.tar.gz
|
|
# sudo cp sccache-*/sccache /usr/local/bin/
|
|
# displayName: Install sccache (Linux)
|
|
# condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
|
|
|
|
# - script: |
|
|
# curl -Lfo sccache.tar.gz https://github.com/mozilla/sccache/releases/download/0.2.9/sccache-0.2.9-x86_64-pc-windows-msvc.tar.gz
|
|
# tar -xzf sccache.tar.gz
|
|
# move sccache-* sccache
|
|
# echo "##vso[task.prependpath]%CD%\sccache"
|
|
# displayName: Install sccache (Windows)
|
|
# condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
|
|
|
|
- bash: cargo build --release
|
|
displayName: Cargo build
|
|
|
|
# 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
|
|
displayName: Cargo test
|
|
env:
|
|
RUST_BACKTRACE: 1
|
|
|
|
# - script: sccache --show-stats
|
|
# displayName: post-compile sccache stats
|
|
|
|
- bash: |
|
|
echo "##vso[task.setvariable variable=tagName;]`echo $BUILD_SOURCEBRANCH | sed -e 's|refs/tags/||'`"
|
|
displayName: Set tag name
|
|
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
|
|
- bash: |
|
|
echo "##vso[task.setvariable variable=tagName;]dev"
|
|
displayName: Set tag name to "dev"
|
|
condition: not(startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
|
|
|
|
- bash: echo "##vso[task.setvariable variable=basename;]wasmtime-$(tagName)-x86_64-windows"
|
|
displayName: Configure basename var
|
|
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
|
|
- bash: echo "##vso[task.setvariable variable=basename;]wasmtime-$(tagName)-x86_64-apple"
|
|
displayName: Configure basename var
|
|
condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin'))
|
|
- bash: echo "##vso[task.setvariable variable=basename;]wasmtime-$(tagName)-x86_64-linux"
|
|
displayName: Configure basename var
|
|
condition: and(succeeded(), eq( variables['Agent.OS'], 'Linux' ))
|
|
|
|
- bash: |
|
|
set -e
|
|
mkdir -p $BUILD_BINARIESDIRECTORY/$BASENAME
|
|
if [ "$AGENT_OS" = "Windows_NT" ]; then
|
|
ext=.exe
|
|
fi
|
|
cp LICENSE README.md target/release/{wasmtime,wasm2obj}$ext $BUILD_BINARIESDIRECTORY/$BASENAME
|
|
displayName: Copy binaries
|
|
|
|
- bash: |
|
|
set -e
|
|
export WT_VERSION=`cat Cargo.toml | sed -n 's/^version = "\([^"]*\)".*/\1/p'`
|
|
"$WIX/bin/candle" -arch x64 -out target/wasmtime.wixobj installer/msi/wasmtime.wxs
|
|
"$WIX/bin/light" -out $BUILD_ARTIFACTSTAGINGDIRECTORY/$(basename).msi target/wasmtime.wixobj -ext WixUtilExtension
|
|
rm $BUILD_ARTIFACTSTAGINGDIRECTORY/$(basename).wixpdb
|
|
displayName: Create installer (Windows)
|
|
condition: eq(variables['Agent.OS'], 'Windows_NT')
|
|
|
|
- task: ArchiveFiles@2
|
|
inputs:
|
|
rootFolderOrFile: $(Build.BinariesDirectory)/$(basename)
|
|
archiveType: 'zip'
|
|
archiveFile: '$(Build.ArtifactStagingDirectory)/$(basename).zip'
|
|
displayName: Archive files (Win)
|
|
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
|
|
- task: ArchiveFiles@2
|
|
inputs:
|
|
rootFolderOrFile: $(Build.BinariesDirectory)/$(basename)
|
|
archiveType: 'tar'
|
|
tarCompression: 'xz'
|
|
archiveFile: '$(Build.ArtifactStagingDirectory)/$(basename).tar.xz'
|
|
displayName: Archive files (Unix)
|
|
condition: and(succeeded(), ne(variables['Agent.OS'], 'Windows_NT'))
|
|
- task: PublishPipelineArtifact@1
|
|
inputs:
|
|
path: $(Build.ArtifactStagingDirectory)/
|
|
artifactName: 'bundle-$(Agent.OS)'
|
|
|
|
- job: Publish
|
|
dependsOn: Build
|
|
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.
|
|
- checkout: self
|
|
persistCredentials: true
|
|
submodules: false
|
|
- task: DownloadPipelineArtifact@1
|
|
inputs:
|
|
targetPath: $(Build.ArtifactStagingDirectory)
|
|
- script: |
|
|
echo "##vso[task.setvariable variable=tagName;]`echo $BUILD_SOURCEBRANCH | sed -e 's|refs/tags/||'`"
|
|
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
|
|
- task: GitHubRelease@0
|
|
inputs:
|
|
gitHubConnection: 'tschneidereit-releases'
|
|
target: '$(Build.SourceVersion)'
|
|
tagSource: 'manual'
|
|
tag: '$(tagName)'
|
|
title: 'Wasmtime $(tagName)'
|
|
assets: '$(Build.ArtifactStagingDirectory)/**'
|
|
isDraft: false
|
|
isPreRelease: true
|
|
condition: and(startsWith(variables['Build.SourceBranch'], 'refs/tags/'),
|
|
ne(variables['Build.SourceBranch'], 'refs/tags/dev'))
|
|
|
|
# GitHub doesn't support doing rolling releases for branch.
|
|
# To simulate that for dev builds, always do a release for the "dev" tag.
|
|
# While the `edit` action for the GitHubRelease task would replace any assets
|
|
# associated with the tag, it wouldn't update the tag itself. Hence, delete the
|
|
# tag if it exists, and re-create it every time.
|
|
# Also explicitly delete the GitHub release, which would otherwise turn into a draft
|
|
# and linger forever.
|
|
- task: GitHubRelease@0
|
|
inputs:
|
|
gitHubConnection: 'tschneidereit-releases'
|
|
action: 'delete'
|
|
tag: 'dev'
|
|
# This might fail in case the target repo doesn't yet have this tag, which is fine.
|
|
continueOnError: true
|
|
condition: in(variables['Build.SourceBranch'], 'refs/heads/master', 'refs/tags/dev')
|
|
- script: |
|
|
git -c http.extraheader="AUTHORIZATION: basic ***" push origin :dev
|
|
# This might fail in case the target repo doesn't yet have this tag, which is fine.
|
|
continueOnError: true
|
|
condition: in(variables['Build.SourceBranch'], 'refs/heads/master', 'refs/tags/dev')
|
|
- task: GitHubRelease@0
|
|
inputs:
|
|
gitHubConnection: 'tschneidereit-releases'
|
|
action: 'create'
|
|
target: '$(Build.SourceVersion)'
|
|
tag: 'dev'
|
|
tagSource: 'manual'
|
|
title: 'Latest CI build'
|
|
assets: '$(Build.ArtifactStagingDirectory)/**'
|
|
isDraft: false
|
|
isPreRelease: true
|
|
condition: in(variables['Build.SourceBranch'], 'refs/heads/master', 'refs/tags/dev')
|