about summary refs log tree commit diff
path: root/src/ci/scripts
diff options
context:
space:
mode:
authorPeter <peter.wilkins@polecat.com>2019-12-08 23:16:18 +0000
committerPeter <peter.wilkins@polecat.com>2019-12-08 23:49:30 +0000
commit8f6a06285efe12d778ff7f44067aebeed7b14428 (patch)
tree856b9d17a8e4700c44a2794e63ec75ecf9660397 /src/ci/scripts
parent947772fc31b96ce90f57720f74571f14e35df66b (diff)
parent59947fcae6a40df12e33af8c8c7291014b7603e0 (diff)
downloadrust-8f6a06285efe12d778ff7f44067aebeed7b14428.tar.gz
rust-8f6a06285efe12d778ff7f44067aebeed7b14428.zip
move from non zero impls to `libcore/convert/num.rs`
Diffstat (limited to 'src/ci/scripts')
-rwxr-xr-xsrc/ci/scripts/collect-cpu-stats.sh9
-rwxr-xr-xsrc/ci/scripts/install-clang.sh2
-rwxr-xr-xsrc/ci/scripts/install-mingw.sh37
-rwxr-xr-xsrc/ci/scripts/install-msys2.sh6
-rwxr-xr-xsrc/ci/scripts/run-build-from-ci.sh21
-rwxr-xr-xsrc/ci/scripts/setup-environment.sh31
6 files changed, 93 insertions, 13 deletions
diff --git a/src/ci/scripts/collect-cpu-stats.sh b/src/ci/scripts/collect-cpu-stats.sh
new file mode 100755
index 00000000000..08065431f98
--- /dev/null
+++ b/src/ci/scripts/collect-cpu-stats.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+# Spawn a background process to collect CPU usage statistics which we'll upload
+# at the end of the build. See the comments in the script here for more
+# information.
+
+set -euo pipefail
+IFS=$'\n\t'
+
+python src/ci/cpu-usage-over-time.py &> cpu-usage.csv &
diff --git a/src/ci/scripts/install-clang.sh b/src/ci/scripts/install-clang.sh
index b1e9bf92ca5..f0179994e8e 100755
--- a/src/ci/scripts/install-clang.sh
+++ b/src/ci/scripts/install-clang.sh
@@ -17,7 +17,7 @@ if isMacOS; then
     # Configure `AR` specifically so rustbuild doesn't try to infer it as
     # `clang-ar` by accident.
     ciCommandSetEnv AR "ar"
-elif isWindows && [[ -z ${MINGW_URL+x} ]]; then
+elif isWindows && [[ ${CUSTOM_MINGW-0} -ne 1 ]]; then
     # If we're compiling for MSVC then we, like most other distribution builders,
     # switch to clang as the compiler. This'll allow us eventually to enable LTO
     # amongst LLVM and rustc. Note that we only do this on MSVC as I don't think
diff --git a/src/ci/scripts/install-mingw.sh b/src/ci/scripts/install-mingw.sh
index b4e8b889f52..98373df7fce 100755
--- a/src/ci/scripts/install-mingw.sh
+++ b/src/ci/scripts/install-mingw.sh
@@ -27,19 +27,38 @@ IFS=$'\n\t'
 
 source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"
 
+MINGW_ARCHIVE_32="i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z"
+MINGW_ARCHIVE_64="x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z"
+
 if isWindows; then
-    if [[ -z "${MINGW_URL+x}" ]]; then
-        arch=i686
-        if [ "$MSYS_BITS" = "64" ]; then
-          arch=x86_64
-        fi
+    case "${CI_JOB_NAME}" in
+        *i686*)
+            bits=32
+            arch=i686
+            mingw_archive="${MINGW_ARCHIVE_32}"
+            ;;
+        *x86_64*)
+            bits=64
+            arch=x86_64
+            mingw_archive="${MINGW_ARCHIVE_64}"
+            ;;
+        *)
+            echo "src/ci/scripts/install-mingw.sh can't detect the builder's architecture"
+            echo "please tweak it to recognize the builder named '${CI_JOB_NAME}'"
+            exit 1
+            ;;
+    esac
+
+    if [[ "${CUSTOM_MINGW-0}" -ne 1 ]]; then
         pacman -S --noconfirm --needed mingw-w64-$arch-toolchain mingw-w64-$arch-cmake \
             mingw-w64-$arch-gcc mingw-w64-$arch-python2
