about summary refs log tree commit diff
path: root/src/ci/scripts
diff options
context:
space:
mode:
authorPietro Albini <pietro@pietroalbini.org>2019-10-10 17:04:44 +0200
committerPietro Albini <pietro@pietroalbini.org>2019-10-29 10:07:39 +0100
commit4479de4b4a375e792127ddcbcb5f91e3b58ce237 (patch)
tree7c4750b6a9873d70cb5951050d4b5954722a11cf /src/ci/scripts
parent2dd4e7320e620dc9a59423c55a7db3520ba8b553 (diff)
downloadrust-4479de4b4a375e792127ddcbcb5f91e3b58ce237.tar.gz
rust-4479de4b4a375e792127ddcbcb5f91e3b58ce237.zip
ci: extract uploading artifacts into a script
Diffstat (limited to 'src/ci/scripts')
-rwxr-xr-xsrc/ci/scripts/upload-artifacts.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/ci/scripts/upload-artifacts.sh b/src/ci/scripts/upload-artifacts.sh
new file mode 100755
index 00000000000..2d24fc53a95
--- /dev/null
+++ b/src/ci/scripts/upload-artifacts.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+# Upload all the artifacts to our S3 bucket. All the files inside ${upload_dir}
+# will be uploaded to the deploy bucket and eventually signed and released in
+# static.rust-lang.org.
+
+set -euo pipefail
+IFS=$'\n\t'
+
+source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"
+
+upload_dir="$(mktemp -d)"
+
+# Release tarballs produced by a dist builder.
+if [[ "${DEPLOY-0}" = "1" ]] || [[ "${DEPLOY_ALT-0}" = "1" ]]; then
+    dist_dir=build/dist
+    if isLinux; then
+        dist_dir=obj/build/dist
+    fi
+    rm -rf "${dist_dir}/doc"
+    cp -r "${dist_dir}"/* "${upload_dir}"
+fi
+
+# CPU usage statistics.
+cp cpu-usage.csv "${upload_dir}/cpu-${CI_JOB_NAME}.csv"
+
+echo "Files that will be uploaded:"
+ls -lah "${upload_dir}"
+echo
+
+deploy_dir="rustc-builds"
+if [[ "${DEPLOY_ALT-0}" = "1" ]]; then
+    deploy_dir="rustc-builds-alt"
+fi
+deploy_url="s3://${DEPLOY_BUCKET}/${deploy_dir}/$(ciCommit)"
+
+retry aws s3 cp --no-progress --recursive --acl public-read "${upload_dir}" "${deploy_url}"