From a0422c4670680b6b5de9b784209136ccbdefb174 Mon Sep 17 00:00:00 2001 From: Ashley Williams Date: Fri, 5 Apr 2019 17:33:25 -0500 Subject: [PATCH] feat(release): make macOS, windows, linux-musl binaries --- azure-pipelines.yml | 107 ++++++++++++++++++++++++++++++++++++ ci/azure-create-tarball.yml | 14 +++++ 2 files changed, 121 insertions(+) create mode 100644 ci/azure-create-tarball.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 4f5b989fd..93f3808f7 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,3 +1,9 @@ +trigger: + branches: + include: + - refs/heads/master + - refs/tags/* + jobs: - job: test_wrangler displayName: "Run wrangler tests, fmt, and clippy" @@ -27,3 +33,104 @@ jobs: toolchain: nightly - script: cargo test --locked displayName: "cargo test --locked" + + - 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 + 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: deploy + dependsOn: + - dist_linux + - dist_darwin + - dist_windows + 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 - 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 + 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 diff --git a/ci/azure-create-tarball.yml b/ci/azure-create-tarball.yml new file mode 100644 index 000000000..b99637156 --- /dev/null +++ b/ci/azure-create-tarball.yml @@ -0,0 +1,14 @@ +parameters: + artifacts: 'target/release' + name: '' + +steps: + - bash: | + set -ex + dst=$BUILD_ARTIFACTSTAGINGDIRECTORY + cp ${{ parameters.artifacts }}/wrangler $dst/ + displayName: Create distribution tarball + - task: PublishPipelineArtifact@0 + inputs: + artifactName: ${{ parameters.name }} + targetPath: '$(Build.ArtifactStagingDirectory)'