Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
141 changes: 2 additions & 139 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,146 +6,9 @@ on:
pull_request:
branches: [main]

# Cancel redundant runs on the same ref (e.g. rapid pushes to a PR branch)
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
build-linux:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
include:
- { os: ubuntu-24.04, compiler: g++-13, packages: g++-13, build_type: Debug }
- { os: ubuntu-24.04, compiler: g++-14, packages: g++-14, build_type: Release }
- { os: ubuntu-24.04, compiler: clang++-18, packages: clang-18, build_type: Release }
- { os: ubuntu-24.04, compiler: clang++-19, packages: clang-19, build_type: Debug }
- { os: ubuntu-22.04, compiler: g++-12, packages: g++-12, build_type: Debug }
- { os: ubuntu-24.04-arm, compiler: g++-14, packages: g++-14, build_type: Debug }

steps:
- uses: actions/checkout@v4

- name: Install compiler
run: |
sudo apt-get update -q
sudo apt-get install -y ${{ matrix.packages }}

# Cache CPM-downloaded sources (Catch2 etc.) keyed on CMakeLists.txt content.
# CPM_SOURCE_CACHE is forwarded to cmake below so both steps agree on the path.
- name: Cache CPM sources
uses: actions/cache@v4
with:
path: ${{ runner.temp }}/cpm-cache
key: cpm-${{ runner.os }}-${{ hashFiles('CMakeLists.txt') }}
restore-keys: cpm-${{ runner.os }}-

# ccache-action manages save/restore internally; no separate actions/cache needed.
- name: Set up ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.build_type }}

- name: Configure, build, and test
env:
CPM_SOURCE_CACHE: ${{ runner.temp }}/cpm-cache
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DCMAKE_CXX_COMPILER=${{ matrix.compiler }} \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_STANDARD=23
cmake --build build --parallel
ctest --test-dir build --output-on-failure

build-windows:
needs: build-linux
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
include:
# - { os: windows-2025, arch: x64, build_type: Debug }
- { os: windows-2025, arch: x64, build_type: Release }
- { os: windows-2025, arch: x86, build_type: Release }
- { os: windows-2022, arch: x64, build_type: Release }

steps:
- uses: actions/checkout@v4

- name: Cache CPM sources
uses: actions/cache@v4
with:
path: ${{ runner.temp }}/cpm-cache
key: cpm-${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('CMakeLists.txt') }}
restore-keys: cpm-${{ runner.os }}-${{ matrix.arch }}-

- name: Set up sccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: windows-${{ matrix.arch }}-${{ matrix.build_type }}
variant: sccache

- name: Set up MSVC
uses: TheMrMilchmann/setup-msvc-dev@v3
with:
arch: ${{ matrix.arch }}

- name: Configure, build, and test
env:
CPM_SOURCE_CACHE: ${{ runner.temp }}/cpm-cache
run: |
cmake -B build -G Ninja `
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} `
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache `
-DCMAKE_CXX_STANDARD=23
cmake --build build --parallel
ctest --test-dir build --output-on-failure

build-macos:
needs: build-windows
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
max-parallel: 1
matrix:
include:
# arm64 (Apple Silicon M1) — two macOS generations
- { os: macos-14, build_type: Debug }
- { os: macos-14, build_type: Release }
- { os: macos-15, build_type: Debug }
- { os: macos-15, build_type: Release }
- { os: macos-15-intel, build_type: Release }
- { os: macos-26, build_type: Release }
- { os: macos-26, build_type: Debug }

steps:
- uses: actions/checkout@v4

- name: Cache CPM sources
uses: actions/cache@v4
with:
path: ${{ runner.temp }}/cpm-cache
key: cpm-${{ runner.os }}-${{ matrix.os }}-${{ hashFiles('CMakeLists.txt') }}
restore-keys: cpm-${{ runner.os }}-${{ matrix.os }}-

- name: Set up ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ matrix.os }}-${{ matrix.build_type }}

- name: Configure, build, and test
env:
CPM_SOURCE_CACHE: ${{ runner.temp }}/cpm-cache
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_STANDARD=23
cmake --build build --parallel 1
ctest --test-dir build --output-on-failure
build:
uses: timblechmann/nova_github_actions/.github/workflows/cmake-ci.yml@main
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ if(NOVA_BUILD_TESTS)
enable_testing()
add_test(NAME nova_nonnull_tests COMMAND nova_nonnull_tests)

if (NOT (CMAKE_BUILD_TYPE STREQUAL "Debug" AND CMAKE_CXX_COMPILER_ID MATCHES "Clang|AppleClang"))
message(WARNING "AddressSanitizer tests ICE clang in release builds")
endif()

add_executable(nova_nonnull_asan_take_tests
tests/asan_take.cpp
)
Expand All @@ -83,6 +87,8 @@ if(NOVA_BUILD_TESTS)
)

if (CMAKE_BUILD_TYPE STREQUAL "Debug")
target_compile_definitions(nova_nonnull_asan_take_tests PRIVATE NDEBUG)

add_test(NAME nova_nonnull_asan_take_tests
COMMAND ${CMAKE_COMMAND} -E env $<TARGET_FILE:nova_nonnull_asan_take_tests>
)
Expand Down
2 changes: 1 addition & 1 deletion include/nova/non_null.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <utility>

#if defined( __has_feature )
# if __has_feature( address_sanitizer )
# if __has_feature( address_sanitizer ) && __has_include( <sanitizer/asan_interface.h> )
# define NOVA_HAVE_ASAN 1
# endif
#endif
Expand Down
Loading