From 88a9f597487f839d2a6f1a431aa96f85182deb89 Mon Sep 17 00:00:00 2001 From: Martin Kinkelin Date: Wed, 14 Oct 2020 16:13:34 +0200 Subject: [PATCH] ci.sh: Consolidate DMD & D_VERSION to HOST_DC HOST_DC is more self-descriptive I think; DMD & D_VERSION are rather misleading for D host compiler and its version. Also get rid of the `install_d` arg and use HOST_DC directly. --- .cirrus.yml | 20 ++++++++------------ ci.sh | 18 +++++++++--------- cirrusci.sh | 9 ++++----- semaphoreci.sh | 16 ++++++---------- 4 files changed, 27 insertions(+), 36 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 861ef0eac2..714d2786a4 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -1,10 +1,6 @@ common_steps_template: &COMMON_STEPS_TEMPLATE install_prerequisites_script: ./cirrusci.sh - install_host_compiler_script: | - set -uexo pipefail - compiler="$DMD" - if [ -n "${D_VERSION+x}" ]; then compiler="$DMD-$D_VERSION"; fi - ./ci.sh install_d "$compiler" + install_host_compiler_script: ./ci.sh install_d setup_repos_script: | set -uexo pipefail ln -s $CIRRUS_WORKING_DIR ../dmd @@ -18,7 +14,7 @@ environment: CIRRUS_CLONE_DEPTH: 50 # for ci.sh: MODEL: 64 - DMD: dmd + HOST_DC: dmd N: 4 OS_NAME: linux FULL_BUILD: true @@ -37,14 +33,14 @@ task: MODEL: 32 - TASK_NAME_SUFFIX: x86, DMD (bootstrap) MODEL: 32 - D_VERSION: 2.079.0 + HOST_DC: dmd-2.079.0 - TASK_NAME_SUFFIX: x64, DMD (latest) - TASK_NAME_SUFFIX: x64, DMD (bootstrap) - D_VERSION: 2.079.0 + HOST_DC: dmd-2.079.0 - TASK_NAME_SUFFIX: x64, LDC - DMD: ldc + HOST_DC: ldc - TASK_NAME_SUFFIX: x64, GDC - DMD: gdmd-9 + HOST_DC: gdmd-9 << : *COMMON_STEPS_TEMPLATE # Mac @@ -62,7 +58,7 @@ task: - TASK_NAME_SUFFIX: DMD (bootstrap) # de-facto bootstrap version on OSX # See: https://forum.dlang.org/post/qfsgt2$1goc$1@digitalmars.com - D_VERSION: 2.088.0 + HOST_DC: dmd-2.088.0 << : *COMMON_STEPS_TEMPLATE # FreeBSD @@ -87,6 +83,6 @@ task: timeout_in: 60m environment: OS_NAME: freebsd - D_VERSION: 2.079.0 + HOST_DC: dmd-2.079.0 install_bash_script: pkg install -y bash << : *COMMON_STEPS_TEMPLATE diff --git a/ci.sh b/ci.sh index 55d27e5459..2117e0a032 100755 --- a/ci.sh +++ b/ci.sh @@ -13,8 +13,8 @@ if [ -z ${OS_NAME+x} ] ; then echo "Variable 'OS_NAME' needs to be set."; exit 1 if [ -z ${FULL_BUILD+x} ] ; then echo "Variable 'FULL_BUILD' needs to be set."; exit 1; fi # MODEL: 32|64 if [ -z ${MODEL+x} ] ; then echo "Variable 'MODEL' needs to be set."; exit 1; fi -# DMD: dmd|ldc|gdmd- (host compiler) -if [ -z ${DMD+x} ] ; then echo "Variable 'DMD' needs to be set."; exit 1; fi +# HOST_DC: dmd[-]|ldc[-]|gdmd- +if [ -z ${HOST_DC+x} ] ; then echo "Variable 'HOST_DC' needs to be set."; exit 1; fi CURL_USER_AGENT="DMD-CI $(curl --version | head -n 1)" build_path=generated/$OS_NAME/release/$MODEL @@ -49,7 +49,7 @@ clone() { # build dmd, druntime, phobos build() { - source ~/dlang/*/activate # activate host compiler + source ~/dlang/*/activate # activate host compiler, incl. setting `DMD` make -j$N -C src -f posix.mak MODEL=$MODEL HOST_DMD=$DMD ENABLE_RELEASE=1 ENABLE_WARNINGS=1 all make -j$N -C ../druntime -f posix.mak MODEL=$MODEL make -j$N -C ../phobos -f posix.mak MODEL=$MODEL @@ -180,9 +180,8 @@ download_install_sh() { } install_d() { - local compiler="$1" - if [ "${compiler:0:5}" == "gdmd-" ] ; then - local gdc_version="${compiler:5}" + if [ "${HOST_DC:0:5}" == "gdmd-" ] ; then + local gdc_version="${HOST_DC:5}" if [ ! -e ~/dlang/gdc-$gdc_version/activate ] ; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test sudo apt-get update @@ -192,12 +191,13 @@ install_d() { sudo chmod +x /usr/bin/gdmd-$gdc_version # fake install script and create a fake 'activate' script mkdir -p ~/dlang/gdc-$gdc_version - echo "deactivate(){ echo;}" > ~/dlang/gdc-$gdc_version/activate + echo "export DMD=gdmd-$gdc_version" > ~/dlang/gdc-$gdc_version/activate + echo "deactivate(){ echo;}" >> ~/dlang/gdc-$gdc_version/activate fi else local install_sh="install.sh" download_install_sh "$install_sh" - CURL_USER_AGENT="$CURL_USER_AGENT" bash "$install_sh" "$compiler" + CURL_USER_AGENT="$CURL_USER_AGENT" bash "$install_sh" "$HOST_DC" fi } @@ -205,7 +205,7 @@ install_d() { if [ "$#" -gt 0 ]; then case $1 in - install_d) install_d "$2" ;; # ci.sh install_d dmd[-]|ldc[-]|gdmd- + install_d) install_d ;; setup_repos) setup_repos "$2" ;; # ci.sh setup_repos build) build ;; rebuild) rebuild "${2:-}" ;; # ci.sh rebuild [1] (use `1` to compare binaries to test reproducible build) diff --git a/cirrusci.sh b/cirrusci.sh index e67494676d..a3a72bff8b 100755 --- a/cirrusci.sh +++ b/cirrusci.sh @@ -10,9 +10,8 @@ set -uexo pipefail if [ -z ${OS_NAME+x} ] ; then echo "Variable 'OS_NAME' needs to be set."; exit 1; fi # MODEL: 32|64 if [ -z ${MODEL+x} ] ; then echo "Variable 'MODEL' needs to be set."; exit 1; fi -# DMD: dmd|ldc|gdmd- (host compiler) -if [ -z ${DMD+x} ] ; then echo "Variable 'DMD' needs to be set."; exit 1; fi -# optional D_VERSION: fixed version of the (DMD) host compiler +# HOST_DC: dmd[-]|ldc[-]|gdmd- +if [ -z ${HOST_DC+x} ] ; then echo "Variable 'HOST_DC' needs to be set."; exit 1; fi if [ "$OS_NAME" == "linux" ]; then packages="git-core make g++ gdb curl libcurl3 tzdata zip unzip xz-utils" @@ -20,7 +19,7 @@ if [ "$OS_NAME" == "linux" ]; then dpkg --add-architecture i386 packages="$packages g++-multilib libcurl3-gnutls:i386" fi - if [ "${DMD:0:4}" == "gdmd" ]; then + if [ "${HOST_DC:0:4}" == "gdmd" ]; then # ci.sh uses `sudo add-apt-repository ...` to add a PPA repo packages="$packages sudo software-properties-common" fi @@ -31,7 +30,7 @@ elif [ "$OS_NAME" == "darwin" ]; then brew install gnupg elif [ "$OS_NAME" == "freebsd" ]; then packages="git gmake" - if [ "${D_VERSION:-x}" == "2.079.0" ] ; then + if [ "$HOST_DC" == "dmd-2.079.0" ] ; then packages="$packages lang/gcc9" fi pkg install -y $packages diff --git a/semaphoreci.sh b/semaphoreci.sh index 4ce5f3d7a9..35212fb4df 100755 --- a/semaphoreci.sh +++ b/semaphoreci.sh @@ -17,6 +17,10 @@ export DMD=${DMD:-dmd} # can be {dmd,ldc,gdc} export N=4 export OS_NAME=linux export FULL_BUILD="${PULL_REQUEST_NUMBER+false}" + +export HOST_DC=$DMD +if [ "$HOST_DC" == "gdc" ]; then export HOST_DC=gdmd-$GDC_VERSION; fi + # SemaphoreCI doesn't provide a convenient way to the base branch (e.g. master or stable) if [ -n "${PULL_REQUEST_NUMBER:-}" ]; then BRANCH=$((curl -fsSL https://api.github.com/repos/dlang/dmd/pulls/$PULL_REQUEST_NUMBER || echo) | jq -r '.base.ref') @@ -34,14 +38,6 @@ fi ################################################################################ case $1 in - setup) - ./ci.sh setup_repos "$BRANCH" - ;; - testsuite) - if [ "$DMD" == "gdc" ] || [ "$DMD" == "gdmd" ] ; then - export DMD=gdmd-$GDC_VERSION - fi - ./ci.sh install_d "$DMD" - ./ci.sh testsuite - ;; + setup) ./ci.sh install_d && ./ci.sh setup_repos "$BRANCH" ;; + testsuite) ./ci.sh testsuite ;; esac