| # Copyright 2021 Google LLC | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| permissions: | |
| contents: read | |
| name: Build / test | |
| on: | |
| pull_request: | |
| schedule: | |
| - cron: '0 3 * * 6' # Saturdays 03:00 UTC | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| cmake: | |
| name: Build and test ${{ matrix.name }} | |
| runs-on: ubuntu-22.04 | |
| strategy: | |
| matrix: | |
| include: | |
| - name: Clang-12 | |
| extra_deps: clang-12 | |
| c_compiler: clang-12 | |
| cxx_compiler: clang++-12 | |
| extra_cmake_flags: -DHWY_ENABLE_CONTRIB=OFF | |
| cxx_standard: 17 | |
| - name: Clang-15 (C++20) | |
| extra_deps: clang-15 | |
| c_compiler: clang-15 | |
| cxx_compiler: clang++-15 | |
| extra_cmake_flags: -DHWY_ENABLE_CONTRIB=OFF | |
| cxx_standard: 20 | |
| - name: GCC-10 | |
| extra_deps: g++-10 | |
| c_compiler: gcc-10 | |
| cxx_compiler: g++-10 | |
| cxx_flags: -ftrapv | |
| extra_cmake_flags: -DHWY_ENABLE_CONTRIB=OFF | |
| cxx_standard: 17 | |
| - name: GCC-12 (C++11) | |
| extra_deps: g++-12 | |
| c_compiler: gcc-12 | |
| cxx_compiler: g++-12 | |
| cxx_flags: -ftrapv | |
| # contrib/ requires C++17 | |
| extra_cmake_flags: -DHWY_ENABLE_CONTRIB=OFF | |
| cxx_standard: 11 | |
| - name: GCC-12 (x86_32) | |
| extra_deps: g++-12-i686-linux-gnu | |
| c_compiler: i686-linux-gnu-gcc-12 | |
| cxx_compiler: i686-linux-gnu-g++-12 | |
| # Disable AVX3 targets on x86_32 | |
| cxx_flags: -m32 -ftrapv -DHWY_DISABLED_TARGETS=0x1FF -DHWY_BROKEN_TARGETS=0x1FF | |
| extra_cmake_flags: -DCMAKE_C_COMPILER_TARGET=i686-linux-gnu -DCMAKE_CXX_COMPILER_TARGET=i686-linux-gnu -DHWY_CMAKE_SSE2=ON -DHWY_ENABLE_CONTRIB=OFF | |
| cxx_standard: 17 | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4 | |
| with: | |
| egress-policy: audit # cannot be block - runner does git checkout | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Install deps | |
| run: sudo apt-get update && sudo apt-get install ${{ matrix.extra_deps }} | |
| - name: Build and test | |
| run: | | |
| export CMAKE_BUILD_PARALLEL_LEVEL=2 | |
| export CTEST_PARALLEL_LEVEL=2 | |
| CXXFLAGS="${{ matrix.cxx_flags }}" CC=${{ matrix.c_compiler }} CXX=${{ matrix.cxx_compiler }} cmake -DHWY_WARNINGS_ARE_ERRORS=ON -DCMAKE_CXX_STANDARD=${{ matrix.cxx_standard }} ${{ matrix.extra_cmake_flags }} -B out . | |
| cmake --build out | |
| ctest --test-dir out | |
| cmake_rest: | |
| name: Build and test ${{ matrix.name }} | |
| runs-on: ubuntu-22.04 | |
| if: github.event_name != 'pull_request' | |
| strategy: | |
| matrix: | |
| include: | |
| - name: Clang-13 | |
| extra_deps: clang-13 | |
| c_compiler: clang-13 | |
| cxx_compiler: clang++-13 | |
| extra_cmake_flags: -DHWY_ENABLE_CONTRIB=OFF | |
| cxx_standard: 17 | |
| - name: Clang-14 | |
| extra_deps: clang-14 | |
| c_compiler: clang-14 | |
| cxx_compiler: clang++-14 | |
| extra_cmake_flags: -DHWY_ENABLE_CONTRIB=OFF | |
| cxx_standard: 17 | |
| - name: Clang-15 | |
| extra_deps: clang-15 | |
| c_compiler: clang-15 | |
| cxx_compiler: clang++-15 | |
| extra_cmake_flags: -DHWY_ENABLE_CONTRIB=OFF | |
| cxx_standard: 17 | |
| - name: Clang-15 (x86_32) | |
| extra_deps: clang-15 g++-i686-linux-gnu | |
| c_compiler: clang-15 | |
| cxx_compiler: clang++-15 | |
| # Disable AVX3 targets on x86_32 | |
| cxx_flags: -m32 -DHWY_DISABLED_TARGETS=0x1FF -DHWY_BROKEN_TARGETS=0x1FF | |
| extra_cmake_flags: -DCMAKE_C_COMPILER_TARGET=i686-linux-gnu -DCMAKE_CXX_COMPILER_TARGET=i686-linux-gnu -DHWY_CMAKE_SSE2=ON -DHWY_ENABLE_CONTRIB=OFF | |
| cxx_standard: 17 | |
| - name: GCC-11 | |
| extra_deps: g++-11 | |
| c_compiler: gcc-11 | |
| cxx_compiler: g++-11 | |
| cxx_flags: -ftrapv | |
| extra_cmake_flags: -DHWY_ENABLE_CONTRIB=OFF | |
| cxx_standard: 17 | |
| - name: GCC-11 (C++20) | |
| extra_deps: g++-11 | |
| c_compiler: gcc-11 | |
| cxx_compiler: g++-11 | |
| cxx_flags: -ftrapv | |
| extra_cmake_flags: -DHWY_ENABLE_CONTRIB=OFF | |
| cxx_standard: 20 | |
| - name: GCC-12 (C++20) | |
| extra_deps: g++-12 | |
| c_compiler: gcc-12 | |
| cxx_compiler: g++-12 | |
| cxx_flags: -ftrapv | |
| extra_cmake_flags: -DHWY_ENABLE_CONTRIB=OFF | |
| cxx_standard: 20 | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4 | |
| with: | |
| egress-policy: audit # cannot be block - runner does git checkout | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Install deps | |
| run: sudo apt-get update && sudo apt-get install ${{ matrix.extra_deps }} | |
| - name: Build and test | |
| run: | | |
| export CMAKE_BUILD_PARALLEL_LEVEL=2 | |
| export CTEST_PARALLEL_LEVEL=2 | |
| CXXFLAGS="${{ matrix.cxx_flags }}" CC=${{ matrix.c_compiler }} CXX=${{ matrix.cxx_compiler }} cmake -DHWY_WARNINGS_ARE_ERRORS=ON -DCMAKE_CXX_STANDARD=${{ matrix.cxx_standard }} ${{ matrix.extra_cmake_flags }} -B out . | |
| cmake --build out | |
| ctest --test-dir out | |
| cmake_ubuntu_2404: | |
| name: Build and test ${{ matrix.name }} | |
| runs-on: ubuntu-24.04 | |
| if: github.event_name != 'pull_request' | |
| strategy: | |
| matrix: | |
| include: | |
| - name: Clang-16 | |
| extra_deps: clang-16 | |
| c_compiler: clang-16 | |
| cxx_compiler: clang++-16 | |
| # Disable AVX3_SPR/AVX3_ZEN4 targets in GitHub workflow build with | |
| # Clang 16 or later to work around crashes that occur with Clang 16 | |
| # or later when some of the Google Highway tests are compiled with | |
| # all x86 targets enabled | |
| cxx_flags: -DHWY_DISABLED_TARGETS=0x58 | |
| extra_cmake_flags: -DHWY_ENABLE_CONTRIB=OFF | |
| cxx_standard: 17 | |
| - name: Clang-17 | |
| extra_deps: clang-17 | |
| c_compiler: clang-17 | |
| cxx_compiler: clang++-17 | |
| # Disable AVX3_SPR/AVX3_ZEN4 targets in GitHub workflow build with | |
| # Clang 16 or later to work around crashes that occur with Clang 16 | |
| # or later when some of the Google Highway tests are compiled with | |
| # all x86 targets enabled | |
| cxx_flags: -DHWY_DISABLED_TARGETS=0x58 | |
| extra_cmake_flags: -DHWY_ENABLE_CONTRIB=OFF | |
| cxx_standard: 17 | |
| - name: Clang-18 | |
| extra_deps: clang-18 | |
| c_compiler: clang-18 | |
| cxx_compiler: clang++-18 | |
| # Disable AVX3_SPR/AVX3_ZEN4 targets in GitHub workflow build with | |
| # Clang 16 or later to work around crashes that occur with Clang 16 | |
| # or later when some of the Google Highway tests are compiled with | |
| # all x86 targets enabled | |
| cxx_flags: -DHWY_DISABLED_TARGETS=0x58 | |
| extra_cmake_flags: -DHWY_ENABLE_CONTRIB=OFF | |
| cxx_standard: 17 | |
| - name: Clang-18 (C++23) | |
| extra_deps: clang-18 | |
| c_compiler: clang-18 | |
| cxx_compiler: clang++-18 | |
| # Disable AVX3_SPR/AVX3_ZEN4 targets in GitHub workflow build with | |
| # Clang 16 or later to work around crashes that occur with Clang 16 | |
| # or later when some of the Google Highway tests are compiled with | |
| # all x86 targets enabled | |
| cxx_flags: -DHWY_DISABLED_TARGETS=0x58 | |
| extra_cmake_flags: -DHWY_ENABLE_CONTRIB=OFF | |
| cxx_standard: 23 | |
| - name: Clang-19 | |
| extra_deps: clang-19 | |
| c_compiler: clang-19 | |
| cxx_compiler: clang++-19 | |
| # Disable AVX3_SPR/AVX3_ZEN4 targets in GitHub workflow build with | |
| # Clang 16 or later to work around crashes that occur with Clang 16 | |
| # or later when some of the Google Highway tests are compiled with | |
| # all x86 targets enabled | |
| cxx_flags: -DHWY_DISABLED_TARGETS=0x58 | |
| extra_cmake_flags: -DHWY_ENABLE_CONTRIB=OFF | |
| cxx_standard: 17 | |
| - name: GCC-13 | |
| extra_deps: g++-13 | |
| c_compiler: gcc-13 | |
| cxx_compiler: g++-13 | |
| cxx_flags: -ftrapv | |
| extra_cmake_flags: -DHWY_ENABLE_CONTRIB=OFF | |
| cxx_standard: 17 | |
| - name: GCC-13 (C++23) | |
| extra_deps: g++-13 | |
| c_compiler: gcc-13 | |
| cxx_compiler: g++-13 | |
| cxx_flags: -ftrapv | |
| extra_cmake_flags: -DHWY_ENABLE_CONTRIB=OFF | |
| cxx_standard: 23 | |
| - name: GCC-14 | |
| extra_deps: g++-14 | |
| c_compiler: gcc-14 | |
| cxx_compiler: g++-14 | |
| cxx_flags: -ftrapv | |
| extra_cmake_flags: -DHWY_ENABLE_CONTRIB=OFF | |
| cxx_standard: 17 | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4 | |
| with: | |
| egress-policy: audit # cannot be block - runner does git checkout | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Install deps | |
| run: sudo apt-get update && sudo apt-get install ${{ matrix.extra_deps }} | |
| - name: Build and test | |
| run: | | |
| export CMAKE_BUILD_PARALLEL_LEVEL=2 | |
| export CTEST_PARALLEL_LEVEL=2 | |
| CXXFLAGS="${{ matrix.cxx_flags }}" CC=${{ matrix.c_compiler }} CXX=${{ matrix.cxx_compiler }} cmake -DHWY_WARNINGS_ARE_ERRORS=ON -DCMAKE_CXX_STANDARD=${{ matrix.cxx_standard }} ${{ matrix.extra_cmake_flags }} -B out . | |
| cmake --build out | |
| ctest --test-dir out | |
| cmake_ubuntu_2604: | |
| name: Build and test ${{ matrix.name }} | |
| runs-on: ubuntu-26.04 | |
| strategy: | |
| matrix: | |
| include: | |
| - name: Clang-21 (VQSort disabled) | |
| extra_deps: clang-21 | |
| c_compiler: clang-21 | |
| cxx_compiler: clang++-21 | |
| cxx_flags: -DHWY_DISABLE_VQSORT=1 | |
| extra_cmake_flags: -DHWY_ENABLE_CONTRIB=OFF | |
| cxx_standard: 17 | |
| - name: Clang-22 | |
| extra_deps: clang-22 | |
| c_compiler: clang-22 | |
| cxx_compiler: clang++-22 | |
| cxx_standard: 17 | |
| - name: Clang-22 (C++23) | |
| extra_deps: clang-22 | |
| c_compiler: clang-22 | |
| cxx_compiler: clang++-22 | |
| cxx_standard: 23 | |
| - name: GCC-16 | |
| extra_deps: g++-16 | |
| c_compiler: gcc-16 | |
| cxx_compiler: g++-16 | |
| cxx_flags: -ftrapv | |
| cxx_standard: 17 | |
| - name: GCC-16 (C++23) | |
| extra_deps: g++-16 | |
| c_compiler: gcc-16 | |
| cxx_compiler: g++-16 | |
| cxx_flags: -ftrapv | |
| cxx_standard: 23 | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4 | |
| with: | |
| egress-policy: audit # cannot be block - runner does git checkout | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Install deps | |
| run: sudo apt-get update && sudo apt-get install ${{ matrix.extra_deps }} | |
| - name: Build and test | |
| run: | | |
| export CMAKE_BUILD_PARALLEL_LEVEL=2 | |
| export CTEST_PARALLEL_LEVEL=2 | |
| CXXFLAGS="${{ matrix.cxx_flags }}" CC=${{ matrix.c_compiler }} CXX=${{ matrix.cxx_compiler }} cmake -DHWY_WARNINGS_ARE_ERRORS=ON -DCMAKE_CXX_STANDARD=${{ matrix.cxx_standard }} ${{ matrix.extra_cmake_flags }} -B out . | |
| cmake --build out | |
| ctest --test-dir out | |
| cmake_ubuntu_2604_rest: | |
| name: Build and test ${{ matrix.name }} | |
| runs-on: ubuntu-26.04 | |
| if: github.event_name != 'pull_request' | |
| strategy: | |
| matrix: | |
| include: | |
| - name: Clang-20 | |
| extra_deps: clang-20 | |
| c_compiler: clang-20 | |
| cxx_compiler: clang++-20 | |
| extra_cmake_flags: -DHWY_ENABLE_CONTRIB=OFF | |
| cxx_standard: 17 | |
| - name: GCC-15 | |
| extra_deps: g++-15 | |
| c_compiler: gcc-15 | |
| cxx_compiler: g++-15 | |
| cxx_flags: -ftrapv | |
| extra_cmake_flags: -DHWY_ENABLE_CONTRIB=OFF | |
| cxx_standard: 17 | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4 | |
| with: | |
| egress-policy: audit # cannot be block - runner does git checkout | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Install deps | |
| run: sudo apt-get update && sudo apt-get install ${{ matrix.extra_deps }} | |
| - name: Build and test | |
| run: | | |
| export CMAKE_BUILD_PARALLEL_LEVEL=2 | |
| export CTEST_PARALLEL_LEVEL=2 | |
| CXXFLAGS="${{ matrix.cxx_flags }}" CC=${{ matrix.c_compiler }} CXX=${{ matrix.cxx_compiler }} cmake -DHWY_WARNINGS_ARE_ERRORS=ON -DCMAKE_CXX_STANDARD=${{ matrix.cxx_standard }} ${{ matrix.extra_cmake_flags }} -B out . | |
| cmake --build out | |
| ctest --test-dir out | |
| bazel: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4 | |
| with: | |
| egress-policy: audit # cannot be block - runner does git checkout | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| # Namespace disk-cache by runner image and GCC version so compiler | |
| # upgrades recompile all sources rather than reusing older .o blobs. | |
| - id: cc | |
| run: echo "ver=${ImageOS}-${ImageVersion}-$(gcc -dumpfullversion)" >> "$GITHUB_OUTPUT" | |
| - uses: bazel-contrib/setup-bazel@104e3eea9447cdaa4b00d0fb46191a3985d26ab3 # 0.19.1 | |
| with: | |
| bazelisk-cache: true | |
| repository-cache: true | |
| disk-cache: ${{ steps.cc.outputs.ver }}-${{ hashFiles('.bazelrc', '**/*.bzl') }} | |
| - name: Verify Bazel Version | |
| run: bazel info release | |
| - run: bazel build //... |