DeepSpeech/taskcluster/node-gyp-cache-base.tyml
2020-02-11 12:46:19 +01:00

52 lines
1.9 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' }
routes: { $eval: build.routes }
payload:
maxRunTime: { $eval: to_int(build.maxRunTime) }
image: "node:12"
# 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)) }
extraSystemConfig: { $eval: strip(str(build.system_config)) }
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}` &&
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}
else
mkdir -p /tmp/artifacts/ && curl -sSL -o /tmp/artifacts/node-gyp-cache.tar.gz ${system.node_gyp_cache}
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}