ci.sh: Refactor GDC special case

This commit is contained in:
Martin Kinkelin 2020-10-13 18:56:44 +02:00
parent ddfb4fbcd7
commit 872c77e7a6
4 changed files with 21 additions and 21 deletions

View file

@ -2,8 +2,6 @@ common_steps_template: &COMMON_STEPS_TEMPLATE
install_prerequisites_script: ./cirrusci.sh
install_host_compiler_script: |
set -uexo pipefail
# kludge for ci.sh
if [ "${DMD:0:4}" == "gdmd" ]; then export DMD="gdmd"; fi
compiler="$DMD"
if [ -n "${D_VERSION+x}" ]; then compiler="$DMD-$D_VERSION"; fi
./ci.sh install_d "$compiler"
@ -46,7 +44,6 @@ task:
- TASK_NAME_SUFFIX: x64, LDC
DMD: ldc
- TASK_NAME_SUFFIX: x64, GDC
GDC_VERSION: 9
DMD: gdmd-9
<< : *COMMON_STEPS_TEMPLATE

19
ci.sh
View file

@ -172,23 +172,24 @@ download_install_sh() {
}
install_d() {
if [ "${DMD:-dmd}" == "gdc" ] || [ "${DMD:-dmd}" == "gdmd" ] ; then
export DMD=gdmd-${GDC_VERSION}
if [ ! -e ~/dlang/gdc-${GDC_VERSION}/activate ] ; then
local compiler="$1"
if [ "${compiler:0:5}" == "gdmd-" ] ; then
local gdc_version="${compiler:5}"
if [ ! -e ~/dlang/gdc-$gdc_version/activate ] ; then
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install -y gdc-${GDC_VERSION}
sudo apt-get install -y gdc-$gdc_version
# fetch the dmd-like wrapper
sudo wget https://raw.githubusercontent.com/D-Programming-GDC/GDMD/master/dmd-script -O /usr/bin/gdmd-${GDC_VERSION}
sudo chmod +x /usr/bin/gdmd-${GDC_VERSION}
sudo curl -fsSL -A "$CURL_USER_AGENT" --connect-timeout 5 --speed-time 30 --speed-limit 1024 --retry 5 --retry-delay 5 https://raw.githubusercontent.com/D-Programming-GDC/GDMD/master/dmd-script -o /usr/bin/gdmd-$gdc_version
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
mkdir -p ~/dlang/gdc-$gdc_version
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" "$1"
CURL_USER_AGENT="$CURL_USER_AGENT" bash "$install_sh" "$compiler"
fi
}

View file

@ -22,7 +22,7 @@ if [ "$OS_NAME" == "linux" ]; then
fi
if [ "${DMD:0:4}" == "gdmd" ]; then
# ci.sh uses `sudo add-apt-repository ...` to add a PPA repo
packages="$packages sudo software-properties-common wget"
packages="$packages sudo software-properties-common"
fi
apt-get -q update
apt-get install -yq $packages

View file

@ -30,17 +30,19 @@ else
fi
export BRANCH
################################################################################
# Install D host compiler
################################################################################
./ci.sh install_d "$DMD"
################################################################################
# Define commands
################################################################################
case $1 in
setup) ./ci.sh setup_repos ;;
testsuite) ./ci.sh testsuite ;;
setup)
./ci.sh setup_repos
;;
testsuite)
if [ "$DMD" == "gdc" ] || [ "$DMD" == "gdmd" ] ; then
export DMD=gdmd-$GDC_VERSION
fi
./ci.sh install_d "$DMD"
./ci.sh testsuite
;;
esac