ci/run.sh: Avoid deprecated Makefiles (#15832)

* ci/run.sh: Avoid deprecated Makefiles

* ci/run.sh: Streamline OS_NAME from `darwin` to `osx` on macOS

As DMD uses `osx` as OS in most other places, including the
`generated/osx/release/64` output dir, which is currently wrong
in run.sh's `build_path` and leads to CI failures on macOS.

* GHA: Disable `-debug` for DMD unittests with old host compilers

* GHA: Work around linker errors with -g on macOS 13

See https://issues.dlang.org/show_bug.cgi?id=23517.

compiler/src/posix.mak sets it to 10.9, compiler/test/Makefile to 11.
This commit is contained in:
Martin Kinkelin 2023-11-22 10:41:16 +01:00 committed by GitHub
parent f6802dd63f
commit ed22f5c28f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 15 deletions

View file

@ -27,6 +27,7 @@ jobs:
- job_name: Ubuntu 22.04 x64, DMD (bootstrap) - job_name: Ubuntu 22.04 x64, DMD (bootstrap)
os: ubuntu-22.04 os: ubuntu-22.04
host_dmd: dmd-2.079.0 host_dmd: dmd-2.079.0
disable_debug_for_dmd_unittests: true # no `-debug` - host frontend too old
- job_name: Ubuntu 22.04 x86, DMD (latest) - job_name: Ubuntu 22.04 x86, DMD (latest)
os: ubuntu-22.04 os: ubuntu-22.04
model: 32 model: 32
@ -46,6 +47,7 @@ jobs:
- job_name: Ubuntu 22.04 x64, GDC - job_name: Ubuntu 22.04 x64, GDC
os: ubuntu-22.04 os: ubuntu-22.04
host_dmd: gdmd-9 host_dmd: gdmd-9
disable_debug_for_dmd_unittests: true # no `-debug` - host frontend too old
# macOS # macOS
- job_name: macOS 13 x64, DMD (latest) - job_name: macOS 13 x64, DMD (latest)
os: macos-13 os: macos-13
@ -64,13 +66,15 @@ jobs:
timeout-minutes: 40 timeout-minutes: 40
env: env:
# for ci/run.sh: # for ci/run.sh:
OS_NAME: ${{ startsWith(matrix.os, 'ubuntu') && 'linux' || (startsWith(matrix.os, 'macos') && 'darwin' || '') }} OS_NAME: ${{ startsWith(matrix.os, 'ubuntu') && 'linux' || (startsWith(matrix.os, 'macos') && 'osx' || '') }}
MODEL: ${{ matrix.model || '64' }} MODEL: ${{ matrix.model || '64' }}
HOST_DMD: ${{ matrix.host_dmd }} HOST_DMD: ${{ matrix.host_dmd }}
N: ${{ startsWith(matrix.os, 'macos') && '3' || '2' }} N: ${{ startsWith(matrix.os, 'macos') && '3' || '2' }}
FULL_BUILD: true FULL_BUILD: true
# for coverage: # for coverage:
DMD_TEST_COVERAGE: ${{ matrix.coverage && '1' || '0' }} DMD_TEST_COVERAGE: ${{ matrix.coverage && '1' || '0' }}
# work around https://issues.dlang.org/show_bug.cgi?id=23517
MACOSX_DEPLOYMENT_TARGET: '11'
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
@ -99,10 +103,10 @@ jobs:
ci/run.sh setup_repos "$REPO_BRANCH" ci/run.sh setup_repos "$REPO_BRANCH"
- name: Build - name: Build
run: ci/run.sh build run: ${{ matrix.disable_debug_for_dmd_unittests && 'ENABLE_DEBUG=0' || '' }} ci/run.sh build
- name: Rebuild dmd (with enabled coverage) - name: Rebuild dmd (with enabled coverage)
if: matrix.coverage if: matrix.coverage
run: ENABLE_RELEASE=0 ENABLE_DEBUG=1 ENABLE_COVERAGE=1 ${{ runner.os == 'macOS' && 'OS_NAME=osx' || '' }} ci/run.sh rebuild run: ENABLE_RELEASE=0 ENABLE_DEBUG=1 ENABLE_COVERAGE=1 ci/run.sh rebuild
- name: Test dmd - name: Test dmd
run: ci/run.sh test_dmd run: ci/run.sh test_dmd
- name: Test druntime - name: Test druntime

View file

@ -6,7 +6,7 @@
set -uexo pipefail set -uexo pipefail
# OS_NAME: linux|darwin|freebsd # OS_NAME: linux|osx|freebsd
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
@ -27,7 +27,7 @@ if [ "$OS_NAME" == "linux" ]; then
fi fi
apt-get -q update apt-get -q update
apt-get install -yq $packages apt-get install -yq $packages
elif [ "$OS_NAME" == "darwin" ]; then elif [ "$OS_NAME" == "osx" ]; then
# required for dlang install.sh # required for dlang install.sh
brew install gnupg libarchive xz llvm brew install gnupg libarchive xz llvm
elif [ "$OS_NAME" == "freebsd" ]; then elif [ "$OS_NAME" == "freebsd" ]; then

View file

@ -7,7 +7,7 @@ set -uexo pipefail
# N: number of parallel build jobs # N: number of parallel build jobs
if [ -z ${N+x} ] ; then echo "Variable 'N' needs to be set."; exit 1; fi if [ -z ${N+x} ] ; then echo "Variable 'N' needs to be set."; exit 1; fi
# OS_NAME: linux|darwin|freebsd # OS_NAME: linux|osx|freebsd
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
# FULL_BUILD: true|false (true on Linux: use full permutations for DMD tests) # FULL_BUILD: true|false (true on Linux: use full permutations for DMD tests)
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
@ -34,7 +34,7 @@ if [ "$OS_NAME" == "linux" ]; then
else else
NM=nm NM=nm
if [ "$OS_NAME" == "darwin" ]; then if [ "$OS_NAME" == "osx" ]; then
export PATH="/usr/local/opt/llvm/bin:$PATH" export PATH="/usr/local/opt/llvm/bin:$PATH"
fi fi
fi fi
@ -59,8 +59,9 @@ clone() {
# build dmd (incl. building and running the unittests), druntime, phobos # build dmd (incl. building and running the unittests), druntime, phobos
build() { build() {
source ~/dlang/*/activate # activate host compiler, incl. setting `DMD` source ~/dlang/*/activate # activate host compiler, incl. setting `DMD`
make -j$N -C compiler/src -f posix.mak MODEL=$MODEL HOST_DMD=$DMD DFLAGS="$CI_DFLAGS" BUILD=debug ENABLE_WARNINGS=1 unittest $DMD compiler/src/build.d -ofgenerated/build
make -j$N -C compiler/src -f posix.mak MODEL=$MODEL HOST_DMD=$DMD DFLAGS="$CI_DFLAGS" ENABLE_RELEASE=1 ENABLE_WARNINGS=1 all generated/build -j$N MODEL=$MODEL HOST_DMD=$DMD DFLAGS="$CI_DFLAGS" BUILD=debug unittest
generated/build -j$N MODEL=$MODEL HOST_DMD=$DMD DFLAGS="$CI_DFLAGS" ENABLE_RELEASE=1 dmd
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
deactivate # deactivate host compiler deactivate # deactivate host compiler
@ -75,8 +76,8 @@ rebuild() {
mkdir -p _${build_path} mkdir -p _${build_path}
cp $build_path/dmd _${build_path}/host_dmd cp $build_path/dmd _${build_path}/host_dmd
cp $build_path/dmd.conf _${build_path} cp $build_path/dmd.conf _${build_path}
make -j$N -C compiler/src -f posix.mak MODEL=$MODEL HOST_DMD=../../_${build_path}/host_dmd clean rm -rf $build_path
make -j$N -C compiler/src -f posix.mak MODEL=$MODEL HOST_DMD=../../_${build_path}/host_dmd DFLAGS="$CI_DFLAGS" ENABLE_RELEASE=${ENABLE_RELEASE:-1} ENABLE_WARNINGS=1 all generated/build -j$N MODEL=$MODEL HOST_DMD=_${build_path}/host_dmd DFLAGS="$CI_DFLAGS" ENABLE_RELEASE=${ENABLE_RELEASE:-1} dmd
# compare binaries to test reproducible build # compare binaries to test reproducible build
if [ $compare -eq 1 ]; then if [ $compare -eq 1 ]; then
@ -100,12 +101,15 @@ test() {
# test dmd # test dmd
test_dmd() { test_dmd() {
# test fewer compiler argument permutations for PRs to reduce CI load # default to testing fewer compiler argument permutations to reduce CI load
if [ "$FULL_BUILD" == "true" ] && [ "$OS_NAME" == "linux" ]; then if [ "$FULL_BUILD" == "true" ] && [ "$OS_NAME" == "linux" ]; then
make -j1 -C compiler/test MODEL=$MODEL N=$N # all ARGS by default local args=() # use all default ARGS
else else
make -j1 -C compiler/test MODEL=$MODEL N=$N ARGS="-O -inline -release" local args=(ARGS="-O -inline -release")
fi 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[@]}"
} }
# build and run druntime unit tests # build and run druntime unit tests