Skip to content

Commit

Permalink
Install and use llvm-19 on unix CI
Browse files Browse the repository at this point in the history
MSVC supports CXX_MODULES too, give it a try
  • Loading branch information
ClausKlein committed Nov 30, 2024
1 parent 96a0e72 commit 3de812a
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 22 deletions.
64 changes: 44 additions & 20 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ jobs:
- name: Install codespell
run: pip3 install codespell

- name: Lint
if: always()
working-directory: asio
run: cmake -D FORMAT_COMMAND=clang-format-18 -P cmake/lint.cmake || echo ignored
# - name: Lint
# if: always()
# working-directory: asio
# run: cmake -D FORMAT_COMMAND=clang-format-18 -P cmake/lint.cmake || echo ignored

- name: Spell check
if: always()
Expand Down Expand Up @@ -58,11 +58,11 @@ jobs:

- name: Build
working-directory: asio
run: cmake --build build/coverage -j 2
run: cmake --build build/coverage -j 4

- name: Test
working-directory: asio/build/coverage
run: ctest --output-on-failure --no-tests=error -j 2
run: ctest --output-on-failure --no-tests=error -j 4

- name: Process coverage info
working-directory: asio
Expand All @@ -89,7 +89,7 @@ jobs:

- name: Build
working-directory: asio
run: cmake --build build/sanitize -j 2
run: cmake --build build/sanitize -j 4

- name: Test
working-directory: asio/build/sanitize
Expand All @@ -100,12 +100,13 @@ jobs:
strict_init_order=1:\
detect_leaks=1"
UBSAN_OPTIONS: print_stacktrace=1
run: ctest --output-on-failure --no-tests=error -j 2
run: ctest --output-on-failure --no-tests=error -j 4

test:
needs: [lint]

strategy:
fail-fast: false
matrix:
os: [macos-15, ubuntu-24.04, windows-2022]

Expand All @@ -116,35 +117,58 @@ jobs:

- name: Install static analyzers
if: matrix.os == 'ubuntu-24.04'
run: >-
sudo apt-get install clang-tidy-18 cppcheck -y -q
sudo update-alternatives --install
/usr/bin/clang-tidy clang-tidy
/usr/bin/clang-tidy-18 150
run: |
sudo apt-get install cppcheck ninja-build -y -q
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 19 all
sudo update-alternatives --install \
/usr/bin/clang-tidy clang-tidy \
/usr/bin/clang-tidy-19 150
- name: Install llvm-19
if: startsWith(matrix.os, 'macos')
run: |
brew install llvm@19
echo 'export PATH="/opt/homebrew/opt/llvm/bin:$PATH"' >> /Users/runner/.envrc
echo 'export LDFLAGS="-L/opt/homebrew/opt/llvm/lib"' >> /Users/runner/.envrc
echo 'export CPPFLAGS="-L/opt/homebrew/opt/llvm/include"' >> /Users/runner/.envrc
- name: Setup MultiToolTask
- name: Configure windows
if: matrix.os == 'windows-2022'
working-directory: asio
run: |
Add-Content "$env:GITHUB_ENV" 'UseMultiToolTask=true'
Add-Content "$env:GITHUB_ENV" 'EnforceProcessCountAcrossBuilds=true'
cmake --preset=ci-windows
- name: Configure
shell: pwsh
- name: Configure macos
if: matrix.os == 'macos-15'
working-directory: asio
shell: bash
run: |
source /Users/runner/.envrc
which clang++ && clang++ --version
CXX=$(brew --prefix llvm@19)/bin/clang++ cmake --preset=ci-macos
- name: Configure ubuntu
if: matrix.os == 'ubuntu-24.04'
working-directory: asio
run: cmake "--preset=ci-$("${{ matrix.os }}".split("-")[0])"
env:
CXX: clang++-19
run: cmake --preset=ci-ubuntu

- name: Build
working-directory: asio
run: cmake --build build --config Release -j 2
run: cmake --build build --config Release -j 4

- name: Install
working-directory: asio
run: cmake --install build --config Release --prefix prefix

- name: Test
working-directory: asio/build
run: ctest --output-on-failure --no-tests=error -C Release -j 2
run: ctest --output-on-failure --no-tests=error -C Release -j 4

docs:
# Deploy docs only when builds succeed
Expand Down
2 changes: 1 addition & 1 deletion asio/CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"hidden": true,
"cacheVariables": {
"CMAKE_CXX_FLAGS":
"-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -fcf-protection=full -fstack-clash-protection -Wall -Wextra -Wpedantic -Wno-conversion -Wno-sign-conversion -Wcast-qual -Wformat=2 -Wundef -Werror=float-equal -Wshadow -Wcast-align -Wunused -Wnull-dereference -Wdouble-promotion -Wimplicit-fallthrough -Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wno-old-style-cast",
"-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -fcf-protection=full -fstack-clash-protection -Wall -Wextra -Wpedantic -Wno-conversion -Wno-sign-conversion -Wcast-qual -Wformat=2 -Wundef -Werror=float-equal -Wshadow -Wcast-align -Wunused -Wnull-dereference -Wdouble-promotion -Wno-implicit-fallthrough -Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wno-old-style-cast",
"CMAKE_EXE_LINKER_FLAGS":
"-Wl,--allow-shlib-undefined,--as-needed,-z,noexecstack,-z,relro,-z,now",
"CMAKE_SHARED_LINKER_FLAGS":
Expand Down
4 changes: 3 additions & 1 deletion asio/src/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ if(PROJECT_IS_TOP_LEVEL)
add_link_options(-stdlib=libc++)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 15.0)
set(USE_MODULES TRUE)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(USE_MODULES TRUE)
endif()
message(STATUS "CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES=${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}")
endif()
Expand All @@ -34,7 +36,7 @@ if(PROJECT_IS_TOP_LEVEL)
endif()

# set(ALL_EXAMPLES cpp20/operations/callback_wrapper.cpp)
# set(ALL_EXAMPLES module/tests/main.cpp)
# list(APPEND ALL_EXAMPLES ../../module/tests/main.cpp)
set(ALL_EXAMPLES main)

message(STATUS "Examples to be built: ${ALL_EXAMPLES}")
Expand Down

0 comments on commit 3de812a

Please sign in to comment.