Skip to content

Commit d863aa5

Browse files
authored
Merge branch 'main' into bench-dataset
2 parents efe2e77 + 94a9d39 commit d863aa5

File tree

97 files changed

+13740
-932
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+13740
-932
lines changed

.github/workflows/docker-publish.yml

Lines changed: 107 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -14,83 +14,131 @@ on:
1414
required: false
1515
type: boolean
1616
default: false
17+
skip_multiarch:
18+
description: "Skip multi-architecture build for faster CI"
19+
required: false
20+
type: boolean
21+
default: false
1722
push:
1823
branches: [ "main" ]
1924

2025
jobs:
21-
build_and_push_extproc:
26+
# Parallel job for building both images
27+
build_and_push:
2228
runs-on: ubuntu-latest
2329
permissions:
2430
contents: read
2531
packages: write
32+
strategy:
33+
matrix:
34+
image: [extproc, llm-katan]
35+
fail-fast: false # Continue building other images if one fails
2636

2737
steps:
28-
- name: Check out the repo
29-
uses: actions/checkout@v4
38+
- name: Check out the repo
39+
uses: actions/checkout@v4
3040

31-
- name: Log in to GitHub Container Registry
32-
uses: docker/login-action@v3
33-
with:
34-
registry: ghcr.io
35-
username: ${{ github.actor }}
36-
password: ${{ secrets.GITHUB_TOKEN }}
41+
- name: Set up Docker Buildx
42+
uses: docker/setup-buildx-action@v3
3743

38-
- name: Generate date tag for nightly builds
39-
id: date
40-
if: inputs.is_nightly == true
41-
run: echo "date_tag=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
44+
- name: Set up QEMU (only for multi-arch builds)
45+
if: inputs.skip_multiarch != true
46+
uses: docker/setup-qemu-action@v3
47+
with:
48+
platforms: arm64
4249

43-
- name: Set lowercase repository owner
44-
run: echo "REPOSITORY_OWNER_LOWER=$(echo $GITHUB_REPOSITORY_OWNER | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
50+
- name: Log in to GitHub Container Registry
51+
uses: docker/login-action@v3
52+
with:
53+
registry: ghcr.io
54+
username: ${{ github.actor }}
55+
password: ${{ secrets.GITHUB_TOKEN }}
4556

46-
- name: Build and push extproc Docker image
47-
uses: docker/build-push-action@v5
48-
with:
49-
context: .
50-
file: ./Dockerfile.extproc
51-
push: ${{ github.event_name != 'pull_request' }} # Only push on merge to main, not on PRs
52-
tags: |
53-
${{ 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) }}
54-
${{ inputs.is_nightly != true && format('ghcr.io/{0}/semantic-router/extproc:latest', env.REPOSITORY_OWNER_LOWER) || '' }}
57+
- name: Generate date tag for nightly builds
58+
id: date
59+
if: inputs.is_nightly == true
60+
run: echo "date_tag=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
5561

56-
build_and_push_llm_katan:
57-
runs-on: ubuntu-latest
58-
permissions:
59-
contents: read
60-
packages: write
62+
- name: Set lowercase repository owner
63+
run: echo "REPOSITORY_OWNER_LOWER=$(echo $GITHUB_REPOSITORY_OWNER | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
6164

