trigger:
branches:
include:
- refs/heads/master
- refs/tags/*
jobs:
- job: test_codeowners_enforcer
displayName: "Run codeowners-enforcer tests, fmt, and clippy"
steps:
- template: ci/azure-install-rust.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"
- script: rustup component add clippy
displayName: rustup component add clippy
- script: cargo clippy
displayName: "cargo clippy"
- job: test_codeowners_enforcer_windows
displayName: "Run codeowners-enforcer 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
- job: test_codeowners_enforcer_nightly
displayName: "Run codeowners-enforcer 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
- 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 --release
- template: ci/azure-create-tarball.yml
parameters:
artifacts: target/x86_64-unknown-linux-musl/release/codeowners-enforcer
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: github_deploy
dependsOn:
- test_codeowners_enforcer
- test_codeowners_enforcer_windows
- test_codeowners_enforcer_nightly
- 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
tag=$(git tag -l --points-at HEAD)
sha=$(git rev-parse --short HEAD)
ref=${tag:-$sha}
mk() {
target=$1
src=$2
name=codeowners-enforcer-$ref-$target
mkdir -p tmp/$name
cp README.md \
LICENSE \
tmp/$src/codeowners-enforcer* \
tmp/$name/
chmod +x tmp/$name/codeowners-enforcer*
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: jamiebuilds-deploy
repositoryName: jamiebuilds/codeowners-enforcer
assets: gh-release/*.tar.gz
- job: cargo_publish
displayName: Publish to crates.io
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
dependsOn:
- test_codeowners_enforcer
- test_codeowners_enforcer_windows
- test_codeowners_enforcer_nightly
steps:
- template: ci/azure-install-rust.yml
- script: cargo login $(cargoLoginToken)
- script: cargo package
- script: cargo publish
- job: npm_publish
displayName: Pubish to npm
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
dependsOn:
- test_codeowners_enforcer
- test_codeowners_enforcer_windows
- test_codeowners_enforcer_nightly
- github_deploy
steps:
- template: ci/azure-install-node.yml
- task: Npm@1
displayName: Publish to npm
inputs:
command: publish
publishEndpoint: jamiebuilds-npm-publish