trigger:
branches:
include:
- refs/heads/master
- refs/tags/*
jobs:
- job: test_wrangler
displayName: "Run wrangler tests, fmt, and clippy"
steps:
- template: ci/azure-install-rust.yml
- template: ci/azure-install-node.yml
- script: cargo test --locked
displayName: "cargo test --locked"
- script: rustup component add rustfmt
displayName: rustup component add rustfmt
- script: cargo fmt --all -- --check
displayName: "cargo fmt --all -- --check"
- script: rustup component add clippy
displayName: rustup component add clippy
- script: cargo clippy
displayName: "cargo clippy --all --all-features -- -D warnings"
- job: test_wrangler_windows
displayName: "Run wrangler tests (Windows)"
pool:
vmImage: vs2017-win2016
steps:
- template: ci/azure-install-rust.yml
- template: ci/azure-install-node.yml
- script: cargo test --locked
displayName: "cargo test --locked"
env:
RUST_LOG: warn,wrangler=info
RUST_BACKTRACE: 1
- job: test_wrangler_nightly
displayName: "Run wrangler tests (nightly)"
steps:
- template: ci/azure-install-rust.yml
parameters:
toolchain: nightly
- template: ci/azure-install-node.yml
- script: cargo test --locked
displayName: "cargo test --locked"
env:
RUST_LOG: warn,wrangler=info
RUST_BACKTRACE: 1
- job: dist_linux
displayName: "Dist Linux binary"
steps:
- template: ci/azure-install-rust.yml
- script: rustup target add x86_64-unknown-linux-musl
- script: |
sudo apt update -y
sudo apt install musl-tools -y
displayName: "Install musl-tools"
- script: |
set -ex
cargo build --target x86_64-unknown-linux-musl --features vendored-openssl --release
- template: ci/azure-create-tarball.yml
parameters:
artifacts: target/x86_64-unknown-linux-musl/release/wrangler
name: dist_linux
- job: dist_darwin
displayName: "Dist Darwin binary"
pool:
vmImage: macOS-10.13
steps:
- template: ci/azure-install-rust.yml
- script: cargo build --release
env:
MACOSX_DEPLOYMENT_TARGET: 10.7
- template: ci/azure-create-tarball.yml
parameters:
name: dist_darwin
- job: dist_windows
displayName: "Dist Windows binary"
pool:
vmImage: vs2017-win2016
steps:
- template: ci/azure-install-rust.yml
- script: cargo build --release
env:
RUSTFLAGS: -Ctarget-feature=+crt-static
- template: ci/azure-create-tarball.yml
parameters:
name: dist_windows
- job: dist_wranglerjs
displayName: "Dist wranglerjs"
steps:
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: wranglerjs
includeRootFolder: false
archiveType: tar
tarCompression: gz
archiveFile: wranglerjs.tar.gz
verbose: true
- template: ci/azure-create-tarball.yml
parameters:
artifacts: wranglerjs.tar.gz
name: dist_wranglerjs
- job: deploy
dependsOn:
- dist_linux
- dist_darwin
- dist_windows
- dist_wranglerjs
displayName: "Deploy release binaries"
steps:
- template: ci/azure-install-rust.yml
- task: DownloadPipelineArtifact@0
displayName: "Download dist - windows"
inputs:
artifactName: dist_windows
targetPath: tmp/windows
- task: DownloadPipelineArtifact@0
displayName: "Download dist - wranglerjs"
inputs:
artifactName: dist_wranglerjs
targetPath: tmp/wranglerjs
- task: DownloadPipelineArtifact@0
displayName: "Download dist - linux"
inputs:
artifactName: dist_linux
targetPath: tmp/linux
- task: DownloadPipelineArtifact@0
displayName: "Download dist - darwin"
inputs:
artifactName: dist_darwin
targetPath: tmp/darwin
- script: |
set -ex
mkdir -p gh-release
find .
tag=`git describe --tags`
mk() {
target=$1
src=$2
name=wrangler-$tag-$target
mkdir -p tmp/$name
cp README.md \
LICENSE-MIT \
LICENSE-APACHE \
tmp/$src/wrangler* \
tmp/$name/
chmod +x tmp/$name/wrangler*
tar czvf gh-release/$name.tar.gz -C tmp $name
}
mk x86_64-unknown-linux-musl linux
mk x86_64-apple-darwin darwin
mk x86_64-pc-windows-msvc windows
mv -v tmp/wranglerjs/* gh-release/wranglerjs-$tag.tar.gz
displayName: "prepare the github releases tarball artifacts"
- task: PublishPipelineArtifact@0
displayName: "publish gh_release artifact"
inputs:
artifactName: gh_release
targetPath: gh-release
- task: GithubRelease@0
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
displayName: 'Create GitHub Release'
inputs:
gitHubConnection: ashleygwilliams-token
repositoryName: cloudflare/wrangler
assets: gh-release/*.tar.gz