DeepSpeech/taskcluster/darwin-opt-base.tyml
Alexandre Lissy 81b333c2f5 Ensure proper cleanup on macOS workers
It seems like `-e` does is job and bash catches faulty exit code, thus
avoiding the required `mv` for dealing with caches. Relying on 'trap' is
the proper way to always go through this code path and ensure picking
the exit code.
2019-05-27 08:53:52 +02:00

126 lines
4.9 KiB
Plaintext

taskId: ${taskcluster.taskId}
provisionerId: ${taskcluster.generic.provisionerId}
workerType: ${taskcluster.generic.workerType}
taskGroupId: ${taskcluster.taskGroupId}
schedulerId: ${taskcluster.schedulerId}
dependencies:
$map: { $eval: build.dependencies }
each(b):
$eval: as_slugid(b)
created: { $fromNow: '0 sec' }
deadline: { $fromNow: '1 day' }
expires:
$if: '(event.event == "push") || (event.event == "tag")'
then: { $fromNow: '6 months' }
else: { $fromNow: '7 days' }
extra:
nc_asset_name: { $eval: build.nc_asset_name }
github:
$if: '(event.event == "push") || (event.event == "tag")'
then: { $eval: taskcluster.github_events.merge }
else: { $eval: taskcluster.github_events.pull_request }
routes:
$if: '(event.event == "push") || (event.event == "tag")'
then:
{ $eval: build.routes }
scopes:
$if: '(event.event != "push") && (event.event != "tag")'
then:
- generic-worker:cache:deepspeech-homebrew-bin
- generic-worker:cache:deepspeech-homebrew-cache
payload:
maxRunTime: { $eval: to_int(build.maxRunTime) }
env:
$let:
training: { $eval: as_slugid("test-training_upstream-linux-amd64-py35m-opt") }
in:
TENSORFLOW_BUILD_ARTIFACT: ${build.tensorflow}
DEEPSPEECH_TEST_MODEL: https://queue.taskcluster.net/v1/task/${training}/artifacts/public/output_graph.pb
# There is no VM yet running tasks on OSX
# so one should install by hand:
# - brew
# - xcode (brew would install)
# - brew install gnu-tar
# - brew install git
# - brew install pixz
# - brew cask install java
# - sudo easy_install pip
#
# gtar needed for --transform
# --transform used to rewrite symlinks
# this rewrite should take care of tranforming
# - ${system.homedir.osx}/TaskCluster/Tasks/task_[[:digit:]]\{10\}/
# - ${system.homedir.osx}/TaskCluster/HeavyTasks/X/task_[[:digit:]]\{10\}/
# - ${system.homedir.osx}/TaskCluster/LightTasks/X/task_[[:digit:]]\{10\}/
# into
# - $TASKCLUSTER_TASK_DIR/
# => goal:
# - no dangling symlink that points to broken/invalid path
# all symlinks should point to (full)path scoped only on this task
# - no file referring to anything else than $TASKCLUSTER_TASK_DIR/
# sed to the rescue to change all text files that references the wrong
# dir and hopefully keep the tensorflow bazel cache usable
# - the huge grep -R serves this purpose (without, later build of
# native_client fails)
# - we need to remove from the grep result anything matching
# "generic-worker/" to avoid screwing the generic-worker/live_backing.log
# and this breaking the build in undebuggable ways
command:
- - "/bin/bash"
- "--login"
- "-cxe"
- >
export TASKCLUSTER_ARTIFACTS="$(pwd)/public/" &&
export TASKCLUSTER_ORIG_TASKDIR="$(pwd)" &&
(mkdir ../tc-workdir/ || rm -fr ../tc-workdir/*) && cd ../tc-workdir/ &&
(mv $TASKCLUSTER_ORIG_TASKDIR/homebrew/ homebrew/ || true) &&
(mv $TASKCLUSTER_ORIG_TASKDIR/homebrew.cache/ homebrew.cache/ || true) &&
export TASKCLUSTER_TASK_DIR="$(pwd)" &&
export LC_ALL=C &&
export PKG_CONFIG_PATH="$TASKCLUSTER_TASK_DIR/homebrew/lib/pkgconfig" &&
export MACOSX_DEPLOYMENT_TARGET=10.10 &&
export HOMEBREW_NO_AUTO_UPDATE=1 &&
env &&
trap "export TASKCLUSTER_TASK_EXIT_CODE=$? &&
mv $TASKCLUSTER_TASK_DIR/homebrew/ $TASKCLUSTER_ORIG_TASKDIR/homebrew/ &&
mv $TASKCLUSTER_TASK_DIR/homebrew.cache/ $TASKCLUSTER_ORIG_TASKDIR/homebrew.cache/ &&
cd $TASKCLUSTER_TASK_DIR/../ && rm -fr tc-workdir/ && exit $TASKCLUSTER_TASK_EXIT_CODE" EXIT &&
(wget -O - $TENSORFLOW_BUILD_ARTIFACT | pixz -d | gtar -C $TASKCLUSTER_TASK_DIR -xf - ) &&
git clone --quiet ${event.head.repo.url} $TASKCLUSTER_TASK_DIR/DeepSpeech/ds/ &&
cd $TASKCLUSTER_TASK_DIR/DeepSpeech/ds && git checkout --quiet ${event.head.sha} &&
ln -s $TASKCLUSTER_TASK_DIR/DeepSpeech/ds/native_client/ $TASKCLUSTER_TASK_DIR/DeepSpeech/tf/native_client &&
cd $TASKCLUSTER_TASK_DIR &&
$TASKCLUSTER_TASK_DIR/DeepSpeech/tf/tc-brew.sh &&
${swig.patch_nodejs.osx_v12} &&
$TASKCLUSTER_TASK_DIR/DeepSpeech/ds/${build.scripts.build} &&
$TASKCLUSTER_TASK_DIR/DeepSpeech/ds/${build.scripts.package}
artifacts:
- type: "directory"
path: "public/"
expires:
$if: '(event.event == "push") || (event.event == "tag")'
then: { $fromNow: '6 months' }
else: { $fromNow: '7 days' }
mounts:
$if: '(event.event != "push") && (event.event != "tag")'
then:
- cacheName: deepspeech-homebrew-bin
directory: homebrew/
- cacheName: deepspeech-homebrew-cache
directory: homebrew.cache/
metadata:
name: ${build.metadata.name}
description: ${build.metadata.description}
owner: ${event.head.user.email}
source: ${event.head.repo.url}