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.
This commit is contained in:
Martin Kinkelin 2020-10-14 16:13:34 +02:00
parent bd6f181f4d
commit 88a9f59748
4 changed files with 27 additions and 36 deletions

View file

@ -1,10 +1,6 @@
common_steps_template: &COMMON_STEPS_TEMPLATE common_steps_template: &COMMON_STEPS_TEMPLATE
install_prerequisites_script: ./cirrusci.sh install_prerequisites_script: ./cirrusci.sh
install_host_compiler_script: | install_host_compiler_script: ./ci.sh install_d
set -uexo pipefail
compiler="$DMD"
if [ -n "${D_VERSION+x}" ]; then compiler="$DMD-$D_VERSION"; fi
./ci.sh install_d "$compiler"
setup_repos_script: | setup_repos_script: |
set -uexo pipefail set -uexo pipefail
ln -s $CIRRUS_WORKING_DIR ../dmd ln -s $CIRRUS_WORKING_DIR ../dmd
@ -18,7 +14,7 @@ environment:
CIRRUS_CLONE_DEPTH: 50 CIRRUS_CLONE_DEPTH: 50
# for ci.sh: # for ci.sh:
MODEL: 64 MODEL: 64
DMD: dmd HOST_DC: dmd
N: 4 N: 4
OS_NAME: linux OS_NAME: linux
FULL_BUILD: true FULL_BUILD: true
@ -37,14 +33,14 @@ task:
MODEL: 32 MODEL: 32
- TASK_NAME_SUFFIX: x86, DMD (bootstrap) - TASK_NAME_SUFFIX: x86, DMD (bootstrap)
MODEL: 32 MODEL: 32
D_VERSION: 2.079.0 HOST_DC: dmd-2.079.0
- TASK_NAME_SUFFIX: x64, DMD (latest) - TASK_NAME_SUFFIX: x64, DMD (latest)
- TASK_NAME_SUFFIX: x64, DMD (bootstrap) - TASK_NAME_SUFFIX: x64, DMD (bootstrap)
D_VERSION: 2.079.0 HOST_DC: dmd-2.079.0
- TASK_NAME_SUFFIX: x64, LDC - TASK_NAME_SUFFIX: x64, LDC
DMD: ldc HOST_DC: ldc
- TASK_NAME_SUFFIX: x64, GDC - TASK_NAME_SUFFIX: x64, GDC
DMD: gdmd-9 HOST_DC: gdmd-9
<< : *COMMON_STEPS_TEMPLATE << : *COMMON_STEPS_TEMPLATE
# Mac # Mac
@ -62,7 +58,7 @@ task:
- TASK_NAME_SUFFIX: DMD (bootstrap) - TASK_NAME_SUFFIX: DMD (bootstrap)
# de-facto bootstrap version on OSX # de-facto bootstrap version on OSX
# See: https://forum.dlang.org/post/qfsgt2$1goc$1@digitalmars.com # 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 << : *COMMON_STEPS_TEMPLATE
# FreeBSD # FreeBSD
@ -87,6 +83,6 @@ task:
timeout_in: 60m timeout_in: 60m
environment: environment:
OS_NAME: freebsd OS_NAME: freebsd
D_VERSION: 2.079.0 HOST_DC: dmd-2.079.0
install_bash_script: pkg install -y bash install_bash_script: pkg install -y bash
<< : *COMMON_STEPS_TEMPLATE << : *COMMON_STEPS_TEMPLATE

18
ci.sh
View file

