|
| 1 | +name: range-v3 CI |
| 2 | + |
| 3 | +# Trigger on pushes to all branches and for all pull-requests |
| 4 | +on: [push, pull_request] |
| 5 | + |
| 6 | +env: |
| 7 | + CMAKE_VERSION: 3.16.2 |
| 8 | + NINJA_VERSION: 1.12.1 |
| 9 | + |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + name: ${{ matrix.config.name }} |
| 13 | + runs-on: ${{ matrix.config.os }} |
| 14 | + container: ${{ matrix.config.container }} |
| 15 | + |
| 16 | + strategy: |
| 17 | + fail-fast: false |
| 18 | + matrix: |
| 19 | + config: |
| 20 | + # AppleClang |
| 21 | + - { |
| 22 | + name: "macOS Clang Debug (C++17)", artifact: "macOS.tar.xz", |
| 23 | + os: macos-13, |
| 24 | + build_type: Debug, |
| 25 | + cc: "clang", cxx: "clang++", |
| 26 | + cxx_standard: 17, |
| 27 | + cxx_asan: true, |
| 28 | + } |
| 29 | + - { |
| 30 | + name: "macOS Clang Release (C++17)", artifact: "macOS.tar.xz", |
| 31 | + os: macos-13, |
| 32 | + build_type: RelWithDebInfo, |
| 33 | + cc: "clang", cxx: "clang++", |
| 34 | + cxx_standard: 17, |
| 35 | + } |
| 36 | + - { |
| 37 | + name: "macOS Clang Debug (C++20 / ASAN)", artifact: "macOS.tar.xz", |
| 38 | + os: macos-13, |
| 39 | + build_type: Debug, |
| 40 | + cc: "clang", cxx: "clang++", |
| 41 | + cxx_standard: 20, |
| 42 | + cxx_asan: true, |
| 43 | + } |
| 44 | + - { |
| 45 | + name: "macOS Clang Release (C++20)", artifact: "macOS.tar.xz", |
| 46 | + os: macos-13, |
| 47 | + build_type: RelWithDebInfo, |
| 48 | + cc: "clang", cxx: "clang++", |
| 49 | + cxx_standard: 20, |
| 50 | + } |
| 51 | + |
| 52 | + - { |
| 53 | + name: "macOS Clang Debug (C++17)", artifact: "macOS.tar.xz", |
| 54 | + os: macos-14, |
| 55 | + build_type: Debug, |
| 56 | + cc: "clang", cxx: "clang++", |
| 57 | + cxx_standard: 17, |
| 58 | + cxx_asan: true, |
| 59 | + } |
| 60 | + - { |
| 61 | + name: "macOS Clang Release (C++17)", artifact: "macOS.tar.xz", |
| 62 | + os: macos-14, |
| 63 | + build_type: RelWithDebInfo, |
| 64 | + cc: "clang", cxx: "clang++", |
| 65 | + cxx_standard: 17, |
| 66 | + } |
| 67 | + - { |
| 68 | + name: "macOS Clang Debug (C++20 / ASAN)", artifact: "macOS.tar.xz", |
| 69 | + os: macos-14, |
| 70 | + build_type: Debug, |
| 71 | + cc: "clang", cxx: "clang++", |
| 72 | + cxx_standard: 20, |
| 73 | + cxx_asan: true, |
| 74 | + } |
| 75 | + - { |
| 76 | + name: "macOS Clang Release (C++20)", artifact: "macOS.tar.xz", |
| 77 | + os: macos-14, |
| 78 | + build_type: RelWithDebInfo, |
| 79 | + cc: "clang", cxx: "clang++", |
| 80 | + cxx_standard: 20, |
| 81 | + } |
| 82 | + |
| 83 | + - { |
| 84 | + name: "macOS Clang Debug (C++17)", artifact: "macOS.tar.xz", |
| 85 | + os: macos-latest, |
| 86 | + build_type: Debug, |
| 87 | + cc: "clang", cxx: "clang++", |
| 88 | + cxx_standard: 17, |
| 89 | + cxx_asan: true, |
| 90 | + } |
| 91 | + - { |
| 92 | + name: "macOS Clang Release (C++17)", artifact: "macOS.tar.xz", |
| 93 | + os: macos-latest, |
| 94 | + build_type: RelWithDebInfo, |
| 95 | + cc: "clang", cxx: "clang++", |
| 96 | + cxx_standard: 17, |
| 97 | + } |
| 98 | + - { |
| 99 | + name: "macOS Clang Debug (C++20 / ASAN)", artifact: "macOS.tar.xz", |
| 100 | + os: macos-latest, |
| 101 | + build_type: Debug, |
| 102 | + cc: "clang", cxx: "clang++", |
| 103 | + cxx_standard: 20, |
| 104 | + cxx_asan: true, |
| 105 | + } |
| 106 | + - { |
| 107 | + name: "macOS Clang Release (C++20)", artifact: "macOS.tar.xz", |
| 108 | + os: macos-latest, |
| 109 | + build_type: RelWithDebInfo, |
| 110 | + cc: "clang", cxx: "clang++", |
| 111 | + cxx_standard: 20, |
| 112 | + } |
| 113 | + |
| 114 | + steps: |
| 115 | + - uses: actions/checkout@v4 |
| 116 | + |
| 117 | + - name: Download Ninja and CMake |
| 118 | + id: cmake_and_ninja |
| 119 | + shell: cmake -P {0} |
| 120 | + run: | |
| 121 | + set(cmake_version $ENV{CMAKE_VERSION}) |
| 122 | + set(ninja_version $ENV{NINJA_VERSION}) |
| 123 | +
|
| 124 | + message(STATUS "Using host CMake version: ${CMAKE_VERSION}") |
| 125 | +
|
| 126 | + # Save the path for other steps |
| 127 | + file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/${cmake_dir}" cmake_dir) |
| 128 | + message("::set-output name=cmake_dir::${cmake_dir}") |
| 129 | +
|
| 130 | + - name: Configure |
| 131 | + shell: cmake -P {0} |
| 132 | + run: | |
| 133 | + set(ENV{CC} ${{ matrix.config.cc }}) |
| 134 | + set(ENV{CXX} ${{ matrix.config.cxx }}) |
| 135 | +
|
| 136 | + if ("${{ matrix.config.cxx }}" MATCHES "clang.*") |
| 137 | + # clang spurious warning on <=> use |
| 138 | + set(cxx_flags "${cxx_flags} -Wno-zero-as-null-pointer-constant") |
| 139 | + endif() |
| 140 | +
|
| 141 | + if ("x${{ matrix.config.cxx_asan }}" STREQUAL "xtrue") |
| 142 | + set(cxx_flags "${cxx_flags} -fsanitize=address") |
| 143 | + if ("${{ runner.os }}" STREQUAL "Windows") |
| 144 | + set(link_flags "${link_flags} /INFERASANLIBS /INCREMENTAL:NO") |
| 145 | + else() |
| 146 | + set(cxx_flags "${cxx_flags} -fno-omit-frame-pointer") |
| 147 | + endif() |
| 148 | + endif() |
| 149 | +
|
| 150 | + set(cxx_concepts ON) |
| 151 | + if ("x${{ matrix.config.cxx_concepts }}" STREQUAL "xfalse") |
| 152 | + set(cxx_concepts OFF) |
| 153 | + endif() |
| 154 | +
|
| 155 | + execute_process( |
| 156 | + COMMAND ${{ steps.cmake_and_ninja.outputs.cmake_dir }}/cmake |
| 157 | + -S . |
| 158 | + -B build |
| 159 | + # -G Ninja |
| 160 | + -D CMAKE_BUILD_TYPE=${{ matrix.config.build_type }} |
| 161 | + # -D CMAKE_MAKE_PROGRAM:STRING=ninja |
| 162 | + -D CMAKE_CXX_STANDARD:STRING=${{ matrix.config.cxx_standard }} |
| 163 | + -D "CMAKE_CXX_FLAGS:STRING=${cxx_flags}" |
| 164 | + -D "CMAKE_EXE_LINKER_FLAGS:STRING=${link_flags}" |
| 165 | + -D CMAKE_VERBOSE_MAKEFILE:BOOL=ON |
| 166 | + -D RANGE_V3_HEADER_CHECKS:BOOL=ON |
| 167 | + -D RANGES_PREFER_REAL_CONCEPTS:BOOL=${cxx_concepts} |
| 168 | + ${{ matrix.config.cmake_args }} |
| 169 | + ${extra_cmake_args} |
| 170 | + RESULT_VARIABLE result |
| 171 | + ) |
| 172 | + if (NOT result EQUAL 0) |
| 173 | + message(FATAL_ERROR "Bad exit status") |
| 174 | + endif() |
| 175 | +
|
| 176 | + - name: Build |
| 177 | + shell: cmake -P {0} |
| 178 | + continue-on-error: ${{ matrix.config.experimental || false }} |
| 179 | + run: | |
| 180 | + set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ") |
| 181 | +
|
| 182 | + if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x") |
| 183 | + file(STRINGS environment_script_output.txt output_lines) |
| 184 | + foreach(line IN LISTS output_lines) |
| 185 | + if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$") |
| 186 | + set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}") |
| 187 | + endif() |
| 188 | + endforeach() |
| 189 | + endif() |
| 190 | +
|
| 191 | + set(path_separator ":") |
| 192 | + if ("${{ runner.os }}" STREQUAL "Windows") |
| 193 | + set(path_separator ";") |
| 194 | + endif() |
| 195 | + set(ENV{PATH} "$ENV{GITHUB_WORKSPACE}${path_separator}$ENV{PATH}") |
| 196 | +
|
| 197 | + execute_process( |
| 198 | + COMMAND ${{ steps.cmake_and_ninja.outputs.cmake_dir }}/cmake --build build |
| 199 | + RESULT_VARIABLE result |
| 200 | + ) |
| 201 | + if (NOT result EQUAL 0) |
| 202 | + message(FATAL_ERROR "Bad exit status") |
| 203 | + endif() |
| 204 | +
|
| 205 | + - name: Run tests |
| 206 | + shell: cmake -P {0} |
| 207 | + continue-on-error: ${{ matrix.config.experimental || false }} |
| 208 | + run: | |
| 209 | + include(ProcessorCount) |
| 210 | + ProcessorCount(N) |
| 211 | +
|
| 212 | + set(ENV{CTEST_OUTPUT_ON_FAILURE} "ON") |
| 213 | +
|
| 214 | + execute_process( |
| 215 | + COMMAND ${{ steps.cmake_and_ninja.outputs.cmake_dir }}/ctest --verbose -j ${N} |
| 216 | + WORKING_DIRECTORY build |
| 217 | + RESULT_VARIABLE result |
| 218 | + ) |
| 219 | + if (NOT result EQUAL 0) |
| 220 | + message(FATAL_ERROR "Running tests failed!") |
| 221 | + endif() |
0 commit comments