Skip to content

Commit

Permalink
Implement a PyPI script in rust.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomprince committed May 10, 2020
1 parent 0663f23 commit 47baf44
Show file tree
Hide file tree
Showing 13 changed files with 701 additions and 1 deletion.
37 changes: 36 additions & 1 deletion .taskcluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ tasks:
setup_pushapkscript: 'apt-get update && apt-get install -y default-jdk &&'
setup_pushsnapscript: 'apt-get update && apt-get install -y libsodium-dev && truncate -s 0 /etc/os-release &&'
setup_pushflatpakscript: 'apt-get update && apt-get install -y gir1.2-ostree-1.0 libgirepository1.0-dev &&'
setup_rust: 'rustup component add clippy rustfmt &&'
in:
# [ <PROJECT NAME>, <PYTHON VERSION>, <SETUP COMMAND>, <DOCKERHUB REPO>]
- ['client', '37', '', '']
Expand Down Expand Up @@ -44,6 +45,7 @@ tasks:
- ['signingscript', '38', '', 'mozilla/releng-signingscript']
- ['treescript', '37', '', '']
- ['treescript', '38', '', 'mozilla/releng-treescript']
- ['rust', 'rust', '${setup_rust}', '']
# -------------------------------------------------------------------------

HEAD_REV:
Expand All @@ -68,6 +70,8 @@ tasks:
$if: 'tasks_for == "github-push" && event.ref[0:11] == "refs/heads/"'
then: '${event.ref[11:]}'
else: 'unknown'

rust_version: 1.43
in:
$flatten:
$map: { "$eval": "PROJECTS" }
Expand Down Expand Up @@ -115,7 +119,7 @@ tasks:
in:
$match:
# Run code linting and unit tests for each project
'run_tests == "1"':
'run_tests == "1" && project_name != "rust"':
taskId: '${as_slugid(project_name + python_version)}'
provisionerId: 'releng-t'
workerType: 'linux'
Expand Down Expand Up @@ -147,6 +151,37 @@ tasks:
description: 'Code linting and unit tests for ${project_name} on python ${python_version[0]}.${python_version[1]}'
owner: '${OWNER}'
source: '${REPO_URL}/raw/${HEAD_REV}/.taskcluster.yml'
'run_tests == "1" && project_name == "rust"':
taskId: '${as_slugid("rust")}'
provisionerId: 'releng-t'
workerType: 'linux'
created: { $fromNow: '' }
deadline: { $fromNow: '4 hours' }
payload:
maxRunTime: 3600
image: 'rust:${rust_version}'
command:
- sh
- -xce
- >-
cd /tmp &&
wget ${REPO_URL}/archive/${HEAD_REV}.tar.gz &&
tar zxf ${HEAD_REV}.tar.gz &&
mv scriptworker-scripts-${HEAD_REV} /src &&
cd /src && ${setup_command}
cargo test && cargo clippy && cargo fmt -- --check
metadata:
name:
$let:
test_task_number:
$if: 'dockerhub_repo != ""'
then: '${i+1}.1'
else: '${i+1}'
in:
'${number_prefix}${test_task_number}. ${project_name}: Run rust checks [on ${BRANCH_NAME}]'
description: 'Code linting and unit tests for rust code on rust ${rust_version}'
owner: '${OWNER}'
source: '${REPO_URL}/raw/${HEAD_REV}/.taskcluster.yml'
# Build docker image and (optionally) push to docker hub
'run_tests == "1" && dockerhub_repo != ""':
taskId: '${as_slugid(project_name + "docker_build_and_push")}'
Expand Down
172 changes: 172 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[workspace]

members = [
"pypiscript",
"script",
]
10 changes: 10 additions & 0 deletions pypiscript/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "pypiscript"
version = "0.1.0"
authors = ["Tom Prince <[email protected]>"]
edition = "2018"

[dependencies]
serde = "1.0.99"
serde_derive = "1.0.99"
scriptworker_script = { path = "../script" }
4 changes: 4 additions & 0 deletions pypiscript/config-example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"taskcluster_scope_prefix": "project:releng",
"project_config_file": "/Depot/Mozilla/scriptworker-scripts/pypiscript/passwords.yml"
}
Loading

0 comments on commit 47baf44

Please sign in to comment.