From d63ce81e54d2bc901604b2fb121754e8fdfddb4d Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Fri, 30 Aug 2024 18:02:03 -0700 Subject: [PATCH 1/4] ci: Try to remove unused Xcode dirs --- src/ci/scripts/select-xcode.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/ci/scripts/select-xcode.sh b/src/ci/scripts/select-xcode.sh index 569c4a4136d97..0e88b9355a361 100755 --- a/src/ci/scripts/select-xcode.sh +++ b/src/ci/scripts/select-xcode.sh @@ -1,5 +1,6 @@ #!/bin/bash # This script selects the Xcode instance to use. +# It also tries to do some cleanup in CI jobs of unused Xcodes. set -euo pipefail IFS=$'\n\t' @@ -7,5 +8,21 @@ IFS=$'\n\t' source "$(cd "$(dirname "$0")" && pwd)/../shared.sh" if isMacOS; then + # This additional step is to try to remove an Xcode we aren't using because each one is HUGE + old_xcode="$(xcode-select --print-path)" + old_xcode="${old_xcode%/*}" # pop a dir + old_xcode="${old_xcode%/*}" # twice + if [[ $old_xcode =~ $SELECT_XCODE ]]; then + echo "xcode-select.sh's brutal hack may not be necessary?" + exit 1 + elif [[ $SELECT_XCODE =~ "16" ]]; then + echo "Using Xcode 16? Please fix xcode-select.sh" + exit 1 + fi + if [ $CI ]; then # just in case someone sources this on their real computer + sudo rm -rf "${old_xcode}" + xcode_16="${old_xcode:%/*}/Xcode-16.0.0.app" + sudo rm -rf "${xcode_16}" + fi sudo xcode-select -s "${SELECT_XCODE}" fi From 1167870748636a3fcf3d3f32ba9fa0c8511669ba Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Fri, 30 Aug 2024 18:03:04 -0700 Subject: [PATCH 2/4] ci: Use mv instead of cp in upload step --- src/ci/scripts/upload-artifacts.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ci/scripts/upload-artifacts.sh b/src/ci/scripts/upload-artifacts.sh index c9c85ec20b45a..587b324ce10e5 100755 --- a/src/ci/scripts/upload-artifacts.sh +++ b/src/ci/scripts/upload-artifacts.sh @@ -19,18 +19,18 @@ fi if [[ "${DEPLOY-0}" -eq "1" ]] || [[ "${DEPLOY_ALT-0}" -eq "1" ]]; then dist_dir="${build_dir}/dist" rm -rf "${dist_dir}/doc" - cp -r "${dist_dir}"/* "${upload_dir}" + mv "${dist_dir}"/* "${upload_dir}" fi # CPU usage statistics. -cp build/cpu-usage.csv "${upload_dir}/cpu-${CI_JOB_NAME}.csv" +mv build/cpu-usage.csv "${upload_dir}/cpu-${CI_JOB_NAME}.csv" # Build metrics generated by x.py. -cp "${build_dir}/metrics.json" "${upload_dir}/metrics-${CI_JOB_NAME}.json" +mv "${build_dir}/metrics.json" "${upload_dir}/metrics-${CI_JOB_NAME}.json" # Toolstate data. if [[ -n "${DEPLOY_TOOLSTATES_JSON+x}" ]]; then - cp /tmp/toolstate/toolstates.json "${upload_dir}/${DEPLOY_TOOLSTATES_JSON}" + mv /tmp/toolstate/toolstates.json "${upload_dir}/${DEPLOY_TOOLSTATES_JSON}" fi echo "Files that will be uploaded:" From ae2c68e0c1094db5545812b3f8f601b6469f7da4 Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Fri, 30 Aug 2024 18:13:33 -0700 Subject: [PATCH 3/4] ci: Avoid legacy backticks in upload-artifacts.sh --- src/ci/scripts/upload-artifacts.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ci/scripts/upload-artifacts.sh b/src/ci/scripts/upload-artifacts.sh index 587b324ce10e5..61c187fa77c01 100755 --- a/src/ci/scripts/upload-artifacts.sh +++ b/src/ci/scripts/upload-artifacts.sh @@ -55,7 +55,7 @@ then echo "# CI artifacts" >> "${GITHUB_STEP_SUMMARY}" for filename in "${upload_dir}"/*.xz; do - filename=`basename "${filename}"` + filename=$(basename "${filename}") echo "- [${filename}](${access_url}/${filename})" >> "${GITHUB_STEP_SUMMARY}" done fi From 10752a0f11d0a9e8ac7560185f7be51e518d560a Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Fri, 30 Aug 2024 19:28:58 -0700 Subject: [PATCH 4/4] ci: Take tail instead of head to avoid broken pipes --- src/ci/scripts/dump-environment.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/ci/scripts/dump-environment.sh b/src/ci/scripts/dump-environment.sh index 812690181e9bd..7afaa472f6e32 100755 --- a/src/ci/scripts/dump-environment.sh +++ b/src/ci/scripts/dump-environment.sh @@ -15,9 +15,7 @@ df -h echo echo "biggest files in the working dir:" -set +o pipefail -du . | sort -nr | head -n100 -set -o pipefail +du . | sort -n | tail -n100 | sort -nr # because piping sort to head gives a broken pipe echo if isMacOS