From a317b48aff652b7f29868fff9a7f37077fd7248c Mon Sep 17 00:00:00 2001 From: liuhy Date: Sun, 5 Oct 2025 20:58:06 +0800 Subject: [PATCH 1/7] chore: optimize Docker CI workflow for faster builds and multi-architecture support Signed-off-by: liuhy --- .github/workflows/docker-publish.yml | 158 ++++++++++++++++----------- .github/workflows/fast-build.yml | 105 ++++++++++++++++++ .github/workflows/test-and-build.yml | 16 ++- 3 files changed, 212 insertions(+), 67 deletions(-) create mode 100644 .github/workflows/fast-build.yml diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 62f34846..986162a1 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -14,15 +14,25 @@ on: required: false type: boolean default: false + skip_multiarch: + description: "Skip multi-architecture build for faster CI" + required: false + type: boolean + default: false push: branches: [ "main" ] jobs: - build_and_push_extproc: + # Parallel job for building both images + build_and_push: runs-on: ubuntu-latest permissions: contents: read packages: write + strategy: + matrix: + image: [extproc, llm-katan] + fail-fast: false # Continue building other images if one fails steps: - name: Check out the repo @@ -31,8 +41,11 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 + - name: Set up QEMU (only for multi-arch builds) + if: inputs.skip_multiarch != true + uses: docker/setup-qemu-action@v3 + with: + platforms: arm64 - name: Log in to GitHub Container Registry uses: docker/login-action@v3 @@ -49,62 +62,83 @@ jobs: - name: Set lowercase repository owner run: echo "REPOSITORY_OWNER_LOWER=$(echo $GITHUB_REPOSITORY_OWNER | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV - - name: Build and push extproc Docker image - uses: docker/build-push-action@v5 - with: - context: . - file: ./Dockerfile.extproc - platforms: linux/amd64,linux/arm64 - push: ${{ github.event_name != 'pull_request' }} # Only push on merge to main, not on PRs - tags: | - ${{ inputs.is_nightly == true && format('ghcr.io/{0}/semantic-router/extproc:nightly-{1}', env.REPOSITORY_OWNER_LOWER, steps.date.outputs.date_tag) || format('ghcr.io/{0}/semantic-router/extproc:{1}', env.REPOSITORY_OWNER_LOWER, github.sha) }} - ${{ inputs.is_nightly != true && format('ghcr.io/{0}/semantic-router/extproc:latest', env.REPOSITORY_OWNER_LOWER) || '' }} - - build_and_push_llm_katan: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - - steps: - - name: Check out the repo - uses: actions/checkout@v4 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Log in to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Generate date tag for nightly builds - id: date - if: inputs.is_nightly == true - run: echo "date_tag=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT - - - name: Set lowercase repository owner - run: echo "REPOSITORY_OWNER_LOWER=$(echo $GITHUB_REPOSITORY_OWNER | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV - - - name: Extract version from pyproject.toml - id: version - run: | - VERSION=$(grep '^version = ' e2e-tests/llm-katan/pyproject.toml | sed 's/version = "\(.*\)"/\1/') - echo "version=$VERSION" >> $GITHUB_OUTPUT - - - name: Build and push llm-katan Docker image - uses: docker/build-push-action@v5 - with: - context: ./e2e-tests/llm-katan - file: ./e2e-tests/llm-katan/Dockerfile - platforms: linux/amd64,linux/arm64 - push: ${{ github.event_name != 'pull_request' }} # Only push on merge to main, not on PRs - tags: | - ${{ inputs.is_nightly == true && format('ghcr.io/{0}/semantic-router/llm-katan:nightly-{1}', env.REPOSITORY_OWNER_LOWER, steps.date.outputs.date_tag) || format('ghcr.io/{0}/semantic-router/llm-katan:{1}', env.REPOSITORY_OWNER_LOWER, github.sha) }} - ${{ inputs.is_nightly != true && format('ghcr.io/{0}/semantic-router/llm-katan:latest', env.REPOSITORY_OWNER_LOWER) || '' }} - ${{ inputs.is_nightly != true && format('ghcr.io/{0}/semantic-router/llm-katan:v{1}', env.REPOSITORY_OWNER_LOWER, steps.version.outputs.version) || '' }} + # Rust build cache for extproc - only use GitHub Actions cache for non-PR builds + - name: Cache Rust dependencies (extproc only) + if: matrix.image == 'extproc' && github.event_name != 'pull_request' + uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + candle-binding/target/ + key: ${{ runner.os }}-cargo-extproc-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }} + restore-keys: | + ${{ runner.os }}-cargo-extproc- + + # Set build context and dockerfile based on matrix + - name: Set build parameters + id: build-params + run: | + if [ "${{ matrix.image }}" = "extproc" ]; then + echo "context=." >> $GITHUB_OUTPUT + echo "dockerfile=./Dockerfile.extproc" >> $GITHUB_OUTPUT + echo "platforms=${{ inputs.skip_multiarch == true && 'linux/amd64' || 'linux/amd64,linux/arm64' }}" >> $GITHUB_OUTPUT + elif [ "${{ matrix.image }}" = "llm-katan" ]; then + echo "context=./e2e-tests/llm-katan" >> $GITHUB_OUTPUT + echo "dockerfile=./e2e-tests/llm-katan/Dockerfile" >> $GITHUB_OUTPUT + echo "platforms=${{ inputs.skip_multiarch == true && 'linux/amd64' || 'linux/amd64,linux/arm64' }}" >> $GITHUB_OUTPUT + fi + + # Extract version for llm-katan + - name: Extract version from pyproject.toml + id: version + if: matrix.image == 'llm-katan' + run: | + VERSION=$(grep '^version = ' e2e-tests/llm-katan/pyproject.toml | sed 's/version = "\(.*\)"/\1/') + echo "version=$VERSION" >> $GITHUB_OUTPUT + + # Generate tags for extproc + - name: Generate extproc tags + id: extproc-tags + if: matrix.image == 'extproc' + run: | + REPO_LOWER=$(echo $GITHUB_REPOSITORY_OWNER | tr '[:upper:]' '[:lower:]') + if [ "${{ inputs.is_nightly }}" = "true" ]; then + echo "tags=ghcr.io/${REPO_LOWER}/semantic-router/extproc:nightly-${{ steps.date.outputs.date_tag }}" >> $GITHUB_OUTPUT + else + if [ "${{ github.event_name }}" != "pull_request" ]; then + echo "tags=ghcr.io/${REPO_LOWER}/semantic-router/extproc:${{ github.sha }},ghcr.io/${REPO_LOWER}/semantic-router/extproc:latest" >> $GITHUB_OUTPUT + else + echo "tags=ghcr.io/${REPO_LOWER}/semantic-router/extproc:${{ github.sha }}" >> $GITHUB_OUTPUT + fi + fi + + # Generate tags for llm-katan + - name: Generate llm-katan tags + id: llm-katan-tags + if: matrix.image == 'llm-katan' + run: | + REPO_LOWER=$(echo $GITHUB_REPOSITORY_OWNER | tr '[:upper:]' '[:lower:]') + if [ "${{ inputs.is_nightly }}" = "true" ]; then + echo "tags=ghcr.io/${REPO_LOWER}/semantic-router/llm-katan:nightly-${{ steps.date.outputs.date_tag }}" >> $GITHUB_OUTPUT + else + if [ "${{ github.event_name }}" != "pull_request" ]; then + echo "tags=ghcr.io/${REPO_LOWER}/semantic-router/llm-katan:${{ github.sha }},ghcr.io/${REPO_LOWER}/semantic-router/llm-katan:latest,ghcr.io/${REPO_LOWER}/semantic-router/llm-katan:v${{ steps.version.outputs.version }}" >> $GITHUB_OUTPUT + else + echo "tags=ghcr.io/${REPO_LOWER}/semantic-router/llm-katan:${{ github.sha }}" >> $GITHUB_OUTPUT + fi + fi + + - name: Build and push ${{ matrix.image }} Docker image + uses: docker/build-push-action@v5 + with: + context: ${{ steps.build-params.outputs.context }} + file: ${{ steps.build-params.outputs.dockerfile }} + platforms: ${{ steps.build-params.outputs.platforms }} + push: ${{ github.event_name != 'pull_request' }} + load: ${{ github.event_name == 'pull_request' }} + tags: ${{ matrix.image == 'extproc' && steps.extproc-tags.outputs.tags || steps.llm-katan-tags.outputs.tags }} + build-args: | + BUILDKIT_INLINE_CACHE=1 diff --git a/.github/workflows/fast-build.yml b/.github/workflows/fast-build.yml new file mode 100644 index 00000000..5d629c6d --- /dev/null +++ b/.github/workflows/fast-build.yml @@ -0,0 +1,105 @@ +name: Fast Build (Development) + +on: + workflow_call: # Allow being called by other workflows + workflow_dispatch: + inputs: + image_type: + description: "Which image to build" + required: true + type: choice + options: + - extproc + - llm-katan + - both + default: "extproc" + +jobs: + fast-build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + strategy: + matrix: + image: [extproc] # Default to extproc for fast builds + fail-fast: false + + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + driver-opts: network=host + + - name: Log in to GitHub Container Registry + if: github.event_name == 'workflow_dispatch' + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Cache Rust dependencies for extproc builds + - name: Cache Rust dependencies + if: matrix.image == 'extproc' + uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + candle-binding/target/ + key: ${{ runner.os }}-fast-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-fast-cargo- + + - name: Set build parameters + id: params + run: | + if [ "${{ matrix.image }}" = "extproc" ]; then + echo "context=." >> $GITHUB_OUTPUT + echo "dockerfile=./Dockerfile.extproc" >> $GITHUB_OUTPUT + else + echo "context=./e2e-tests/llm-katan" >> $GITHUB_OUTPUT + echo "dockerfile=./e2e-tests/llm-katan/Dockerfile" >> $GITHUB_OUTPUT + fi + echo "repo_lower=$(echo $GITHUB_REPOSITORY_OWNER | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT + + - name: Build ${{ matrix.image }} (AMD64 only) + uses: docker/build-push-action@v5 + with: + context: ${{ steps.params.outputs.context }} + file: ${{ steps.params.outputs.dockerfile }} + platforms: linux/amd64 + push: false # Don't push for fast builds + load: true # Load to local Docker for testing + tags: | + semantic-router/${{ matrix.image }}:dev + ghcr.io/${{ steps.params.outputs.repo_lower }}/semantic-router/${{ matrix.image }}:dev-${{ github.sha }} + + - name: Test image + run: | + echo "Testing ${{ matrix.image }} image..." + if [ "${{ matrix.image }}" = "extproc" ]; then + # Basic smoke test for extproc + docker run --rm semantic-router/extproc:dev /app/extproc-server --help || echo "Help command test passed" + else + # Basic smoke test for llm-katan + docker run --rm semantic-router/llm-katan:dev python --version + fi + + - name: Push development image (on manual trigger) + if: github.event_name == 'workflow_dispatch' && github.event.inputs.image_type != null + uses: docker/build-push-action@v5 + with: + context: ${{ steps.params.outputs.context }} + file: ${{ steps.params.outputs.dockerfile }} + platforms: linux/amd64 + push: true + tags: | + ghcr.io/${{ steps.params.outputs.repo_lower }}/semantic-router/${{ matrix.image }}:dev-${{ github.sha }} + ghcr.io/${{ steps.params.outputs.repo_lower }}/semantic-router/${{ matrix.image }}:dev-latest diff --git a/.github/workflows/test-and-build.yml b/.github/workflows/test-and-build.yml index dae1721e..f6e4e150 100644 --- a/.github/workflows/test-and-build.yml +++ b/.github/workflows/test-and-build.yml @@ -74,7 +74,6 @@ jobs: run: | pip install -U "huggingface_hub[cli]" hf_transfer - - name: Download models (minimal on PRs) env: CI_MINIMAL_MODELS: ${{ github.event_name == 'pull_request' }} @@ -103,12 +102,19 @@ jobs: run: | echo "::error::Test and build failed. Check the workflow run for details." - # Trigger Docker publishing on successful nightly runs + # Trigger fast build for PRs, full publish for other events + fast-build-pr: + needs: test-and-build + if: success() && github.event_name == 'pull_request' + uses: ./.github/workflows/fast-build.yml + + # Trigger Docker publishing on successful non-PR runs publish-docker: needs: test-and-build - if: success() && github.event_name == 'schedule' + if: success() && github.event_name != 'pull_request' uses: ./.github/workflows/docker-publish.yml with: - tag_suffix: nightly-$(date +'%Y%m%d') - is_nightly: true + tag_suffix: ${{ github.event_name == 'schedule' && format('nightly-{0}', github.run_id) || '' }} + is_nightly: ${{ github.event_name == 'schedule' }} + skip_multiarch: false secrets: inherit From 2afd54f79070aebaed0e9e8930a5083d905599b7 Mon Sep 17 00:00:00 2001 From: liuhy Date: Sun, 5 Oct 2025 21:08:36 +0800 Subject: [PATCH 2/7] chore: optimize Docker CI workflow for faster builds and multi-architecture support Signed-off-by: liuhy --- .github/workflows/docker-publish.yml | 32 ++++++++++++++-------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 986162a1..957b580e 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -35,11 +35,11 @@ jobs: fail-fast: false # Continue building other images if one fails steps: - - name: Check out the repo - uses: actions/checkout@v4 + - name: Check out the repo + uses: actions/checkout@v4 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - name: Set up QEMU (only for multi-arch builds) if: inputs.skip_multiarch != true @@ -47,20 +47,20 @@ jobs: with: platforms: arm64 - - name: Log in to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - - name: Generate date tag for nightly builds - id: date - if: inputs.is_nightly == true - run: echo "date_tag=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT + - name: Generate date tag for nightly builds + id: date + if: inputs.is_nightly == true + run: echo "date_tag=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT - - name: Set lowercase repository owner - run: echo "REPOSITORY_OWNER_LOWER=$(echo $GITHUB_REPOSITORY_OWNER | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV + - name: Set lowercase repository owner + run: echo "REPOSITORY_OWNER_LOWER=$(echo $GITHUB_REPOSITORY_OWNER | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV # Rust build cache for extproc - only use GitHub Actions cache for non-PR builds - name: Cache Rust dependencies (extproc only) From 3cd590179765355a36b8c253926333b70d304d34 Mon Sep 17 00:00:00 2001 From: liuhy Date: Sun, 5 Oct 2025 21:16:21 +0800 Subject: [PATCH 3/7] chore: streamline Docker publishing workflow for scheduled runs Signed-off-by: liuhy --- .github/workflows/test-and-build.yml | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test-and-build.yml b/.github/workflows/test-and-build.yml index f6e4e150..857dd8c5 100644 --- a/.github/workflows/test-and-build.yml +++ b/.github/workflows/test-and-build.yml @@ -102,19 +102,12 @@ jobs: run: | echo "::error::Test and build failed. Check the workflow run for details." - # Trigger fast build for PRs, full publish for other events - fast-build-pr: - needs: test-and-build - if: success() && github.event_name == 'pull_request' - uses: ./.github/workflows/fast-build.yml - - # Trigger Docker publishing on successful non-PR runs + # Trigger Docker publishing on successful nightly runs publish-docker: needs: test-and-build - if: success() && github.event_name != 'pull_request' + if: success() && github.event_name == 'schedule' uses: ./.github/workflows/docker-publish.yml with: - tag_suffix: ${{ github.event_name == 'schedule' && format('nightly-{0}', github.run_id) || '' }} - is_nightly: ${{ github.event_name == 'schedule' }} - skip_multiarch: false + tag_suffix: nightly-$(date +'%Y%m%d') + is_nightly: true secrets: inherit From 1b6216682c8e155b6cc1bafaa5e9d2d105ef9e7b Mon Sep 17 00:00:00 2001 From: liuhy Date: Sun, 5 Oct 2025 21:27:00 +0800 Subject: [PATCH 4/7] chore: streamline Docker publishing workflow for scheduled runs Signed-off-by: liuhy --- .github/workflows/fast-build.yml | 105 ------------------------------- 1 file changed, 105 deletions(-) delete mode 100644 .github/workflows/fast-build.yml diff --git a/.github/workflows/fast-build.yml b/.github/workflows/fast-build.yml deleted file mode 100644 index 5d629c6d..00000000 --- a/.github/workflows/fast-build.yml +++ /dev/null @@ -1,105 +0,0 @@ -name: Fast Build (Development) - -on: - workflow_call: # Allow being called by other workflows - workflow_dispatch: - inputs: - image_type: - description: "Which image to build" - required: true - type: choice - options: - - extproc - - llm-katan - - both - default: "extproc" - -jobs: - fast-build: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - strategy: - matrix: - image: [extproc] # Default to extproc for fast builds - fail-fast: false - - steps: - - name: Check out the repo - uses: actions/checkout@v4 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - with: - driver-opts: network=host - - - name: Log in to GitHub Container Registry - if: github.event_name == 'workflow_dispatch' - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - # Cache Rust dependencies for extproc builds - - name: Cache Rust dependencies - if: matrix.image == 'extproc' - uses: actions/cache@v4 - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - candle-binding/target/ - key: ${{ runner.os }}-fast-cargo-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-fast-cargo- - - - name: Set build parameters - id: params - run: | - if [ "${{ matrix.image }}" = "extproc" ]; then - echo "context=." >> $GITHUB_OUTPUT - echo "dockerfile=./Dockerfile.extproc" >> $GITHUB_OUTPUT - else - echo "context=./e2e-tests/llm-katan" >> $GITHUB_OUTPUT - echo "dockerfile=./e2e-tests/llm-katan/Dockerfile" >> $GITHUB_OUTPUT - fi - echo "repo_lower=$(echo $GITHUB_REPOSITORY_OWNER | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT - - - name: Build ${{ matrix.image }} (AMD64 only) - uses: docker/build-push-action@v5 - with: - context: ${{ steps.params.outputs.context }} - file: ${{ steps.params.outputs.dockerfile }} - platforms: linux/amd64 - push: false # Don't push for fast builds - load: true # Load to local Docker for testing - tags: | - semantic-router/${{ matrix.image }}:dev - ghcr.io/${{ steps.params.outputs.repo_lower }}/semantic-router/${{ matrix.image }}:dev-${{ github.sha }} - - - name: Test image - run: | - echo "Testing ${{ matrix.image }} image..." - if [ "${{ matrix.image }}" = "extproc" ]; then - # Basic smoke test for extproc - docker run --rm semantic-router/extproc:dev /app/extproc-server --help || echo "Help command test passed" - else - # Basic smoke test for llm-katan - docker run --rm semantic-router/llm-katan:dev python --version - fi - - - name: Push development image (on manual trigger) - if: github.event_name == 'workflow_dispatch' && github.event.inputs.image_type != null - uses: docker/build-push-action@v5 - with: - context: ${{ steps.params.outputs.context }} - file: ${{ steps.params.outputs.dockerfile }} - platforms: linux/amd64 - push: true - tags: | - ghcr.io/${{ steps.params.outputs.repo_lower }}/semantic-router/${{ matrix.image }}:dev-${{ github.sha }} - ghcr.io/${{ steps.params.outputs.repo_lower }}/semantic-router/${{ matrix.image }}:dev-latest From 727e6dd5338e972bf5668b9f76d3009629efaa55 Mon Sep 17 00:00:00 2001 From: liuhy Date: Sun, 5 Oct 2025 21:37:25 +0800 Subject: [PATCH 5/7] chore: simplify Rust build cache logic in Docker publish workflow Signed-off-by: liuhy --- .github/workflows/docker-publish.yml | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 957b580e..4656c8ed 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -62,9 +62,9 @@ jobs: - name: Set lowercase repository owner run: echo "REPOSITORY_OWNER_LOWER=$(echo $GITHUB_REPOSITORY_OWNER | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV - # Rust build cache for extproc - only use GitHub Actions cache for non-PR builds + # Rust build cache for extproc - name: Cache Rust dependencies (extproc only) - if: matrix.image == 'extproc' && github.event_name != 'pull_request' + if: matrix.image == 'extproc' uses: actions/cache@v4 with: path: | @@ -108,11 +108,7 @@ jobs: if [ "${{ inputs.is_nightly }}" = "true" ]; then echo "tags=ghcr.io/${REPO_LOWER}/semantic-router/extproc:nightly-${{ steps.date.outputs.date_tag }}" >> $GITHUB_OUTPUT else - if [ "${{ github.event_name }}" != "pull_request" ]; then - echo "tags=ghcr.io/${REPO_LOWER}/semantic-router/extproc:${{ github.sha }},ghcr.io/${REPO_LOWER}/semantic-router/extproc:latest" >> $GITHUB_OUTPUT - else - echo "tags=ghcr.io/${REPO_LOWER}/semantic-router/extproc:${{ github.sha }}" >> $GITHUB_OUTPUT - fi + echo "tags=ghcr.io/${REPO_LOWER}/semantic-router/extproc:${{ github.sha }},ghcr.io/${REPO_LOWER}/semantic-router/extproc:latest" >> $GITHUB_OUTPUT fi # Generate tags for llm-katan @@ -124,11 +120,7 @@ jobs: if [ "${{ inputs.is_nightly }}" = "true" ]; then echo "tags=ghcr.io/${REPO_LOWER}/semantic-router/llm-katan:nightly-${{ steps.date.outputs.date_tag }}" >> $GITHUB_OUTPUT else - if [ "${{ github.event_name }}" != "pull_request" ]; then - echo "tags=ghcr.io/${REPO_LOWER}/semantic-router/llm-katan:${{ github.sha }},ghcr.io/${REPO_LOWER}/semantic-router/llm-katan:latest,ghcr.io/${REPO_LOWER}/semantic-router/llm-katan:v${{ steps.version.outputs.version }}" >> $GITHUB_OUTPUT - else - echo "tags=ghcr.io/${REPO_LOWER}/semantic-router/llm-katan:${{ github.sha }}" >> $GITHUB_OUTPUT - fi + echo "tags=ghcr.io/${REPO_LOWER}/semantic-router/llm-katan:${{ github.sha }},ghcr.io/${REPO_LOWER}/semantic-router/llm-katan:latest,ghcr.io/${REPO_LOWER}/semantic-router/llm-katan:v${{ steps.version.outputs.version }}" >> $GITHUB_OUTPUT fi - name: Build and push ${{ matrix.image }} Docker image From e0be4a85ce8b0847b2d02545c6e2c77b5d94e98a Mon Sep 17 00:00:00 2001 From: liuhy Date: Sun, 5 Oct 2025 21:47:59 +0800 Subject: [PATCH 6/7] chore: simplify Rust build cache logic in Docker publish workflow Signed-off-by: liuhy --- .github/workflows/docker-publish.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 4656c8ed..957b580e 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -62,9 +62,9 @@ jobs: - name: Set lowercase repository owner run: echo "REPOSITORY_OWNER_LOWER=$(echo $GITHUB_REPOSITORY_OWNER | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV - # Rust build cache for extproc + # Rust build cache for extproc - only use GitHub Actions cache for non-PR builds - name: Cache Rust dependencies (extproc only) - if: matrix.image == 'extproc' + if: matrix.image == 'extproc' && github.event_name != 'pull_request' uses: actions/cache@v4 with: path: | @@ -108,7 +108,11 @@ jobs: if [ "${{ inputs.is_nightly }}" = "true" ]; then echo "tags=ghcr.io/${REPO_LOWER}/semantic-router/extproc:nightly-${{ steps.date.outputs.date_tag }}" >> $GITHUB_OUTPUT else - echo "tags=ghcr.io/${REPO_LOWER}/semantic-router/extproc:${{ github.sha }},ghcr.io/${REPO_LOWER}/semantic-router/extproc:latest" >> $GITHUB_OUTPUT + if [ "${{ github.event_name }}" != "pull_request" ]; then + echo "tags=ghcr.io/${REPO_LOWER}/semantic-router/extproc:${{ github.sha }},ghcr.io/${REPO_LOWER}/semantic-router/extproc:latest" >> $GITHUB_OUTPUT + else + echo "tags=ghcr.io/${REPO_LOWER}/semantic-router/extproc:${{ github.sha }}" >> $GITHUB_OUTPUT + fi fi # Generate tags for llm-katan @@ -120,7 +124,11 @@ jobs: if [ "${{ inputs.is_nightly }}" = "true" ]; then echo "tags=ghcr.io/${REPO_LOWER}/semantic-router/llm-katan:nightly-${{ steps.date.outputs.date_tag }}" >> $GITHUB_OUTPUT else - echo "tags=ghcr.io/${REPO_LOWER}/semantic-router/llm-katan:${{ github.sha }},ghcr.io/${REPO_LOWER}/semantic-router/llm-katan:latest,ghcr.io/${REPO_LOWER}/semantic-router/llm-katan:v${{ steps.version.outputs.version }}" >> $GITHUB_OUTPUT + if [ "${{ github.event_name }}" != "pull_request" ]; then + echo "tags=ghcr.io/${REPO_LOWER}/semantic-router/llm-katan:${{ github.sha }},ghcr.io/${REPO_LOWER}/semantic-router/llm-katan:latest,ghcr.io/${REPO_LOWER}/semantic-router/llm-katan:v${{ steps.version.outputs.version }}" >> $GITHUB_OUTPUT + else + echo "tags=ghcr.io/${REPO_LOWER}/semantic-router/llm-katan:${{ github.sha }}" >> $GITHUB_OUTPUT + fi fi - name: Build and push ${{ matrix.image }} Docker image From 329b8a9004af06e1cb9f391e48d6d95169e83b05 Mon Sep 17 00:00:00 2001 From: liuhy Date: Sun, 5 Oct 2025 21:53:38 +0800 Subject: [PATCH 7/7] chore: simplify Rust build cache logic in Docker publish workflow Signed-off-by: liuhy --- .github/workflows/test-and-build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-and-build.yml b/.github/workflows/test-and-build.yml index 857dd8c5..dae1721e 100644 --- a/.github/workflows/test-and-build.yml +++ b/.github/workflows/test-and-build.yml @@ -74,6 +74,7 @@ jobs: run: | pip install -U "huggingface_hub[cli]" hf_transfer + - name: Download models (minimal on PRs) env: CI_MINIMAL_MODELS: ${{ github.event_name == 'pull_request' }}