GHA main: Add Alpine Linux job, to CI-test musl libc (#20741)

* GHA main: Add Alpine Linux job, to CI-test musl libc

Incl. some test fixes.

* [refactor common isDlcoseNoop logic and prepare for Darwin support]
This commit is contained in:
Martin Kinkelin 2025-01-28 00:28:20 +01:00 committed by GitHub
parent 94714307ec
commit 130e6aa1d4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 115 additions and 50 deletions

View file

@ -15,18 +15,24 @@ if [ ! -z ${HOST_DC+x} ] ; then HOST_DMD=${HOST_DC}; fi
if [ -z ${HOST_DMD+x} ] ; then echo "Variable 'HOST_DMD' needs to be set."; exit 1; fi
if [ "$OS_NAME" == "linux" ]; then
export DEBIAN_FRONTEND=noninteractive
packages="git-core make g++ gdb gnupg curl libcurl4 tzdata zip unzip xz-utils llvm valgrind libc6-dbg"
if [ "$MODEL" == "32" ]; then
dpkg --add-architecture i386
packages="$packages g++-multilib libcurl4:i386 libc6-dbg:i386"
if type -P apk &>/dev/null; then
# Alpine
apk add git make g++ ldc \
bash grep coreutils diffutils curl gdb linux-headers dub
else
export DEBIAN_FRONTEND=noninteractive
packages="git-core make g++ gdb gnupg curl libcurl4 tzdata zip unzip xz-utils llvm valgrind libc6-dbg"
if [ "$MODEL" == "32" ]; then
dpkg --add-architecture i386
packages="$packages g++-multilib libcurl4:i386 libc6-dbg:i386"
fi
if [ "${HOST_DMD:0:4}" == "gdmd" ]; then
# ci/run.sh uses `sudo add-apt-repository ...` to add a PPA repo
packages="$packages sudo software-properties-common"
fi
apt-get -q update
apt-get install -yq $packages
fi
if [ "${HOST_DMD:0:4}" == "gdmd" ]; then
# ci/run.sh uses `sudo add-apt-repository ...` to add a PPA repo
packages="$packages sudo software-properties-common"
fi
apt-get -q update
apt-get install -yq $packages
elif [ "$OS_NAME" == "osx" ]; then
# upgrade GNU make
brew install make

View file

@ -123,6 +123,11 @@ test_dmd() {
local args=(ARGS="-O -inline -release")
fi
if type -P apk &>/dev/null; then
# Alpine: no TLS variables support with gdb, https://gitlab.alpinelinux.org/alpine/aports/-/issues/11154
rm compiler/test/runnable/gdb4181.d
fi
$build_path/dmd -g -i -Icompiler/test -release compiler/test/run.d -ofgenerated/run
generated/run -j$N --environment MODEL=$MODEL HOST_DMD=$build_path/dmd "${args[@]}"
}
@ -262,6 +267,11 @@ install_host_compiler() {
echo "export DMD=gdmd-$gdc_version" > ~/dlang/gdc-$gdc_version/activate
echo "deactivate(){ echo;}" >> ~/dlang/gdc-$gdc_version/activate
fi
elif type -P apk &>/dev/null; then
# fake install script and create a fake 'activate' script
mkdir -p ~/dlang/$HOST_DMD
echo "export DMD=$HOST_DMD" > ~/dlang/$HOST_DMD/activate
echo "deactivate(){ echo;}" >> ~/dlang/$HOST_DMD/activate
else
local install_sh="install.sh"
download_install_sh "$install_sh"