62-
steps:
63-
- name: Check out the repo
64-
uses: actions/checkout@v4
65+
# Rust build cache for extproc - only use GitHub Actions cache for non-PR builds
66+
- name: Cache Rust dependencies (extproc only)
67+
if: matrix.image == 'extproc' && github.event_name != 'pull_request'
68+
uses: actions/cache@v4
69+
with:
70+
path: |
71+
~/.cargo/bin/
72+
~/.cargo/registry/index/
73+
~/.cargo/registry/cache/
74+
~/.cargo/git/db/
75+
candle-binding/target/
76+
key: ${{ runner.os }}-cargo-extproc-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}
77+
restore-keys: |
78+
${{ runner.os }}-cargo-extproc-
6579
66-
- name: Log in to GitHub Container Registry
67-
uses: docker/login-action@v3
68-
with:
69-
registry: ghcr.io
70-
username: ${{ github.actor }}
71-
password: ${{ secrets.GITHUB_TOKEN }}
80+
# Set build context and dockerfile based on matrix
81+
- name: Set build parameters
82+
id: build-params
83+
run: |
84+
if [ "${{ matrix.image }}" = "extproc" ]; then
85+
echo "context=." >> $GITHUB_OUTPUT
86+
echo "dockerfile=./Dockerfile.extproc" >> $GITHUB_OUTPUT
87+
echo "platforms=${{ inputs.skip_multiarch == true && 'linux/amd64' || 'linux/amd64,linux/arm64' }}" >> $GITHUB_OUTPUT
88+
elif [ "${{ matrix.image }}" = "llm-katan" ]; then
89+
echo "context=./e2e-tests/llm-katan" >> $GITHUB_OUTPUT
90+
echo "dockerfile=./e2e-tests/llm-katan/Dockerfile" >> $GITHUB_OUTPUT
91+
echo "platforms=${{ inputs.skip_multiarch == true && 'linux/amd64' || 'linux/amd64,linux/arm64' }}" >> $GITHUB_OUTPUT
92+
fi
7293
73-
- name: Generate date tag for nightly builds
74-
id: date
75-
if: inputs.is_nightly == true
76-
run: echo "date_tag=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
94+
# Extract version for llm-katan
95+
- name: Extract version from pyproject.toml
96+
id: version
97+
if: matrix.image == 'llm-katan'
98+
run: |
99+
VERSION=$(grep '^version = ' e2e-tests/llm-katan/pyproject.toml | sed 's/version = "\(.*\)"/\1/')
100+
echo "version=$VERSION" >> $GITHUB_OUTPUT
77101
78-
- name: Set lowercase repository owner
79-
run: echo "REPOSITORY_OWNER_LOWER=$(echo $GITHUB_REPOSITORY_OWNER | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
102+
# Generate tags for extproc
103+
- name: Generate extproc tags
104+
id: extproc-tags
105+
if: matrix.image == 'extproc'
106+
run: |
107+
REPO_LOWER=$(echo $GITHUB_REPOSITORY_OWNER | tr '[:upper:]' '[:lower:]')
108+
if [ "${{ inputs.is_nightly }}" = "true" ]; then
109+
echo "tags=ghcr.io/${REPO_LOWER}/semantic-router/extproc:nightly-${{ steps.date.outputs.date_tag }}" >> $GITHUB_OUTPUT
110+
else
111+
if [ "${{ github.event_name }}" != "pull_request" ]; then
112+
echo "tags=ghcr.io/${REPO_LOWER}/semantic-router/extproc:${{ github.sha }},ghcr.io/${REPO_LOWER}/semantic-router/extproc:latest" >> $GITHUB_OUTPUT
113+
else
114+
echo "tags=ghcr.io/${REPO_LOWER}/semantic-router/extproc:${{ github.sha }}" >> $GITHUB_OUTPUT
115+
fi
116+
fi
80117
81-
- name: Extract version from pyproject.toml
82-
id: version
83-
run: |
84-
VERSION=$(grep '^version = ' e2e-tests/llm-katan/pyproject.toml | sed 's/version = "\(.*\)"/\1/')
85-
echo "version=$VERSION" >> $GITHUB_OUTPUT
118+
# Generate tags for llm-katan
119+
- name: Generate llm-katan tags
120+
id: llm-katan-tags
121+
if: matrix.image == 'llm-katan'
122+
run: |
123+
REPO_LOWER=$(echo $GITHUB_REPOSITORY_OWNER | tr '[:upper:]' '[:lower:]')
124+
if [ "${{ inputs.is_nightly }}" = "true" ]; then
125+
echo "tags=ghcr.io/${REPO_LOWER}/semantic-router/llm-katan:nightly-${{ steps.date.outputs.date_tag }}" >> $GITHUB_OUTPUT
126+
else
127+
if [ "${{ github.event_name }}" != "pull_request" ]; then
128+
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
129+
else
130+
echo "tags=ghcr.io/${REPO_LOWER}/semantic-router/llm-katan:${{ github.sha }}" >> $GITHUB_OUTPUT
131+
fi
132+
fi
86133
87-
- name: Build and push llm-katan Docker image
88-
uses: docker/build-push-action@v5
89-
with:
90-
context: ./e2e-tests/llm-katan
91-
file: ./e2e-tests/llm-katan/Dockerfile
92-
push: ${{ github.event_name != 'pull_request' }} # Only push on merge to main, not on PRs
93-
tags: |
94-
${{ 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) }}
95-
${{ inputs.is_nightly != true && format('ghcr.io/{0}/semantic-router/llm-katan:latest', env.REPOSITORY_OWNER_LOWER) || '' }}
96-
${{ inputs.is_nightly != true && format('ghcr.io/{0}/semantic-router/llm-katan:v{1}', env.REPOSITORY_OWNER_LOWER, steps.version.outputs.version) || '' }}
134+
- name: Build and push ${{ matrix.image }} Docker image
135+
uses: docker/build-push-action@v5
136+
with:
137+
context: ${{ steps.build-params.outputs.context }}
138+
file: ${{ steps.build-params.outputs.dockerfile }}
139+
platforms: ${{ steps.build-params.outputs.platforms }}
140+
push: ${{ github.event_name != 'pull_request' }}
141+
load: ${{ github.event_name == 'pull_request' }}
142+
tags: ${{ matrix.image == 'extproc' && steps.extproc-tags.outputs.tags || steps.llm-katan-tags.outputs.tags }}
143+
build-args: |
144+
BUILDKIT_INLINE_CACHE=1

.github/workflows/docker-release.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ jobs:
1616
- name: Check out the repo
1717
uses: actions/checkout@v4
1818

19+
- name: Set up Docker Buildx
20+
uses: docker/setup-buildx-action@v3
21+
22+
- name: Set up QEMU
23+
uses: docker/setup-qemu-action@v3
24+
1925
- name: Extract tag name
2026
id: extract_tag
2127
run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
@@ -35,6 +41,7 @@ jobs:
3541
with:
3642
context: .
3743
file: ./Dockerfile.extproc
44+
platforms: linux/amd64,linux/arm64
3845
push: true
3946
tags: |
4047
ghcr.io/${{ env.REPOSITORY_OWNER_LOWER }}/semantic-router/extproc:${{ steps.extract_tag.outputs.tag }}
@@ -50,6 +57,12 @@ jobs:
5057
- name: Check out the repo
5158
uses: actions/checkout@v4
5259

60+
- name: Set up Docker Buildx
61+
uses: docker/setup-buildx-action@v3
62+
63+
- name: Set up QEMU
64+
uses: docker/setup-qemu-action@v3
65+
5366
- name: Extract tag name
5467
id: extract_tag
5568
run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
@@ -75,6 +88,7 @@ jobs:
7588
with:
7689
context: ./e2e-tests/llm-katan
7790
file: ./e2e-tests/llm-katan/Dockerfile
91+
platforms: linux/amd64,linux/arm64
7892
push: true
7993
tags: |
8094
ghcr.io/${{ env.REPOSITORY_OWNER_LOWER }}/semantic-router/llm-katan:${{ steps.extract_tag.outputs.tag }}

0 commit comments

Comments
 (0)