Skip to content

feat(clp-mcp-server): Integrate CLP-S Substring Search into MCP Server #1092

feat(clp-mcp-server): Integrate CLP-S Substring Search into MCP Server

feat(clp-mcp-server): Integrate CLP-S Substring Search into MCP Server #1092

name: "clp-artifact-build"
on:
pull_request:
paths-ignore: &ignored_paths
- ".github/*"
- ".github/ISSUE_TEMPLATE/**"
- "components/core/tools/scripts/lib_install/macos/**"
- "docs/**"
push:
paths-ignore: *ignored_paths
schedule:
# Run daily at 00:15 UTC (the 15 is to avoid periods of high load)
- cron: "15 0 * * *"
workflow_dispatch:
env:
BINARIES_ARTIFACT_NAME_PREFIX: "clp-core-binaries-"
DEPS_IMAGE_NAME_PREFIX: "clp-core-dependencies-x86-"
concurrency:
group: "${{github.workflow}}-${{github.ref}}"
# Cancel in-progress jobs for efficiency. Exclude the `main` branch to allow uninterrupted
# publishing of container images.
cancel-in-progress: "${{github.ref != 'refs/heads/main'}}"
jobs:
filter-relevant-changes:
name: "filter-relevant-changes"
runs-on: "ubuntu-24.04"
outputs:
centos_stream_9_image_changed: "${{steps.filter.outputs.centos_stream_9_image}}"
manylinux_2_28_x86_64_image_changed: "${{steps.filter.outputs.manylinux_2_28_x86_64_image}}"
musllinux_1_2_x86_64_image_changed: "${{steps.filter.outputs.musllinux_1_2_x86_64_image}}"
ubuntu_jammy_image_changed: "${{steps.filter.outputs.ubuntu_jammy_image}}"
clp_changed: "${{steps.filter.outputs.clp}}"
steps:
- uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683"
with:
submodules: "recursive"
- name: "Work around actions/runner-images/issues/6775"
run: "chown $(id -u):$(id -g) -R ."
shell: "bash"
- name: "Filter relevant changes"
uses: "dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36"
id: "filter"
with:
# Consider changes between the current commit and `main`
# NOTE: If a pull request changes one of the images, then we need to (1) build the image
# (based on commits in the PR) and then (2) build CLP using the changed image. If a pull
# request doesn't change an image, then we don't need to rebuild the image; instead we can
# use the published image which is based on `main`. So when determining what files have
# changed, we need to consider the delta between the current commit and `main` (rather
# than the current and previous commits) in order to detect if we need to rebuild the
# image (since it would be different from the published image).
base: "main"
filters: |
centos_stream_9_image:
- ".github/actions/**"
- ".github/workflows/clp-artifact-build.yaml"
- "components/core/tools/scripts/lib_install/*.sh"
- "components/core/tools/docker-images/clp-env-base-centos-stream-9/**"
- "components/core/tools/scripts/lib_install/centos-stream-9/**"
manylinux_2_28_x86_64_image:
- ".github/actions/**"
- ".github/workflows/clp-artifact-build.yaml"
- "components/core/tools/scripts/lib_install/*.sh"
- "components/core/tools/docker-images/clp-env-base-manylinux_2_28-x86_64/**"
- "components/core/tools/scripts/lib_install/manylinux_2_28/**"
musllinux_1_2_x86_64_image:
- ".github/actions/**"
- ".github/workflows/clp-artifact-build.yaml"
- "components/core/tools/scripts/lib_install/*.sh"
- "components/core/tools/docker-images/clp-env-base-musllinux_1_2-x86_64/**"
- "components/core/tools/scripts/lib_install/musllinux_1_2/**"
ubuntu_jammy_image:
- ".github/actions/**"
- ".github/workflows/clp-artifact-build.yaml"
- "components/core/tools/scripts/lib_install/*.sh"
- "components/core/tools/docker-images/clp-env-base-ubuntu-jammy/**"
- "components/core/tools/scripts/lib_install/ubuntu-jammy/**"
clp:
- ".github/actions/**"
- ".github/workflows/clp-artifact-build.yaml"
- ".gitmodules"
- "components/core/cmake/**"
- "components/core/CMakeLists.txt"
- "components/core/src/**"
- "components/core/tests/**"
- "components/core/tools/scripts/utils/build-and-run-unit-tests.py"
- "taskfile.yaml"
- "taskfiles/**"
- "tools/scripts/deps-download/**"
centos-stream-9-deps-image:
name: "centos-stream-9-deps-image"
if: "needs.filter-relevant-changes.outputs.centos_stream_9_image_changed == 'true'"
needs: "filter-relevant-changes"
runs-on: "ubuntu-24.04"
steps:
- uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683"
with:
submodules: "recursive"
- name: "Work around actions/runner-images/issues/6775"
run: "chown $(id -u):$(id -g) -R ."
shell: "bash"
- uses: "./.github/actions/clp-core-build-containers"
env:
OS_NAME: "centos-stream-9"
with:
image_name: "${{env.DEPS_IMAGE_NAME_PREFIX}}${{env.OS_NAME}}"
docker_context: "components/core"
docker_file: "components/core/tools/docker-images/clp-env-base-${{env.OS_NAME}}\
/Dockerfile"
push_deps_image: >-
${{github.event_name != 'pull_request' && github.ref == 'refs/heads/main'}}
token: "${{secrets.GITHUB_TOKEN}}"
manylinux_2_28-x86_64-deps-image:
name: "manylinux_2_28-x86_64-deps-image"
if: "needs.filter-relevant-changes.outputs.manylinux_2_28_x86_64_image_changed == 'true'"
needs: "filter-relevant-changes"
runs-on: "ubuntu-24.04"
steps:
- uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683"
with:
submodules: "recursive"
- name: "Work around actions/runner-images/issues/6775"
run: "chown $(id -u):$(id -g) -R ."
shell: "bash"
- uses: "./.github/actions/clp-core-build-containers"
env:
OS_NAME: "manylinux_2_28"
with:
image_name: "${{env.DEPS_IMAGE_NAME_PREFIX}}${{env.OS_NAME}}"
docker_context: "components/core"
docker_file: "components/core/tools/docker-images/clp-env-base-${{env.OS_NAME}}-x86_64\
/Dockerfile"
push_deps_image: >-
${{github.event_name != 'pull_request' && github.ref == 'refs/heads/main'}}
token: "${{secrets.GITHUB_TOKEN}}"
musllinux_1_2-x86_64-deps-image:
name: "musllinux_1_2-x86_64-deps-image"
if: "needs.filter-relevant-changes.outputs.musllinux_1_2_x86_64_image_changed == 'true'"
needs: "filter-relevant-changes"
runs-on: "ubuntu-24.04"
steps:
- uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683"
with:
submodules: "recursive"
- name: "Work around actions/runner-images/issues/6775"
run: "chown $(id -u):$(id -g) -R ."
shell: "bash"
- uses: "./.github/actions/clp-core-build-containers"
env:
OS_NAME: "musllinux_1_2"
with:
image_name: "${{env.DEPS_IMAGE_NAME_PREFIX}}${{env.OS_NAME}}"
docker_context: "components/core"
docker_file: "components/core/tools/docker-images/clp-env-base-${{env.OS_NAME}}-x86_64\
/Dockerfile"
push_deps_image: >-
${{github.event_name != 'pull_request' && github.ref == 'refs/heads/main'}}
token: "${{secrets.GITHUB_TOKEN}}"
ubuntu-jammy-deps-image:
name: "ubuntu-jammy-deps-image"
if: "needs.filter-relevant-changes.outputs.ubuntu_jammy_image_changed == 'true'"
needs: "filter-relevant-changes"
runs-on: "ubuntu-24.04"
steps:
- uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683"
with:
submodules: "recursive"
- name: "Work around actions/runner-images/issues/6775"
run: "chown $(id -u):$(id -g) -R ."
shell: "bash"
- uses: "./.github/actions/clp-core-build-containers"
env:
OS_NAME: "ubuntu-jammy"
with:
image_name: "${{env.DEPS_IMAGE_NAME_PREFIX}}${{env.OS_NAME}}"
docker_context: "components/core"
docker_file: "components/core/tools/docker-images/clp-env-base-${{env.OS_NAME}}\
/Dockerfile"
push_deps_image: >-
${{github.event_name != 'pull_request' && github.ref == 'refs/heads/main'}}
token: "${{secrets.GITHUB_TOKEN}}"
centos-stream-9-binaries:
# Run if the ancestor jobs succeeded OR they were skipped and clp was changed.
if: >-
success()
|| (!cancelled() && !failure() && needs.filter-relevant-changes.outputs.clp_changed == 'true')
needs:
- "centos-stream-9-deps-image"
- "filter-relevant-changes"
strategy:
matrix:
use_shared_libs: [true, false]
name: "centos-stream-9-${{matrix.use_shared_libs == true && 'dynamic' || 'static'}}-linked-bins"
continue-on-error: true
runs-on: "ubuntu-24.04"
steps:
- uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683"
with:
submodules: "recursive"
- name: "Work around actions/runner-images/issues/6775"
run: "chown $(id -u):$(id -g) -R ."
shell: "bash"
- uses: "./.github/actions/run-on-image"
env:
OS_NAME: "centos-stream-9"
with:
image_name: "${{env.DEPS_IMAGE_NAME_PREFIX}}${{env.OS_NAME}}"
use_published_image: >-
${{needs.filter-relevant-changes.outputs.centos_stream_9_image_changed == 'false'
|| (github.event_name != 'pull_request' && github.ref == 'refs/heads/main')}}
run_command: >-
CLP_CPP_MAX_PARALLELISM_PER_BUILD_TASK=$(getconf _NPROCESSORS_ONLN) task deps:core
&& python3 /mnt/repo/components/core/tools/scripts/utils/build-and-run-unit-tests.py
${{matrix.use_shared_libs == true && '--use-shared-libs' || ''}}
--source-dir /mnt/repo/components/core
--build-dir /mnt/repo/components/core/build
--num-jobs $(getconf _NPROCESSORS_ONLN)
manylinux_2_28-x86_64-binaries:
# Run if the ancestor jobs succeeded OR they were skipped and clp was changed.
if: >-
success()
|| (!cancelled() && !failure() && needs.filter-relevant-changes.outputs.clp_changed == 'true')
needs:
- "manylinux_2_28-x86_64-deps-image"
- "filter-relevant-changes"
strategy:
matrix:
use_shared_libs: [true, false]
name: >-
manylinux_2_28-x86_64-${{matrix.use_shared_libs == true && 'dynamic' || 'static'}}-linked-bins
continue-on-error: true
runs-on: "ubuntu-24.04"
steps:
- uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683"
with:
submodules: "recursive"
- name: "Work around actions/runner-images/issues/6775"
run: "chown $(id -u):$(id -g) -R ."
shell: "bash"
- uses: "./.github/actions/run-on-image"
env:
OS_NAME: "manylinux_2_28"
with:
image_name: "${{env.DEPS_IMAGE_NAME_PREFIX}}${{env.OS_NAME}}"
use_published_image: >-
${{needs.filter-relevant-changes.outputs.manylinux_2_28_x86_64_image_changed == 'false'
|| (github.event_name != 'pull_request' && github.ref == 'refs/heads/main')}}
run_command: >-
CLP_CPP_MAX_PARALLELISM_PER_BUILD_TASK=$(getconf _NPROCESSORS_ONLN) task deps:core
&& python3 /mnt/repo/components/core/tools/scripts/utils/build-and-run-unit-tests.py
${{matrix.use_shared_libs == true && '--use-shared-libs' || ''}}
--source-dir /mnt/repo/components/core
--build-dir /mnt/repo/components/core/build
--num-jobs $(getconf _NPROCESSORS_ONLN)
musllinux_1_2-x86_64-binaries:
# Run if the ancestor jobs succeeded OR they were skipped and clp was changed.
if: >-
success()
|| (!cancelled() && !failure() && needs.filter-relevant-changes.outputs.clp_changed == 'true')
needs:
- "musllinux_1_2-x86_64-deps-image"
- "filter-relevant-changes"
strategy:
matrix:
use_shared_libs: [true, false]
name: >-
musllinux_1_2-x86_64-${{matrix.use_shared_libs == true && 'dynamic' || 'static'}}-linked-bins
continue-on-error: true
runs-on: "ubuntu-24.04"
steps:
- uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683"
with:
submodules: "recursive"
- name: "Work around actions/runner-images/issues/6775"
run: "chown $(id -u):$(id -g) -R ."
shell: "bash"
- uses: "./.github/actions/run-on-image"
env:
OS_NAME: "musllinux_1_2"
with:
image_name: "${{env.DEPS_IMAGE_NAME_PREFIX}}${{env.OS_NAME}}"
use_published_image: >-
${{needs.filter-relevant-changes.outputs.musllinux_1_2_x86_64_image_changed == 'false'
|| (github.event_name != 'pull_request' && github.ref == 'refs/heads/main')}}
run_command: >-
CLP_CPP_MAX_PARALLELISM_PER_BUILD_TASK=$(getconf _NPROCESSORS_ONLN) task deps:core
&& python3 /mnt/repo/components/core/tools/scripts/utils/build-and-run-unit-tests.py
${{matrix.use_shared_libs == true && '--use-shared-libs' || ''}}
--source-dir /mnt/repo/components/core
--build-dir /mnt/repo/components/core/build
--num-jobs $(getconf _NPROCESSORS_ONLN)
ubuntu-jammy-binaries:
# Run if the ancestor jobs succeeded OR they were skipped and clp was changed.
if: >-
success()
|| (!cancelled() && !failure() && needs.filter-relevant-changes.outputs.clp_changed == 'true')
needs:
- "filter-relevant-changes"
- "ubuntu-jammy-deps-image"
strategy:
matrix:
include:
- use_shared_libs: true
upload_binaries: false
- use_shared_libs: false
upload_binaries: true
env:
OS_NAME: "ubuntu-jammy"
name: "ubuntu-jammy-${{matrix.use_shared_libs == true && 'dynamic' || 'static'}}-linked-bins"
continue-on-error: true
runs-on: "ubuntu-24.04"
steps:
- uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683"
with:
submodules: "recursive"
- name: "Work around actions/runner-images/issues/6775"
run: "chown $(id -u):$(id -g) -R ."
shell: "bash"
- uses: "./.github/actions/run-on-image"
with:
image_name: "${{env.DEPS_IMAGE_NAME_PREFIX}}${{env.OS_NAME}}"
use_published_image: >-
${{needs.filter-relevant-changes.outputs.ubuntu_jammy_image_changed == 'false'
|| (github.event_name != 'pull_request' && github.ref == 'refs/heads/main')}}
run_command: >-
CLP_CPP_MAX_PARALLELISM_PER_BUILD_TASK=$(getconf _NPROCESSORS_ONLN) task deps:core
&& python3 /mnt/repo/components/core/tools/scripts/utils/build-and-run-unit-tests.py
${{matrix.use_shared_libs == true && '--use-shared-libs' || ''}}
--source-dir /mnt/repo/components/core
--build-dir /mnt/repo/components/core/build
--num-jobs $(getconf _NPROCESSORS_ONLN)
- if: "matrix.upload_binaries == true"
id: "copy_binaries"
run: |-
output_dir="/tmp/${{env.BINARIES_ARTIFACT_NAME_PREFIX}}${{env.OS_NAME}}"
echo "output_dir=${output_dir}" >> "$GITHUB_OUTPUT"
mkdir -p "${output_dir}"
cd "$GITHUB_WORKSPACE/components/core/build"
tar cfvv "${output_dir}/clp.tar" clg clp clp-s glt make-dictionaries-readable
shell: "bash"
- if: "matrix.upload_binaries == true"
uses: "actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02"
with:
name: "${{env.BINARIES_ARTIFACT_NAME_PREFIX}}${{env.OS_NAME}}"
path: "${{steps.copy_binaries.outputs.output_dir}}"
retention-days: 1
ubuntu-jammy-binaries-image:
name: "ubuntu-jammy-binaries-image"
# Run if the ancestor jobs were successful/skipped and building clp was successful.
if: "!cancelled() && !failure() && needs.ubuntu-jammy-binaries.result == 'success'"
needs: "ubuntu-jammy-binaries"
runs-on: "ubuntu-24.04"
env:
OS_NAME: "ubuntu-jammy"
TMP_OUTPUT_DIR: "/tmp"
steps:
- uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683"
with:
submodules: "recursive"
- name: "Work around actions/runner-images/issues/6775"
run: "chown $(id -u):$(id -g) -R ."
shell: "bash"
- uses: "actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e"
with:
name: "${{env.BINARIES_ARTIFACT_NAME_PREFIX}}${{env.OS_NAME}}"
path: "${{env.TMP_OUTPUT_DIR}}/${{env.BINARIES_ARTIFACT_NAME_PREFIX}}${{env.OS_NAME}}"
- name: "Untar binaries"
working-directory: >-
${{env.TMP_OUTPUT_DIR}}/${{env.BINARIES_ARTIFACT_NAME_PREFIX}}${{env.OS_NAME}}
run: |-
tar xf clp.tar
rm clp.tar
- uses: "docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772"
with:
registry: "ghcr.io"
username: "${{github.actor}}"
password: "${{secrets.GITHUB_TOKEN}}"
- name: "Sanitize the repo's name"
id: "sanitize_repo_name"
run: |-
# Docker doesn't support repository names with uppercase characters, so we convert to
# lowercase here.
lowercase_repo=$(echo '${{github.repository}}' | tr '[:upper:]' '[:lower:]')
echo "repository=${lowercase_repo}" >> "$GITHUB_OUTPUT"
shell: "bash"
- id: "core_image_meta"
uses: "docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804"
with:
images: >-
ghcr.io/${{steps.sanitize_repo_name.outputs.repository}}/clp-core-x86-${{env.OS_NAME}}
tags: "type=raw,value=${{github.ref_name}}"
# Only publish the image if this workflow was triggered by a push to `main`.
# NOTE: We run the rest of the job to test that the binaries were uploaded correctly.
- if: "github.event_name == 'push' && github.ref == 'refs/heads/main'"
uses: "docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4"
with:
context: "${{env.TMP_OUTPUT_DIR}}/${{env.BINARIES_ARTIFACT_NAME_PREFIX}}${{env.OS_NAME}}"
file: "components/core/tools/docker-images/clp-core-${{env.OS_NAME}}/Dockerfile"
push: true
tags: "${{steps.core_image_meta.outputs.tags}}"
labels: "${{steps.core_image_meta.outputs.labels}}"
ubuntu-jammy-lint:
name: "ubuntu-jammy-lint"
# Run if the ancestor jobs succeeded OR they were skipped and clp was changed.
if: >-
success()
|| (!cancelled() && !failure() && needs.filter-relevant-changes.outputs.clp_changed == 'true')
needs:
- "filter-relevant-changes"
- "ubuntu-jammy-deps-image"
runs-on: "ubuntu-24.04"
steps:
- uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683"
with:
# Fetch history so that the `clang-tidy-diff` task can compare against the main branch.
fetch-depth: 0
submodules: "recursive"
- name: "Work around actions/runner-images/issues/6775"
run: "chown $(id -u):$(id -g) -R ."
shell: "bash"
# NOTE: We don't use the cache for scheduled runs so that they run lint:check-cpp-static-full
# on all files.
- if: "'schedule' != github.event_name"
name: "Restore lint:check-cpp-static-full cache"
id: "cache-restore-lint-check-cpp-static-full"
uses: "actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684"
with:
path: |
.task/checksum/lint-check-cpp-static-full
.task/checksum/utils-cpp-lint-clang-tidy-*
build/lint-clang-tidy
# NOTE: We use a per-OS cache since different OSes may trigger different clang-tidy
# violations.
key: "main-branch-ubuntu-jammy-lint:check-cpp-static-full"
- uses: "./.github/actions/run-on-image"
env:
OS_NAME: "ubuntu-jammy"
with:
image_name: "${{env.DEPS_IMAGE_NAME_PREFIX}}${{env.OS_NAME}}"
use_published_image: >-
${{needs.filter-relevant-changes.outputs.ubuntu_jammy_image_changed == 'false'
|| (github.event_name != 'pull_request' && github.ref == 'refs/heads/main')}}
# TODO: We set HOME due to permission issues inside the container used in run-on-image.
# See: https://github.com/y-scope/clp/issues/1145
run_command: >-
CLP_CPP_MAX_PARALLELISM_PER_BUILD_TASK=$(getconf _NPROCESSORS_ONLN)
HOME=/tmp
task lint:check-cpp-full
# Cache the source file checksums and the generated files (logs) for the
# lint:check-cpp-static-full task, but only if it runs successfully on the main branch.
# NOTE: If we don't cache the generated files, the task will re-run to generate them.
- if: "'pull_request' != github.event_name && 'refs/heads/main' == github.ref"
name: "Update lint:check-cpp-static-full cache"
uses: "actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684"
with:
path: |
.task/checksum/lint-check-cpp-static-full
.task/checksum/utils-cpp-lint-clang-tidy-*
build/lint-clang-tidy
key: "${{steps.cache-restore-lint-check-cpp-static-full.outputs.cache-primary-key}}"
package-image:
name: "package-image"
if: >-
!cancelled() && !failure() && (
needs.filter-relevant-changes.outputs.ubuntu_jammy_image_changed == 'false' ||
needs.ubuntu-jammy-deps-image.result == 'success'
)
needs:
- "filter-relevant-changes"
- "ubuntu-jammy-deps-image"
runs-on: "ubuntu-24.04"
steps:
- uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683"
with:
submodules: "recursive"
- name: "Workaround actions/runner-images/issues/6775"
shell: "bash"
run: "chown $(id -u):$(id -g) -R ."
- name: "Build the package"
uses: "./.github/actions/run-on-image"
env:
OS_NAME: "ubuntu-jammy"
with:
image_name: "${{env.DEPS_IMAGE_NAME_PREFIX}}${{env.OS_NAME}}"
use_published_image: >-
${{needs.filter-relevant-changes.outputs.ubuntu_jammy_image_changed == 'false'
|| (github.event_name != 'pull_request' && github.ref == 'refs/heads/main')}}
run_command: >-
CLP_CPP_MAX_PARALLELISM_PER_BUILD_TASK=$(getconf _NPROCESSORS_ONLN) task package
- uses: "./.github/actions/clp-build-runtime-image"
with:
image_registry: "ghcr.io"
image_registry_username: "${{github.actor}}"
image_registry_password: "${{secrets.GITHUB_TOKEN}}"