diff --git a/.github/workflows/build-c-api-bindings.yml b/.github/workflows/build-c-api-bindings.yml index bce1fcfa2..4139b795f 100644 --- a/.github/workflows/build-c-api-bindings.yml +++ b/.github/workflows/build-c-api-bindings.yml @@ -15,14 +15,13 @@ name: Build and test C API bindings on: - push: - branches: - - main pull_request: paths-ignore: - 'bindings/cpp/**' - 'bindings/python/**' - '**.md' + merge_group: + types: [checks_requested] workflow_dispatch: permissions: diff --git a/.github/workflows/build-cpp-runtime-bindings.yml b/.github/workflows/build-cpp-runtime-bindings.yml index c18e1a8c6..3a9a4817c 100644 --- a/.github/workflows/build-cpp-runtime-bindings.yml +++ b/.github/workflows/build-cpp-runtime-bindings.yml @@ -15,14 +15,13 @@ name: Build and test C++ Runtime Bindings on: - push: - branches: - - main pull_request: paths-ignore: - 'bindings/c/**' - 'bindings/python/**' - '**.md' + merge_group: + types: [checks_requested] workflow_dispatch: permissions: diff --git a/.github/workflows/build-linux-arm.yml b/.github/workflows/build-linux-arm.yml index 5a46f0361..a65275815 100644 --- a/.github/workflows/build-linux-arm.yml +++ b/.github/workflows/build-linux-arm.yml @@ -14,14 +14,11 @@ name: Linux Build and Test on ARM +# Builds only in the merge queue; on pull requests every job is skipped so the required check is satisfied. on: - push: - branches: - - main pull_request: - paths-ignore: - - 'bindings/**' - - '**.md' + merge_group: + types: [checks_requested] workflow_dispatch: permissions: @@ -35,6 +32,7 @@ concurrency: jobs: build: name: ${{ matrix.cxx }}, ${{ matrix.build_type }} + if: github.event_name != 'pull_request' runs-on: ubuntu-22.04-arm strategy: matrix: @@ -74,3 +72,15 @@ jobs: CTEST_OUTPUT_ON_FAILURE: 1 working-directory: ${{ runner.temp }}/build/tests run: ctest -C ${{ matrix.build_type }} + + linux-arm-passed: + # Skipped (shown grey) when nothing ran, so the PR page doesn't show a green check for unbuilt work. + name: linux-arm-passed + if: always() && github.event_name != 'pull_request' + needs: build + runs-on: ubuntu-22.04 + steps: + - name: Require the build to have run and succeeded + run: | + echo "build=${{ needs.build.result }}" + [[ "${{ needs.build.result }}" == success ]] diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index 92df99a86..55c65002a 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -15,13 +15,9 @@ name: Linux Build and Test on: - push: - branches: - - main pull_request: - paths-ignore: - - 'bindings/**' - - '**.md' + merge_group: + types: [checks_requested] workflow_dispatch: permissions: @@ -33,26 +29,43 @@ concurrency: cancel-in-progress: true jobs: + # Skip the builds on pull requests that only touch paths this workflow ignores. + changes: + name: Detect changes + runs-on: ubuntu-22.04 + permissions: + pull-requests: read + outputs: + relevant: ${{ github.event_name != 'pull_request' || steps.filter.outputs.relevant == 'true' }} + steps: + - id: filter + if: github.event_name == 'pull_request' + env: + GH_TOKEN: ${{ github.token }} + run: | + files=$(gh api --paginate "repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" --jq '.[].filename') + # relevant if any changed file is outside the ignored paths + if grep -qvE '^bindings/|\.md$' <<< "$files"; then echo relevant=true; else echo relevant=false; fi >> "$GITHUB_OUTPUT" + build: - name: ${{ matrix.cxx }}, ${{ matrix.build_type }}, ivf=${{ matrix.ivf }}, asan=${{ matrix.asan }} + name: ${{ matrix.toolchain.cxx }}, ${{ matrix.build_type }}, ivf=${{ matrix.ivf }}, asan=${{ matrix.asan }} + needs: changes + if: needs.changes.outputs.relevant == 'true' runs-on: ubuntu-22.04 strategy: matrix: build_type: [RelWithDebInfo] ivf: [OFF, ON] - cxx: [g++-11, g++-12, clang++-15] + # cc rides with cxx in one object so the pull request exclusions below can't strand an include. + toolchain: + - {cxx: g++-11, cc: gcc-11} + - {cxx: g++-12, cc: gcc-12} + - {cxx: clang++-15, cc: clang-15} asan: [OFF] cmake_extra_args: [-DSVS_BUILD_BINARIES=YES -DSVS_BUILD_EXAMPLES=YES] ctest_args: [''] include: - - cxx: g++-11 - cc: gcc-11 - - cxx: g++-12 - cc: gcc-12 - - cxx: clang++-15 - cc: clang-15 - - cxx: clang++-18 - cc: clang-18 + - toolchain: {cxx: clang++-18, cc: clang-18} build_type: Debug ivf: OFF asan: ON @@ -66,9 +79,8 @@ jobs: -DSVS_BUILD_EXAMPLES=NO # skip longer-running tests ctest_args: -LE long - exclude: - - cxx: g++-12 - ivf: ON + # Pull requests run g++-11 ivf=ON and ASan; the merge queue runs the full matrix. + exclude: ${{ fromJSON(github.event_name == 'pull_request' && '[{"toolchain":{"cxx":"g++-12","cc":"gcc-12"}},{"toolchain":{"cxx":"clang++-15","cc":"clang-15"}},{"toolchain":{"cxx":"g++-11","cc":"gcc-11"},"ivf":"OFF"}]' || '[{"toolchain":{"cxx":"g++-12","cc":"gcc-12"},"ivf":"ON"}]') }} steps: - uses: actions/checkout@v6 @@ -83,7 +95,7 @@ jobs: printenv >> $GITHUB_ENV - name: Install Clang 18 - if: matrix.cxx == 'clang++-18' + if: matrix.toolchain.cxx == 'clang++-18' run: | wget https://apt.llvm.org/llvm.sh chmod +x llvm.sh @@ -92,8 +104,8 @@ jobs: - name: Configure build working-directory: ${{ runner.temp }} env: - CXX: ${{ matrix.cxx }} - CC: ${{ matrix.cc }} + CXX: ${{ matrix.toolchain.cxx }} + CC: ${{ matrix.toolchain.cc }} TEMP_WORKSPACE: ${{ runner.temp }} run: | cmake -B${TEMP_WORKSPACE}/build -S${GITHUB_WORKSPACE} \ @@ -119,3 +131,16 @@ jobs: CTEST_OUTPUT_ON_FAILURE: 1 working-directory: ${{ runner.temp }}/build/examples/cpp run: ctest -C ${{ matrix.build_type }} + + # Fixed-name required check; matrix job names can't be required because they change with the matrix. + linux-passed: + # Skipped (shown grey) when nothing ran; still runs if change detection itself failed. + name: linux-passed + if: always() && (needs.changes.result != 'success' || needs.changes.outputs.relevant == 'true') + needs: [changes, build] + runs-on: ubuntu-22.04 + steps: + - name: Require every job to have run and succeeded + run: | + echo "changes=${{ needs.changes.result }} build=${{ needs.build.result }}" + [[ "${{ needs.changes.result }}" == success && "${{ needs.build.result }}" == success ]] diff --git a/.github/workflows/build-macos.yaml b/.github/workflows/build-macos.yaml index 47649c0a4..23ef9152a 100644 --- a/.github/workflows/build-macos.yaml +++ b/.github/workflows/build-macos.yaml @@ -14,14 +14,11 @@ name: MacOS Build and Test +# Builds only in the merge queue; on pull requests every job is skipped so the required check is satisfied. on: - push: - branches: - - main pull_request: - paths-ignore: - - 'bindings/**' - - '**.md' + merge_group: + types: [checks_requested] workflow_dispatch: permissions: @@ -35,6 +32,7 @@ concurrency: jobs: build: name: ${{ matrix.cxx }}, ${{ matrix.build_type }} + if: github.event_name != 'pull_request' runs-on: macos-latest strategy: matrix: @@ -87,3 +85,15 @@ jobs: CTEST_OUTPUT_ON_FAILURE: 1 working-directory: ${{ runner.temp }}/build/tests run: ctest -C ${{ matrix.build_type }} + + macos-passed: + # Skipped (shown grey) when nothing ran, so the PR page doesn't show a green check for unbuilt work. + name: macos-passed + if: always() && github.event_name != 'pull_request' + needs: build + runs-on: ubuntu-22.04 + steps: + - name: Require the build to have run and succeeded + run: | + echo "build=${{ needs.build.result }}" + [[ "${{ needs.build.result }}" == success ]] diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 6ab5644f9..7ca63f3c7 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -15,10 +15,9 @@ name: CIBuildWheel on: - push: - branches: - - main pull_request: + merge_group: + types: [checks_requested] workflow_dispatch: permissions: diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index a152896fb..8cd035486 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -16,6 +16,8 @@ name: pre-commit on: pull_request: + merge_group: + types: [checks_requested] workflow_dispatch: jobs: diff --git a/.github/workflows/skywalking-eyes.yml b/.github/workflows/skywalking-eyes.yml index aed657dfe..ce3d2526d 100644 --- a/.github/workflows/skywalking-eyes.yml +++ b/.github/workflows/skywalking-eyes.yml @@ -18,9 +18,8 @@ on: pull_request: branches: - main - push: - branches: - - main + merge_group: + types: [checks_requested] workflow_dispatch: permissions: read-all diff --git a/README.md b/README.md index 9e36a4b5a..fca5be1d8 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,8 @@ # Scalable Vector Search -[![Linux Build and Test](https://github.com/intel/ScalableVectorSearch/actions/workflows/build-linux.yml/badge.svg?event=push)](https://github.com/intel/ScalableVectorSearch/actions/workflows/build-linux.yml) -[![CIBuildWheel](https://github.com/intel/ScalableVectorSearch/actions/workflows/cibuildwheel.yml/badge.svg?event=push)](https://github.com/intel/ScalableVectorSearch/actions/workflows/cibuildwheel.yml) +[![Linux Build and Test](https://github.com/intel/ScalableVectorSearch/actions/workflows/build-linux.yml/badge.svg?event=merge_group)](https://github.com/intel/ScalableVectorSearch/actions/workflows/build-linux.yml) +[![CIBuildWheel](https://github.com/intel/ScalableVectorSearch/actions/workflows/cibuildwheel.yml/badge.svg?event=merge_group)](https://github.com/intel/ScalableVectorSearch/actions/workflows/cibuildwheel.yml) [![License](https://img.shields.io/badge/License-Apache%202.0-silver.svg)](https://github.com/intel/ScalableVectorSearch/blob/main/LICENSE) **Scalable Vector Search (SVS)** is a performance library for vector [similarity search](https://en.wikipedia.org/wiki/Similarity_search).