-        ciCommandAddPath "${SYSTEM_WORKFOLDER}/msys2/mingw${MSYS_BITS}/bin"
+        ciCommandAddPath "$(ciCheckoutPath)/msys2/mingw${bits}/bin"
     else
-        curl -o mingw.7z "${MINGW_URL}/${MINGW_ARCHIVE}"
+        mingw_dir="mingw${bits}"
+
+        curl -o mingw.7z "${MIRRORS_BASE}/${mingw_archive}"
         7z x -y mingw.7z > /dev/null
-        curl -o "${MINGW_DIR}/bin/gdborig.exe" "${MINGW_URL}/2017-04-20-${MSYS_BITS}bit-gdborig.exe"
-        ciCommandAddPath "$(pwd)/${MINGW_DIR}/bin"
+        curl -o "${mingw_dir}/bin/gdborig.exe" "${MIRRORS_BASE}/2017-04-20-${bits}bit-gdborig.exe"
+        ciCommandAddPath "$(pwd)/${mingw_dir}/bin"
     fi
 fi
diff --git a/src/ci/scripts/install-msys2.sh b/src/ci/scripts/install-msys2.sh
index ce37c3b1469..c9fafc7fe6b 100755
--- a/src/ci/scripts/install-msys2.sh
+++ b/src/ci/scripts/install-msys2.sh
@@ -12,8 +12,8 @@ IFS=$'\n\t'
 source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"
 
 if isWindows; then
-    choco install msys2 --params="/InstallDir:${SYSTEM_WORKFOLDER}/msys2 /NoPath" -y --no-progress
-    mkdir -p "${SYSTEM_WORKFOLDER}/msys2/home/${USERNAME}"
+    choco install msys2 --params="/InstallDir:$(ciCheckoutPath)/msys2 /NoPath" -y --no-progress
+    mkdir -p "$(ciCheckoutPath)/msys2/home/${USERNAME}"
 
-    ciCommandAddPath "${SYSTEM_WORKFOLDER}/msys2/usr/bin"
+    ciCommandAddPath "$(ciCheckoutPath)/msys2/usr/bin"
 fi
diff --git a/src/ci/scripts/run-build-from-ci.sh b/src/ci/scripts/run-build-from-ci.sh
new file mode 100755
index 00000000000..c02117f459d
--- /dev/null
+++ b/src/ci/scripts/run-build-from-ci.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+# Start the CI build. You shouldn't run this locally: call either src/ci/run.sh
+# or src/ci/docker/run.sh instead.
+
+set -euo pipefail
+IFS=$'\n\t'
+
+source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"
+
+export CI="true"
+export SRC=.
+
+# Remove any preexisting rustup installation since it can interfere
+# with the cargotest step and its auto-detection of things like Clippy in
+# the environment
+rustup self uninstall -y || true
+if [ -z "${IMAGE+x}" ]; then
+    src/ci/run.sh
+else
+    src/ci/docker/run.sh "${IMAGE}"
+fi
diff --git a/src/ci/scripts/setup-environment.sh b/src/ci/scripts/setup-environment.sh
new file mode 100755
index 00000000000..e126a06edab
--- /dev/null
+++ b/src/ci/scripts/setup-environment.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+# This script guesses some environment variables based on the builder name and
+# the current platform, to reduce the amount of variables defined in the CI
+# configuration.
+
+set -euo pipefail
+IFS=$'\n\t'
+
+source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"
+
+# Builders starting with `dist-` are dist builders, but if they also end with
+# `-alt` they are alternate dist builders.
+if [[ "${CI_JOB_NAME}" = dist-* ]]; then
+    if [[ "${CI_JOB_NAME}" = *-alt ]]; then
+        echo "alternate dist builder detected, setting DEPLOY_ALT=1"
+        ciCommandSetEnv DEPLOY_ALT 1
+    else
+        echo "normal dist builder detected, setting DEPLOY=1"
+        ciCommandSetEnv DEPLOY 1
+    fi
+fi
+
+# All the Linux builds happen inside Docker.
+if isLinux; then
+    if [[ -z "${IMAGE+x}" ]]; then
+        echo "linux builder detected, using docker to run the build"
+        ciCommandSetEnv IMAGE "${CI_JOB_NAME}"
+    else
+        echo "a custom docker image is already set"
+    fi
+fi