Skip to content

Commit 5b51fbf

Browse files
authored
Deploy rust-code-analysis for Windows (#165)
1 parent 0eb8f5d commit 5b51fbf

1 file changed

Lines changed: 90 additions & 10 deletions

File tree

.taskcluster.yml

Lines changed: 90 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ tasks:
123123

124124
- $if: 'tasks_for == "github-push" && head_branch[:10] == "refs/tags/"'
125125
then:
126-
taskId: {$eval: as_slugid("build_release")}
126+
taskId: {$eval: as_slugid("build_linux_release")}
127127
dependencies:
128128
- {$eval: as_slugid("lint_test_task")}
129129
- {$eval: as_slugid("windows_test_task")}
@@ -134,25 +134,101 @@ tasks:
134134
payload:
135135
maxRunTime: 3600
136136
image: "rust:buster"
137-
env:
138-
PROJECT_NAME: rust-code-analysis
139137
command:
140138
- "/bin/bash"
141139
- "-cx"
142140
- "git clone --recursive --quiet ${repository} &&
143141
cd rust-code-analysis &&
144142
git -c advice.detachedHead=false checkout ${head_rev} &&
145-
cargo build --release &&
143+
cargo build --all --release &&
146144
cd target/release &&
147-
tar -zvcf /build.tar.gz --transform 's,^,rust-code-analysis-linux-x86_64/,' rust-code-analysis"
145+
strip rust-code-analysis-cli &&
146+
tar -zvcf /build.tar.gz \
147+
--transform 's,^,rust-code-analysis-linux-x86_64/,' \
148+
rust-code-analysis-cli"
148149
artifacts:
149150
public/rust-code-analysis-linux-x86_64.tar.gz:
150151
expires: {$fromNow: '2 weeks'}
151152
path: /build.tar.gz
152153
type: file
153154
metadata:
154-
name: rust-code-analysis release build
155-
description: rust-code-analysis release build
155+
name: rust-code-analysis linux release build
156+
description: rust-code-analysis linux release build
157+
owner: cdenizet@mozilla.com
158+
source: ${repository}/raw/${head_rev}/.taskcluster.yml
159+
160+
- $if: 'tasks_for == "github-push" && head_branch[:10] == "refs/tags/"'
161+
then:
162+
taskId: {$eval: as_slugid("build_windows_release")}
163+
dependencies:
164+
- {$eval: as_slugid("lint_test_task")}
165+
- {$eval: as_slugid("windows_test_task")}
166+
created: {$fromNow: ''}
167+
deadline: {$fromNow: '2 hour'}
168+
provisionerId: proj-relman
169+
workerType: win2012r2
170+
payload:
171+
maxRunTime: 3600
172+
command:
173+
- set VSWHERE=%programfiles(x86)%\Microsoft Visual Studio\Installer
174+
- set VS_BINS=VC\Tools\MSVC\*\bin\Hostx64\x64
175+
- set RUSTUP_INIT_PATH=%CD%\rustup-init
176+
- set CARGO_PATH=%USERPROFILE%\.cargo\bin
177+
- set PATH=%RUSTUP_INIT_PATH%;%CARGO_PATH%;%VSWHERE%;%PATH%
178+
- set VSWHERE_CMD=vswhere -latest -products * -find %VS_BINS%
179+
- FOR /F "tokens=*" %%o IN ('%VSWHERE_CMD%') do (SET LIB_PATH=%%o)
180+
- set PATH=%LIB_PATH%;%PATH%
181+
- rustup-init -yv --default-toolchain stable ^
182+
--default-host x86_64-pc-windows-msvc
183+
- git clone --recursive --quiet ${repository}
184+
- cd rust-code-analysis
185+
- git -c advice.detachedHead=false checkout ${head_rev}
186+
- cargo build --all --release
187+
mounts:
188+
- content:
189+
url: https://win.rustup.rs/
190+
file: rustup-init\rustup-init.exe
191+
artifacts:
192+
- name: public/rust-code-analysis-cli.exe
193+
expires: {$fromNow: '2 weeks'}
194+
path: rust-code-analysis\target\release\rust-code-analysis-cli.exe
195+
type: file
196+
metadata:
197+
name: rust-code-analysis windows release build
198+
description: rust-code-analysis windows release build
199+
owner: cdenizet@mozilla.com
200+
source: ${repository}/raw/${head_rev}/.taskcluster.yml
201+
202+
- $if: 'tasks_for == "github-push" && head_branch[:10] == "refs/tags/"'
203+
then:
204+
taskId: {$eval: as_slugid("strip_windows_binary")}
205+
dependencies:
206+
- {$eval: as_slugid("build_windows_release")}
207+
created: {$fromNow: ''}
208+
deadline: {$fromNow: '2 hour'}
209+
provisionerId: proj-relman
210+
workerType: ci
211+
payload:
212+
maxRunTime: 3600
213+
image: "mozilla/taskboot:0.2.5"
214+
env:
215+
WINDOWS_BIN: rust-code-analysis-cli.exe
216+
command:
217+
- "/bin/sh"
218+
- "-cx"
219+
- "taskboot retrieve-artifact --output-path=. \
220+
--artifacts=$WINDOWS_BIN:public/$WINDOWS_BIN &&
221+
apk add --no-cache zip &&
222+
strip $WINDOWS_BIN &&
223+
zip -9 rust-code-analysis-windows-x86_64.zip $WINDOWS_BIN"
224+
artifacts:
225+
public/rust-code-analysis-windows-x86_64.zip:
226+
expires: {$fromNow: '2 weeks'}
227+
path: /rust-code-analysis-windows-x86_64.zip
228+
type: file
229+
metadata:
230+
name: strip rust-code-analysis windows binary
231+
description: strip rust-code-analysis windows binary
156232
owner: cdenizet@mozilla.com
157233
source: ${repository}/raw/${head_rev}/.taskcluster.yml
158234

@@ -163,7 +239,8 @@ tasks:
163239
in:
164240
taskId: {$eval: as_slugid("deploy_release")}
165241
dependencies:
166-
- {$eval: as_slugid("build_release")}
242+
- {$eval: as_slugid("build_linux_release")}
243+
- {$eval: as_slugid("strip_windows_binary")}
167244
created: {$fromNow: ''}
168245
deadline: {$fromNow: '2 hour'}
169246
provisionerId: proj-relman
@@ -174,15 +251,18 @@ tasks:
174251
features:
175252
taskclusterProxy: true
176253
maxRunTime: 3600
177-
image: "mozilla/taskboot:0.2.0"
254+
image: "mozilla/taskboot:0.2.5"
178255
env:
256+
LINUX_ARTIFACT: rust-code-analysis-linux-x86_64.tar.gz
257+
WINDOWS_ARTIFACT: rust-code-analysis-windows-x86_64.zip
179258
TASKCLUSTER_SECRET: project/relman/rust-code-analysis/deploy
180259
command:
181260
- taskboot
182261
- github-release
183262
- mozilla/rust-code-analysis
184263
- "${version}"
185-
- "--asset=rust-code-analysis-linux-x86_64.tar.gz:public/rust-code-analysis-linux-x86_64.tar.gz"
264+
- "--asset=$LINUX_ARTIFACT:public/$LINUX_ARTIFACT"
265+
- "--asset=$WINDOWS_ARTIFACT:public/$WINDOWS_ARTIFACT"
186266
metadata:
187267
name: "rust-code-analysis release publication ${version}"
188268
description: rust-code-analysis release publication on Github

0 commit comments

Comments
 (0)