Skip to content

clang linux

clang linux #1030

name: clang linux
on:
push:
pull_request:
workflow_dispatch:
schedule:
- cron: '20 3 * * *'
env:
TEST_DIR: ./tests
jobs:
all:
strategy:
fail-fast: false
matrix:
clang_version: [16, 18]
cpp_version: [c++17, c++20, c++23, c++26]
stdlib: [libc++, libstdc++] # llvm library and gcc library
arch: [m64, m32] # 64 and 32 bit
buildmode: [~ , -O3 -DNDEBUG, -O3 -DNDEBUG -ffast-math]
os: [ubuntu-24.04]
exclude:
# Disable unsupported language standards for older clang versions
- clang_version: 16
cpp_version: c++23
- clang_version: 16
cpp_version: c++26
# -ffast-math + stdlibc++ in release on clang 18 causes warnings -Wnan-infinity-disabled because
# of std::isnan uses in the tests.
- clang_version: 18
stdlib: libstdc++
buildmode: -O3 -DNDEBUG -ffast-math
include:
# Also include a few variations with disabled UB tricks (not for all to limit resource consumption).
- clang_version: 18
cpp_version: c++20
stdlib: libc++
arch: m64
buildmode: -DTINY_OPTIONAL_USE_SEPARATE_BOOL_INSTEAD_OF_UB_TRICKS
os: ubuntu-24.04
- clang_version: 18
cpp_version: c++20
stdlib: libstdc++
arch: m64
buildmode: -DTINY_OPTIONAL_USE_SEPARATE_BOOL_INSTEAD_OF_UB_TRICKS
os: ubuntu-24.04
# A few sanitzer builds
- clang_version: 18
cpp_version: c++20
stdlib: libc++
arch: m64
buildmode: -fsanitize=undefined -fsanitize=address -fsanitize-address-use-after-scope
os: ubuntu-24.04
- clang_version: 18
cpp_version: c++20
stdlib: libc++
arch: m64
buildmode: -O3 -DNDEBUG -fsanitize=undefined -fsanitize=address -fsanitize-address-use-after-scope
os: ubuntu-24.04
# See above, where this combination was disabled. Add it back with ignored warning.
- clang_version: 18
cpp_version: c++20
stdlib: libstdc++
arch: m64
buildmode: -O3 -DNDEBUG -ffast-math -Wno-nan-infinity-disabled
os: ubuntu-24.04
# clang 13: installed on ubuntu 22.04
- clang_version: 13
cpp_version: c++20
stdlib: libc++
arch: m64
buildmode:
os: ubuntu-22.04
- clang_version: 13
cpp_version: c++20
stdlib: libstdc++
arch: m64
buildmode: -O3 -DNDEBUG
os: ubuntu-22.04
- clang_version: 13
cpp_version: c++20
stdlib: libc++
arch: m64
buildmode: -O3 -DNDEBUG
os: ubuntu-22.04
- clang_version: 13
cpp_version: c++20
stdlib: libstdc++
arch: m64
buildmode:
os: ubuntu-22.04
# clang 15: installed on ubuntu 22.04
- clang_version: 15
cpp_version: c++20
stdlib: libc++
arch: m64
buildmode:
os: ubuntu-22.04
- clang_version: 15
cpp_version: c++20
stdlib: libstdc++
arch: m64
buildmode: -O3 -DNDEBUG
os: ubuntu-22.04
- clang_version: 15
cpp_version: c++20
stdlib: libc++
arch: m64
buildmode: -O3 -DNDEBUG
os: ubuntu-22.04
- clang_version: 15
cpp_version: c++20
stdlib: libstdc++
arch: m64
buildmode:
os: ubuntu-22.04
runs-on: ${{ matrix.os }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- name: Install libc++ if required
# libc++ is not installed for all clang versions by default.
if: ${{ matrix.stdlib == 'libc++' && matrix.arch == 'm64' }}
run: |
sudo apt update
sudo apt install ${{ format('libc++-{0}-dev libc++abi-{0}-dev', matrix.clang_version) }} -y
- name: Install gcc-multilib and libc++ for x86 if required
# For x86: We require both gcc multilib and the 32-bit variant (i386) of libc++ for the
# used clang version. For libc++ we need to manually add the i386 architecture.
if: ${{ matrix.arch == 'm32' }}
run: |
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install gcc-multilib g++-multilib ${{ format('libc++-{0}-dev:i386 libc++abi-{0}-dev:i386', matrix.clang_version) }} -y
- name: Build and run tests
working-directory: ${{env.TEST_DIR}}
env:
CXX: ${{ format('clang++-{0}', matrix.clang_version) }}
ADDITIONAL_FLAGS: ${{ format('-{0} -std={1} -stdlib={2} {3}', matrix.arch, matrix.cpp_version, matrix.stdlib, matrix.buildmode) }}
run: make generic