Skip to content

Vanilla-LLVM GHA: Bump Linux jobs to Ubuntu 24 and use distro LLVM 15… #3506

Vanilla-LLVM GHA: Bump Linux jobs to Ubuntu 24 and use distro LLVM 15…

Vanilla-LLVM GHA: Bump Linux jobs to Ubuntu 24 and use distro LLVM 15… #3506

# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
name: Vanilla LLVM
on:
- pull_request
- push
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
strategy:
fail-fast: false
matrix:
include:
- job_name: Ubuntu 24.04, LLVM 18, bootstrap LDC
os: ubuntu-24.04
host_dc: ldc-1.19.0
llvm_version: 18
cmake_flags: -DRT_SUPPORT_SANITIZERS=ON -DPHOBOS_SYSTEM_ZLIB=ON
- job_name: macOS 14, LLVM 17, latest LDC beta
os: macos-14
host_dc: ldc-beta
llvm_version: 17.0.5
cmake_flags: -DBUILD_SHARED_LIBS=ON -DRT_SUPPORT_SANITIZERS=ON -DCMAKE_EXE_LINKER_FLAGS=-L/opt/homebrew/opt/zstd/lib -DCMAKE_C_COMPILER=/usr/bin/cc -DCMAKE_CXX_COMPILER=/usr/bin/c++
- job_name: macOS 14, LLVM 16, latest LDC beta
os: macos-14
host_dc: ldc-beta
llvm_version: 16.0.5
cmake_flags: -DBUILD_SHARED_LIBS=OFF -DCMAKE_EXE_LINKER_FLAGS=-L/opt/homebrew/opt/zstd/lib -DCMAKE_C_COMPILER=/usr/bin/cc -DCMAKE_CXX_COMPILER=/usr/bin/c++
- job_name: Ubuntu 24.04, LLVM 15, latest DMD beta
os: ubuntu-24.04
host_dc: dmd-beta
llvm_version: 15
cmake_flags: -DBUILD_SHARED_LIBS=ON -DRT_SUPPORT_SANITIZERS=ON -DLIB_SUFFIX=64 -DLDC_LINK_MANUALLY=ON
name: ${{ matrix.job_name }}
runs-on: ${{ matrix.os }}
env:
# silence `ld: warning: object file (…) was built for newer macOS version (…) than being linked (…)`
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.os == 'macos-14' && '13.6' || '11.6' }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 50
- name: Install ninja
uses: symmetryinvestments/gha-setup-ninja@v2
- name: Install D host compiler
uses: dlang-community/setup-dlang@v1
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 [[ '${{ matrix.os }}' == 'macos-14' ]]; then
brew install lit
else
python3 -m pip install --user lit
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
- name: 'macOS: Try to restore cached LLVM'
if: runner.os == 'macOS'
uses: actions/cache@v4
with:
path: llvm
key: llvm-${{ matrix.llvm_version }}-${{ runner.os }}
- name: 'macOS: Download & extract prebuilt vanilla LLVM ${{ matrix.llvm_version }}'
if: runner.os == 'macOS'
run: |
set -eux
if [[ -d llvm ]]; then
echo "Already cached"
exit 0
fi
version='${{ matrix.llvm_version }}'
if [[ "$version" =~ ^https:// ]]; then
url="$version"
else
url="https://github.com/llvm/llvm-project/releases/download/llvmorg-$version/clang+llvm-$version-arm64-apple-darwin22.0.tar.xz"
fi
curl -fL --retry 3 --max-time 300 -o llvm.tar.xz "$url"
mkdir llvm
tar -xf llvm.tar.xz --strip 1 -C llvm
rm llvm.tar.xz
# don't link lib{c++,unwind} libs from LLVM package, they'd need RPATH fiddling
rm -f llvm/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=${{ runner.os == 'Linux' && format('/usr/lib/llvm-{0}', matrix.llvm_version) || '"$PWD/llvm"' }} \
-DLDC_LINK_MANUALLY=OFF \
${{ 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
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'
if [[ '${{ runner.os }}' == macOS ]]; then
N=$(sysctl -n hw.logicalcpu)
if [[ '${{ matrix.os }}' == macos-14 ]]; then
# FIXME: crashes frequently with enabled optimizations on M1 runners
excludes+='|^std.internal.math.gammafunction(-shared)?$'
fi
else
N=$(nproc)
fi
ctest -j$N --output-on-failure -E "$excludes"