Update deprecated macOS runner #10125
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Native build | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ master ] | |
| merge_group: | |
| concurrency: | |
| group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| # The CMake configure and build commands are platform-agnostic and should work equally | |
| # well on Windows or Mac. You can convert this to a matrix build if you need | |
| # cross-platform coverage. | |
| # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| compiler: [gcc, clang] | |
| compiler-version: [8, 11, 12, 13, 15, 16, 18, 21] | |
| warnings: [ "-Wall -Wextra -Werror " ] | |
| build-type: [Release] | |
| expensive-tests: [true] | |
| additional-cmake-options: [""] | |
| isPr: | |
| - ${{github.event_name == 'pull_request'}} # some checks are only run in the master. | |
| skipIfPr: [false] | |
| exclude: | |
| - compiler: gcc | |
| compiler-version: 8 | |
| - compiler: gcc | |
| compiler-version: 12 | |
| isPr: true | |
| - compiler: gcc | |
| compiler-version: 15 | |
| - compiler: gcc | |
| compiler-version: 16 | |
| - compiler: gcc | |
| compiler-version: 18 | |
| - compiler: gcc | |
| compiler-version: 21 | |
| - compiler: clang | |
| compiler-version: 8 | |
| - compiler: clang | |
| compiler-version: 11 | |
| - compiler: clang | |
| compiler-version: 12 | |
| - compiler: clang | |
| compiler-version: 13 | |
| - compiler: clang | |
| compiler-version: 15 | |
| - compiler: clang | |
| compiler-version: 16 | |
| isPr: true | |
| - compiler: clang | |
| compiler-version: 18 | |
| isPr: true | |
| include: | |
| - compiler: gcc | |
| compiler-version: 11 | |
| additional-cmake-options: "-DUSE_CPP_17_BACKPORTS=ON" | |
| build-type: Release | |
| # TODO<joka921> Figure out a way to enable this build only for master pushes and not for the PR. | |
| # - compiler: clang | |
| # compiler-version: 15 | |
| # additional-cmake-options: "-DUSE_CPP_17_BACKPORTS=ON -DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_FLAGS='-ferror-limit=0' -DCOMPILER_VERSION_CHECK_DEACTIVATED=ON" | |
| # build-type: Debug | |
| # skipIfPr: true | |
| # expensive-tests: false | |
| # continue-on-error: true | |
| # use-keep-going: true | |
| # use-ignore-errors: true | |
| - compiler: clang | |
| compiler-version: 16 | |
| asan-flags: "-fsanitize=address -fno-omit-frame-pointer" | |
| build-type: RelWithDebInfo | |
| expensive-tests: false | |
| - compiler: clang | |
| compiler-version: 16 | |
| ubsan-flags: " -fsanitize=undefined" | |
| build-type: RelWithDebInfo | |
| expensive-tests: false | |
| skipIfPr: false | |
| - compiler: clang | |
| compiler-version: 17 | |
| build-type: Debug | |
| expensive-tests: false | |
| ubsan-flags: " -fsanitize=thread -O1 -g" | |
| additional-cmake-options: "-D_NO_TIMING_TESTS=ON" | |
| skipIfPr: false | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Skip early if conditions are not met | |
| if: (github.event_name == 'pull_request' && matrix.skipIfPr) | |
| run: exit 0; | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'recursive' | |
| - name: Install dependencies | |
| uses: ./.github/workflows/install-dependencies-ubuntu | |
| - name: Install compiler | |
| uses: ./.github/workflows/install-compiler-ubuntu | |
| with: | |
| compiler: ${{matrix.compiler}} | |
| compiler-version: ${{matrix.compiler-version}} | |
| - name: Reduce address randomization to make sanitizers work | |
| # For details see for example `https://stackoverflow.com/questions/77850769/fatal-threadsanitizer-unexpected-memory-mapping-when-running-on-linux-kernels` | |
| run: | | |
| sudo sysctl vm.mmap_rnd_bits | |
| sudo sysctl vm.mmap_rnd_bits=28 | |
| - name: Configure CMake | |
| env: | |
| USE_PCH: ${{ matrix.compiler-version == 21 && 'ON' || 'OFF' }} | |
| # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. | |
| # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type | |
| run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build-type}} -DCMAKE_TOOLCHAIN_FILE="$(pwd)/toolchains/${{matrix.compiler}}${{matrix.compiler-version}}.cmake" -DADDITIONAL_COMPILER_FLAGS="${{matrix.warnings}} ${{matrix.asan-flags}} ${{matrix.ubsan-flags}}" -DUSE_PARALLEL=true -DRUN_EXPENSIVE_TESTS=${{matrix.expensive-tests}} -DENABLE_EXPENSIVE_CHECKS=true ${{matrix.additional-cmake-options}} -DADDITIONAL_LINKER_FLAGS="-B /usr/bin/mold" -DSINGLE_TEST_BINARY=ON -DUSE_PRECOMPILED_HEADERS=${{env.USE_PCH}} | |
| - name: Build | |
| # Build your program with the given configuration | |
| run: | | |
| cmake --build ${{github.workspace}}/build --config ${{matrix.build-type}} -- -j $(nproc) | |
| id: build | |
| - name: Test | |
| id: complete_tests | |
| working-directory: ${{github.workspace}}/build/test | |
| run: env CTEST_OUTPUT_ON_FAILURE=1 ctest -C ${{matrix.build-type}} . | |
| - name: Running and printing the benchmark examples. | |
| run: ${{github.workspace}}/build/benchmark/BenchmarkExamples -p | |
| # Run the E2E test only once, but for GCC add the text index separately. | |
| # Note that the dispatch by the compiler is arbitrary, we just want | |
| # to have both cases tested. | |
| - name: E2E with index in one go | |
| if: (matrix.compiler == 'clang') && (steps.complete_tests.outcome == 'success') | |
| run: ${{github.workspace}}/e2e/e2e.sh | |
| - name: E2E with separate text index build | |
| if: (matrix.compiler != 'clang') && (steps.complete_tests.outcome == 'success') | |
| run: ${{github.workspace}}/e2e/e2e.sh -t |