forked from jamiebuilds/codeowners-enforcer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
177 lines (169 loc) · 5.55 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
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.14
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