Files
wasmtime/.azure-pipelines.yml
Alex Crichton bf526b62d3 Add book documentation skeleton and auto-publish from CI (#435)
This commit adds the skeleton of a new set of documentation for
`wasmtime` in the existing `docs` directory. This documentation is
organized and compiled with [mdbook] which the Rust project uses for
most of its own documentation as well. At a previous meeting we
brainstormed a rough skeleton of what the documentation in this book
would look like, and I've transcribed that here for an example of how
this is rendered and how it can be laid out. No actual documentation is
written yet.

This commit also additionally adds necessary support to auto-publish
both this book documentation and API documentation every time a commit
is pushed to the `master` branch. All HTML will be automatically pushed
to the `gh-pages` branch so long as the CI passes, and this should get
deployed to https://cranestation.github.io/wasmtime.

I've done a few dry-runs and I think this'll all work, but we'll likely
tweak a few things here and there after running this through CI to make
sure everything looks just as we'd like. My hope though is that after
this lands we can start actually filling out all the documentation and
being able to review it as well.

[mdbook]: https://crates.io/crates/mdbook
2019-10-29 15:55:51 +01:00

258 lines
8.0 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 --exclude wasmtime-py -- --nocapture
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 -- --nocapture
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
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)
steps:
- template: ci/azure-build-release.yml
# Build the Linux release binary in an older Linux container (in this case
# Centos 6)
- job: Build_linux
variables:
toolchain: stable
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-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: Doc_book
displayName: "Doc - build the book"
steps:
- script: |
set -e
curl -L https://github.com/rust-lang-nursery/mdBook/releases/download/v0.3.1/mdbook-v0.3.1-x86_64-unknown-linux-gnu.tar.gz | tar xzf -
echo "##vso[task.prependpath]$PWD"
displayName: "Install mdbook"
- script: (cd docs && mdbook build)
- task: PublishPipelineArtifact@1
inputs:
artifactName: doc_book
path: docs/book
- job: Doc_api
displayName: "Doc - build the API documentation"
steps:
- template: ci/azure-install-rust.yml
- script: cargo doc
- task: PublishPipelineArtifact@1
inputs:
artifactName: doc_api
path: target/doc
- job: Publish
dependsOn:
- Build
- Build_wheels
- Build_linux
- Build_linux_wheels
- Doc_book
- Doc_api
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: |
set -e
mv $(Build.ArtifactStagingDirectory)/doc_book gh-pages
mv $(Build.ArtifactStagingDirectory)/doc_api gh-pages/api
displayName: Create gh-pages directory
- script: |
set -e
cd gh-pages
git init
cp ../.git/config .git
git add .
git -c user.name='ci' -c user.email='ci' commit -m init
git push -f -q https://github.com/CraneStation/wasmtime HEAD:gh-pages
displayName: Publish gh-pages directory
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
- 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')