DeepSpeech/taskcluster/node-gyp-cache-base.tyml
2020-02-14 12:55:47 +01:00

58 lines
2.1 KiB
Plaintext

$if: 'event.event in build.allowed'
then:
taskId: ${taskcluster.taskId}
provisionerId: ${taskcluster.docker.provisionerId}
workerType: ${taskcluster.docker.workerType}
taskGroupId: ${taskcluster.taskGroupId}
schedulerId: ${taskcluster.schedulerId}
created: { $fromNow: '0 sec' }
deadline: { $fromNow: '1 day' }
expires: { $fromNow: '6 months' }
scopes:
- "index:insert-task:project.deepspeech.*"
payload:
maxRunTime: { $eval: to_int(build.maxRunTime) }
image: "node:12"
features:
taskclusterProxy: true
# This task will inspect system.node_gyp_cache taskcluster index existence:
# - if the artifact does not exists, it will build it
# - if the artifact exists, it will re-mirror it (if we don't do that, new
# index gets published with no artifact and erases existing one)
command:
- "/bin/bash"
- "--login"
- "-cxe"
- $let:
extraSystemSetup: { $eval: strip(str(build.system_setup)) }
taskIndexExpire: { $fromNow: '6 months' }
in: >
apt-get -qq update && apt-get -qq -y install curl git && ${extraSystemSetup};
cache_file=`curl -sSIL -o /dev/null -w "%{http_code}" ${system.node_gyp_cache.url}` &&
if [ "$cache_file" != "200" ]; then
mkdir -p ~/DeepSpeech/ds/ &&
git clone --quiet ${event.head.repo.url} ~/DeepSpeech/ds/ &&
cd ~/DeepSpeech/ds && git checkout --quiet ${event.head.sha} &&
~/DeepSpeech/ds/${build.scripts.build} &&
~/DeepSpeech/ds/${build.scripts.package} &&
curl -sSL --fail -X PUT \
-H "Content-Type: application/json" \
-d "{\"taskId\":\"$TASK_ID\",\"rank\":0,\"expires\":\"${taskIndexExpire}\",\"data\":{}}" \
"http://taskcluster/index/v1/task/${system.node_gyp_cache.namespace}"
fi;
artifacts:
"public":
type: "directory"
path: "/tmp/artifacts/"
expires: { $fromNow: '6 months' }
metadata:
name: ${build.metadata.name}
description: ${build.metadata.description}
owner: ${event.head.user.email}
source: ${event.head.repo.url}