]> git.lizzy.rs Git - rust.git/blob - src/ci/scripts/upload-artifacts.sh
Merge commit '7b73b60faca71d01d900e49831fcb84553e93019' into sync-rustfmt
[rust.git] / src / ci / scripts / upload-artifacts.sh
1 #!/bin/bash
2 # Upload all the artifacts to our S3 bucket. All the files inside ${upload_dir}
3 # will be uploaded to the deploy bucket and eventually signed and released in
4 # static.rust-lang.org.
5
6 set -euo pipefail
7 IFS=$'\n\t'
8
9 source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"
10
11 upload_dir="$(mktemp -d)"
12
13 build_dir=build
14 if isLinux; then
15     build_dir=obj/build
16 fi
17
18 # Release tarballs produced by a dist builder.
19 if [[ "${DEPLOY-0}" -eq "1" ]] || [[ "${DEPLOY_ALT-0}" -eq "1" ]]; then
20     dist_dir="${build_dir}/dist"
21     rm -rf "${dist_dir}/doc"
22     cp -r "${dist_dir}"/* "${upload_dir}"
23 fi
24
25 # CPU usage statistics.
26 cp cpu-usage.csv "${upload_dir}/cpu-${CI_JOB_NAME}.csv"
27
28 # Build metrics generated by x.py.
29 cp "${build_dir}/metrics.json" "${upload_dir}/metrics-${CI_JOB_NAME}.json"
30
31 # Toolstate data.
32 if [[ -n "${DEPLOY_TOOLSTATES_JSON+x}" ]]; then
33     cp /tmp/toolstate/toolstates.json "${upload_dir}/${DEPLOY_TOOLSTATES_JSON}"
34 fi
35
36 echo "Files that will be uploaded:"
37 ls -lah "${upload_dir}"
38 echo
39
40 deploy_dir="rustc-builds"
41 if [[ "${DEPLOY_ALT-0}" -eq "1" ]]; then
42     deploy_dir="rustc-builds-alt"
43 fi
44 deploy_url="s3://${DEPLOY_BUCKET}/${deploy_dir}/$(ciCommit)"
45
46 retry aws s3 cp --storage-class INTELLIGENT_TIERING \
47     --no-progress --recursive --acl public-read "${upload_dir}" "${deploy_url}"