Skip to content

Commit 47baf44

Browse files
committed
Implement a PyPI script in rust.
1 parent 0663f23 commit 47baf44

File tree

13 files changed

+701
-1
lines changed

13 files changed

+701
-1
lines changed

.taskcluster.yml

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ tasks:
1414
setup_pushapkscript: 'apt-get update && apt-get install -y default-jdk &&'
1515
setup_pushsnapscript: 'apt-get update && apt-get install -y libsodium-dev && truncate -s 0 /etc/os-release &&'
1616
setup_pushflatpakscript: 'apt-get update && apt-get install -y gir1.2-ostree-1.0 libgirepository1.0-dev &&'
17+
setup_rust: 'rustup component add clippy rustfmt &&'
1718
in:
1819
# [ <PROJECT NAME>, <PYTHON VERSION>, <SETUP COMMAND>, <DOCKERHUB REPO>]
1920
- ['client', '37', '', '']
@@ -44,6 +45,7 @@ tasks:
4445
- ['signingscript', '38', '', 'mozilla/releng-signingscript']
4546
- ['treescript', '37', '', '']
4647
- ['treescript', '38', '', 'mozilla/releng-treescript']
48+
- ['rust', 'rust', '${setup_rust}', '']
4749
# -------------------------------------------------------------------------
4850

4951
HEAD_REV:
@@ -68,6 +70,8 @@ tasks:
6870
$if: 'tasks_for == "github-push" && event.ref[0:11] == "refs/heads/"'
6971
then: '${event.ref[11:]}'
7072
else: 'unknown'
73+
74+
rust_version: 1.43
7175
in:
7276
$flatten:
7377
$map: { "$eval": "PROJECTS" }
@@ -115,7 +119,7 @@ tasks:
115119
in:
116120
$match:
117121
# Run code linting and unit tests for each project
118-
'run_tests == "1"':
122+
'run_tests == "1" && project_name != "rust"':
119123
taskId: '${as_slugid(project_name + python_version)}'
120124
provisionerId: 'releng-t'
121125
workerType: 'linux'
@@ -147,6 +151,37 @@ tasks:
147151
description: 'Code linting and unit tests for ${project_name} on python ${python_version[0]}.${python_version[1]}'
148152
owner: '${OWNER}'
149153
source: '${REPO_URL}/raw/${HEAD_REV}/.taskcluster.yml'
154+
'run_tests == "1" && project_name == "rust"':
155+
taskId: '${as_slugid("rust")}'
156+
provisionerId: 'releng-t'
157+
workerType: 'linux'
158+
created: { $fromNow: '' }
159+
deadline: { $fromNow: '4 hours' }
160+
payload:
161+
maxRunTime: 3600
162+
image: 'rust:${rust_version}'
163+
command:
164+
- sh
165+
- -xce
166+
- >-
167+
cd /tmp &&
168+
wget ${REPO_URL}/archive/${HEAD_REV}.tar.gz &&
169+
tar zxf ${HEAD_REV}.tar.gz &&
170+
mv scriptworker-scripts-${HEAD_REV} /src &&
171+
cd /src && ${setup_command}
172+
cargo test && cargo clippy && cargo fmt -- --check
173+
metadata:
174+
name:
175+
$let:
176+
test_task_number:
177+
$if: 'dockerhub_repo != ""'
178+
then: '${i+1}.1'
179+
else: '${i+1}'
180+
in:
181+
'${number_prefix}${test_task_number}. ${project_name}: Run rust checks [on ${BRANCH_NAME}]'
182+
description: 'Code linting and unit tests for rust code on rust ${rust_version}'
183+
owner: '${OWNER}'
184+
source: '${REPO_URL}/raw/${HEAD_REV}/.taskcluster.yml'
150185
# Build docker image and (optionally) push to docker hub
151186
'run_tests == "1" && dockerhub_repo != ""':
152187
taskId: '${as_slugid(project_name + "docker_build_and_push")}'

Cargo.lock

Lines changed: 172 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[workspace]
2+
3+
members = [
4+
"pypiscript",
5+
"script",
6+
]

pypiscript/Cargo.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[package]
2+
name = "pypiscript"
3+
version = "0.1.0"
4+
authors = ["Tom Prince <[email protected]>"]
5+
edition = "2018"
6+
7+
[dependencies]
8+
serde = "1.0.99"
9+
serde_derive = "1.0.99"
10+
scriptworker_script = { path = "../script" }

pypiscript/config-example.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"taskcluster_scope_prefix": "project:releng",
3+
"project_config_file": "/Depot/Mozilla/scriptworker-scripts/pypiscript/passwords.yml"
4+
}

0 commit comments

Comments
 (0)