Skip to content

WIP: Upgrade frontend & libs to v2.113 #4734

WIP: Upgrade frontend & libs to v2.113

WIP: Upgrade frontend & libs to v2.113 #4734

# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
name: Vanilla LLVM
on:
pull_request:
push:
branches-ignore:
- 'merge-*' # don't run on pushes to merge-X.Y.Z branches, they are usually PRs
tags: # explicitly needed to run for all tags, due to the branches filter above
- '**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
strategy:
fail-fast: false
matrix:
include:
- job_name: macOS 14, LLVM 21, latest LDC beta
os: macos-14
host_dc: ldc-beta
llvm_version: 21
cmake_flags: -DBUILD_SHARED_LIBS=OFF -DRT_SUPPORT_SANITIZERS=ON
- job_name: Ubuntu 24.04, LLVM 20, bootstrap LDC
os: ubuntu-24.04
host_dc: ldc-1.19.0
llvm_version: 20
# work around libcurl dependency for ldc-profdata (LLVM apparently built with non-default LLVM_ENABLE_CURL=ON)
cmake_flags: -DBUILD_SHARED_LIBS=ON -DPHOBOS_SYSTEM_ZLIB=ON -DCMAKE_EXE_LINKER_FLAGS=-lcurl
- job_name: Ubuntu 24.04, LLVM 19, latest DMD beta
os: ubuntu-24.04
host_dc: dmd-beta
llvm_version: 19
cmake_flags: -DBUILD_SHARED_LIBS=OFF -DRT_SUPPORT_SANITIZERS=ON -DPHOBOS_SYSTEM_ZLIB=ON -DLIB_SUFFIX=64
- job_name: macOS 14, LLVM 18, latest LDC beta
os: macos-14
host_dc: ldc-beta
llvm_version: 18
cmake_flags: -DBUILD_SHARED_LIBS=ON -DRT_SUPPORT_SANITIZERS=ON
name: ${{ matrix.job_name }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Install D host compiler
uses: dlang-community/setup-dlang@v2
with:
compiler: ${{ matrix.host_dc }}
- name: Clear LD_LIBRARY_PATH to prevent loading host compiler libs
run: echo "LD_LIBRARY_PATH=" >> $GITHUB_ENV
- name: Install lit
run: |
set -euxo pipefail
if [[ '${{ runner.os }}' == 'macOS' ]]; then
brew install lit
else
python3 -m pip install --user lit psutil
fi
python3 -c "import lit.main; lit.main.main();" --version . | head -n 1
- name: 'Linux: Install gdb, lld, llvm-dev and libclang-common-dev'
if: runner.os == 'Linux'
run: |
set -eux
sudo apt-get update
sudo apt-get install gdb lld-${{ matrix.llvm_version }} llvm-${{ matrix.llvm_version }}-dev libclang-common-${{ matrix.llvm_version }}-dev ${{ matrix.llvm_version == '20' && 'libcurl4-openssl-dev' || '' }}
- name: 'macOS: Install Homebrew llvm and a more recent GNU make'
if: runner.os == 'macOS'
run: |
set -eux
brew install llvm@${{ matrix.llvm_version }} make
gmake --version
# don't link lib{c++,unwind} libs from LLVM package, use default ones (as we use default Apple clang)
rm -f /opt/homebrew/opt/llvm@${{ matrix.llvm_version }}/lib/lib{c++,unwind}.*
- name: 'Linux: Make lld the default linker'
if: runner.os == 'Linux'
run: |
set -eux
echo "Using lld to work around sporadic failures"
sudo ln -sf ld.lld-${{ matrix.llvm_version }} /usr/bin/ld
ld --version
- name: Build LDC & LDC D unittests & defaultlib unittest runners with extra '${{ matrix.cmake_flags }}'
run: |
set -eux
cmake -G Ninja . \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ROOT_DIR=${{ format(runner.os == 'Linux' && '/usr/lib/llvm-{0}' || '/opt/homebrew/opt/llvm@{0}', matrix.llvm_version) }} \
${{ runner.os == 'macOS' && '-DCMAKE_EXE_LINKER_FLAGS="-L/opt/homebrew/opt/zstd/lib -lzstd"' || '' }} \
${{ matrix.cmake_flags }}
ninja obj/ldc2.o all ldc2-unittest all-test-runners
bin/ldc2 --version
- name: Run LDC D unittests
if: success() || failure()
run: ctest --output-on-failure -R "ldc2-unittest"
- name: Run LIT testsuite
if: success() || failure()
run: |
set -eux
if [[ '${{ runner.os }}' == 'Linux' ]]; then
# FIXME: lsan_interceptors.cpp:82 "((!lsan_init_is_running)) != (0)"
rm tests/sanitizers/lsan_memleak.d
elif [[ '${{ runner.os }}' == 'macOS' ]]; then
# work around weird lit-test `plugins/addFuncEntryCall/testPlugin.d`
# regression after switching to homebrew make (default CXX is clang++)
export CXX=c++
if [[ '${{ matrix.cmake_flags }}' =~ -DRT_SUPPORT_SANITIZERS=ON ]]; then
# FIXME: regressed with druntime v2.111 on macOS arm64 (but works on Linux x86_64)
rm tests/sanitizers/asan_fiber.d
fi
fi
ctest -V -R "lit-tests"
- name: Run DMD testsuite
if: success() || failure()
run: ctest -V -R "dmd-testsuite"
- name: Run defaultlib unittests & druntime integration tests
if: success() || failure()
run: |
set -eux
excludes='dmd-testsuite|lit-tests|ldc2-unittest'
# FIXME: https://github.com/dlang/phobos/issues/10730
excludes+='|^std.experimental.allocator.building_blocks.allocator_list'
if [[ '${{ runner.os }}' == macOS ]]; then
N=$(sysctl -n hw.logicalcpu)
else
N=$(nproc)
fi
ctest -j$N --output-on-failure -E "$excludes" --timeout 120