@ -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 if [ -z ${FULL_BUILD+x} ] ; then echo "Variable 'FULL_BUILD' needs to be set."; exit 1; fi
# MODEL: 32|64 # MODEL: 32|64
if [ -z ${MODEL+x} ] ; then echo "Variable 'MODEL' needs to be set."; exit 1; fi if [ -z ${MODEL+x} ] ; then echo "Variable 'MODEL' needs to be set."; exit 1; fi
# DMD: dmd|ldc|gdmd-<version> (host compiler) # HOST_DC: dmd[-<version>]|ldc[-<version>]|gdmd-<version>
if [ -z ${DMD+x} ] ; then echo "Variable 'DMD' needs to be set."; exit 1; fi 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)" CURL_USER_AGENT="DMD-CI $(curl --version | head -n 1)"
build_path=generated/$OS_NAME/release/$MODEL build_path=generated/$OS_NAME/release/$MODEL
@ -49,7 +49,7 @@ clone() {
# build dmd, druntime, phobos # build dmd, druntime, phobos
build() { 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 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 ../druntime -f posix.mak MODEL=$MODEL
make -j$N -C ../phobos -f posix.mak MODEL=$MODEL make -j$N -C ../phobos -f posix.mak MODEL=$MODEL
@ -180,9 +180,8 @@ download_install_sh() {
} }
install_d() { install_d() {
local compiler="$1" if [ "${HOST_DC:0:5}" == "gdmd-" ] ; then
if [ "${compiler:0:5}" == "gdmd-" ] ; then local gdc_version="${HOST_DC:5}"
local gdc_version="${compiler:5}"
if [ ! -e ~/dlang/gdc-$gdc_version/activate ] ; then if [ ! -e ~/dlang/gdc-$gdc_version/activate ] ; then
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update sudo apt-get update
@ -192,12 +191,13 @@ install_d() {
sudo chmod +x /usr/bin/gdmd-$gdc_version sudo chmod +x /usr/bin/gdmd-$gdc_version
# fake install script and create a fake 'activate' script # fake install script and create a fake 'activate' script
mkdir -p ~/dlang/gdc-$gdc_version 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 fi
else else
local install_sh="install.sh" local install_sh="install.sh"
download_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 fi
} }
@ -205,7 +205,7 @@ install_d() {
if [ "$#" -gt 0 ]; then if [ "$#" -gt 0 ]; then
case $1 in case $1 in
install_d) install_d "$2" ;; # ci.sh install_d dmd[-<version>]|ldc[-<version>]|gdmd-<version> install_d) install_d ;;
setup_repos) setup_repos "$2" ;; # ci.sh setup_repos <git branch> setup_repos) setup_repos "$2" ;; # ci.sh setup_repos <git branch>
build) build ;; build) build ;;
rebuild) rebuild "${2:-}" ;; # ci.sh rebuild [1] (use `1` to compare binaries to test reproducible build) rebuild) rebuild "${2:-}" ;; # ci.sh rebuild [1] (use `1` to compare binaries to test reproducible build)

View file

@ -10,9 +10,8 @@ set -uexo pipefail
if [ -z ${OS_NAME+x} ] ; then echo "Variable 'OS_NAME' needs to be set."; exit 1; fi if [ -z ${OS_NAME+x} ] ; then echo "Variable 'OS_NAME' needs to be set."; exit 1; fi
# MODEL: 32|64 # MODEL: 32|64
if [ -z ${MODEL+x} ] ; then echo "Variable 'MODEL' needs to be set."; exit 1; fi if [ -z ${MODEL+x} ] ; then echo "Variable 'MODEL' needs to be set."; exit 1; fi
# DMD: dmd|ldc|gdmd-<version> (host compiler) # HOST_DC: dmd[-<version>]|ldc[-<version>]|gdmd-<version>
if [ -z ${DMD+x} ] ; then echo "Variable 'DMD' needs to be set."; exit 1; fi if [ -z ${HOST_DC+x} ] ; then echo "Variable 'HOST_DC' needs to be set."; exit 1; fi
# optional D_VERSION: fixed version of the (DMD) host compiler
if [ "$OS_NAME" == "linux" ]; then if [ "$OS_NAME" == "linux" ]; then
packages="git-core make g++ gdb curl libcurl3 tzdata zip unzip xz-utils" 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 dpkg --add-architecture i386
packages="$packages g++-multilib libcurl3-gnutls:i386" packages="$packages g++-multilib libcurl3-gnutls:i386"
fi 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 # ci.sh uses `sudo add-apt-repository ...` to add a PPA repo
packages="$packages sudo software-properties-common" packages="$packages sudo software-properties-common"
fi fi
@ -31,7 +30,7 @@ elif [ "$OS_NAME" == "darwin" ]; then
brew install gnupg brew install gnupg
elif [ "$OS_NAME" == "freebsd" ]; then elif [ "$OS_NAME" == "freebsd" ]; then
packages="git gmake" packages="git gmake"
if [ "${D_VERSION:-x}" == "2.079.0" ] ; then if [ "$HOST_DC" == "dmd-2.079.0" ] ; then
packages="$packages lang/gcc9" packages="$packages lang/gcc9"
fi fi
pkg install -y $packages pkg install -y $packages

View file

@ -17,6 +17,10 @@ export DMD=${DMD:-dmd} # can be {dmd,ldc,gdc}
export N=4 export N=4
export OS_NAME=linux export OS_NAME=linux
export FULL_BUILD="${PULL_REQUEST_NUMBER+false}" 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) # SemaphoreCI doesn't provide a convenient way to the base branch (e.g. master or stable)
if [ -n "${PULL_REQUEST_NUMBER:-}" ]; then 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') 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 case $1 in
setup) setup) ./ci.sh install_d && ./ci.sh setup_repos "$BRANCH" ;;
./ci.sh setup_repos "$BRANCH" testsuite) ./ci.sh testsuite ;;
;;
testsuite)
if [ "$DMD" == "gdc" ] || [ "$DMD" == "gdmd" ] ; then
export DMD=gdmd-$GDC_VERSION
fi
./ci.sh install_d "$DMD"
./ci.sh testsuite
;;
esac esac