diff options
| author | Pietro Albini <pietro@pietroalbini.org> | 2019-11-25 15:05:21 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-11-25 15:05:21 +0100 |
| commit | c75044f4633413780ba714dcea2bd6e7a2eca9b1 (patch) | |
| tree | 886666084265a5c984ac4f97ae7aae289839ad5b /src/ci/scripts | |
| parent | 2b4af1036732d5fbb2e472e0a243d7057a03fcf8 (diff) | |
| parent | 90a37bce44d145715eeac9f1f2f34433fc813ef0 (diff) | |
| download | rust-c75044f4633413780ba714dcea2bd6e7a2eca9b1.tar.gz rust-c75044f4633413780ba714dcea2bd6e7a2eca9b1.zip | |
Rollup merge of #66569 - pietroalbini:gha-1, r=alexcrichton
GitHub Actions: preparations, part 1 This PR adds the first batch of commits in preparation for GitHub Actions: * Added GitHub Actions support in `src/ci/shared.sh` and bootstrap. * Addded a `setup-environment.sh` script which guesses and sets the `DEPLOY`, `DEPLOY_ALT` and `IMAGE` environment variables automatically, to reduce the verbosity of the CI configuration. This PR does **not** yet add any builders on GitHub Actions. r? @alexcrichton
Diffstat (limited to 'src/ci/scripts')
| -rwxr-xr-x | src/ci/scripts/install-mingw.sh | 2 | ||||
| -rwxr-xr-x | src/ci/scripts/install-msys2.sh | 6 | ||||
| -rwxr-xr-x | src/ci/scripts/setup-environment.sh | 31 |
3 files changed, 35 insertions, 4 deletions
diff --git a/src/ci/scripts/install-mingw.sh b/src/ci/scripts/install-mingw.sh index 8b579587b9e..98373df7fce 100755 --- a/src/ci/scripts/install-mingw.sh +++ b/src/ci/scripts/install-mingw.sh @@ -52,7 +52,7 @@ if isWindows; then 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${bits}/bin" + ciCommandAddPath "$(ciCheckoutPath)/msys2/mingw${bits}/bin" else mingw_dir="mingw${bits}" 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/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 |
