diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..cfd9a42d --- /dev/null +++ b/.editorconfig @@ -0,0 +1,15 @@ +# http://editorconfig.org + +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 2 +max_line_length = 80 +trim_trailing_whitespace = true + +[Makefile] +indent_style = tab diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..130805ef --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +# Auto detect text files and perform LF normalization +* text=auto +* text eol=lf diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 0d23aaba..f04f5526 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -1,292 +1,292 @@ -name: Create and publish Docker images - -on: - workflow_dispatch: - workflow_call: - inputs: - tag_suffix: - description: "Custom tag suffix for the Docker image" - required: false - type: string - default: "" - is_nightly: - description: "Whether this is a nightly build" - required: false - type: boolean - default: false - use_cross_compilation: - description: "Use cross-compilation instead of emulation for ARM64" - required: false - type: boolean - default: true - push: - branches: ["main"] - pull_request: - paths: - - ".github/workflows/docker-publish.yml" - - "Dockerfile*" - - "candle-binding/**" - - "src/**" - - "e2e-tests/llm-katan/**" - -jobs: - # Build job for multi-architecture Docker images - build_multiarch: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - strategy: - matrix: - image: [extproc, llm-katan, dashboard] - # Multi-architecture build strategy: - # - AMD64: Native build on ubuntu-latest (fast) - # - ARM64: Cross-compilation on ubuntu-latest (faster than emulation) - # arch: ${{ github.event_name == 'pull_request' && fromJSON('["amd64"]') || fromJSON('["amd64", "arm64"]') }} - arch: ["amd64", "arm64"] - fail-fast: false - - steps: - - name: Free up disk space - run: | - echo "Before cleanup:" - df -h - sudo rm -rf /usr/share/dotnet - sudo rm -rf /usr/local/lib/android - sudo rm -rf /opt/ghc - sudo rm -rf /opt/hostedtoolcache/CodeQL - sudo docker image prune --all --force - echo "After cleanup:" - df -h - - - name: Check out the repo - uses: actions/checkout@v4 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - with: - driver-opts: | - image=moby/buildkit:latest - network=host - - - name: Set up QEMU for cross-compilation - if: matrix.arch == 'arm64' - uses: docker/setup-qemu-action@v3 - 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 }} - - # Enhanced Rust caching for extproc builds with incremental compilation - - name: Cache Rust dependencies (extproc) - if: matrix.image == 'extproc' - uses: actions/cache@v4 - with: - path: | - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - candle-binding/target/ - ~/.rustup/ - key: ${{ runner.os }}-cargo-${{ matrix.arch }}-${{ hashFiles('candle-binding/Cargo.toml') }}-${{ hashFiles('candle-binding/Cargo.lock') }}-${{ hashFiles('candle-binding/src/**/*.rs') }} - restore-keys: | - ${{ runner.os }}-cargo-${{ matrix.arch }}-${{ hashFiles('candle-binding/Cargo.toml') }}-${{ hashFiles('candle-binding/Cargo.lock') }}- - ${{ runner.os }}-cargo-${{ matrix.arch }}-${{ hashFiles('candle-binding/Cargo.toml') }}- - ${{ runner.os }}-cargo-${{ matrix.arch }}- - ${{ runner.os }}-cargo- - - # Python caching for llm-katan builds - - name: Cache Python dependencies (llm-katan) - if: matrix.image == 'llm-katan' - uses: actions/cache@v4 - with: - path: | - ~/.cache/pip - e2e-tests/llm-katan/.venv - key: ${{ runner.os }}-pip-${{ matrix.arch }}-${{ hashFiles('e2e-tests/llm-katan/requirements.txt', 'e2e-tests/llm-katan/pyproject.toml') }} - restore-keys: | - ${{ runner.os }}-pip-${{ matrix.arch }}- - ${{ runner.os }}-pip- - - # Node.js and Go caching for dashboard builds - - name: Cache Node.js dependencies (dashboard) - if: matrix.image == 'dashboard' - uses: actions/cache@v4 - with: - path: | - ~/.npm - dashboard/frontend/node_modules - key: ${{ runner.os }}-node-${{ matrix.arch }}-${{ hashFiles('dashboard/frontend/package.json', 'dashboard/frontend/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node-${{ matrix.arch }}- - ${{ runner.os }}-node- - - - name: Cache Go dependencies (dashboard) - if: matrix.image == 'dashboard' - uses: actions/cache@v4 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - dashboard/backend/go.sum - key: ${{ runner.os }}-go-${{ matrix.arch }}-${{ hashFiles('dashboard/backend/go.mod', 'dashboard/backend/go.sum') }} - restore-keys: | - ${{ runner.os }}-go-${{ matrix.arch }}- - ${{ runner.os }}-go- - - - 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 build parameters - id: build-params - run: | - # Default to cross-compilation for ARM64 (always enabled for better performance) - USE_CROSS_COMPILATION="${{ inputs.use_cross_compilation || 'true' }}" - - if [ "${{ matrix.image }}" = "extproc" ]; then - echo "context=." >> $GITHUB_OUTPUT - if [ "$USE_CROSS_COMPILATION" = "true" ] && [ "${{ matrix.arch }}" = "arm64" ]; then - echo "dockerfile=./Dockerfile.extproc.cross" >> $GITHUB_OUTPUT - echo "platform=linux/${{ matrix.arch }}" >> $GITHUB_OUTPUT - else - echo "dockerfile=./Dockerfile.extproc" >> $GITHUB_OUTPUT - echo "platform=linux/${{ matrix.arch }}" >> $GITHUB_OUTPUT - fi - elif [ "${{ matrix.image }}" = "llm-katan" ]; then - echo "context=./e2e-tests/llm-katan" >> $GITHUB_OUTPUT - echo "dockerfile=./e2e-tests/llm-katan/Dockerfile" >> $GITHUB_OUTPUT - echo "platform=linux/${{ matrix.arch }}" >> $GITHUB_OUTPUT - elif [ "${{ matrix.image }}" = "dashboard" ]; then - echo "context=." >> $GITHUB_OUTPUT - echo "dockerfile=./dashboard/backend/Dockerfile" >> $GITHUB_OUTPUT - echo "platform=linux/${{ matrix.arch }}" >> $GITHUB_OUTPUT - fi - - - name: Generate tags - id: tags - run: | - REPO_LOWER=$(echo $GITHUB_REPOSITORY_OWNER | tr '[:upper:]' '[:lower:]') - ARCH_SUFFIX="${{ matrix.arch }}" - - if [ "${{ inputs.is_nightly }}" = "true" ]; then - echo "tags=ghcr.io/${REPO_LOWER}/semantic-router/${{ matrix.image }}:nightly-${{ steps.date.outputs.date_tag }}-${ARCH_SUFFIX}" >> $GITHUB_OUTPUT - else - if [ "${{ github.event_name }}" != "pull_request" ]; then - echo "tags=ghcr.io/${REPO_LOWER}/semantic-router/${{ matrix.image }}:${{ github.sha }}-${ARCH_SUFFIX}" >> $GITHUB_OUTPUT - else - echo "tags=ghcr.io/${REPO_LOWER}/semantic-router/${{ matrix.image }}:pr-${{ github.event.number }}-${ARCH_SUFFIX}" >> $GITHUB_OUTPUT - fi - fi - - - name: Additional cleanup for llm-katan (large Python packages) - if: matrix.image == 'llm-katan' - run: | - echo "Freeing up more space for llm-katan build..." - sudo apt-get clean - sudo rm -rf /var/lib/apt/lists/* - df -h - - - name: Build and push ${{ matrix.image }} Docker image - id: build - uses: docker/build-push-action@v5 - with: - context: ${{ steps.build-params.outputs.context }} - file: ${{ steps.build-params.outputs.dockerfile }} - platforms: ${{ steps.build-params.outputs.platform }} - push: ${{ github.event_name != 'pull_request' }} - load: ${{ github.event_name == 'pull_request' }} - tags: ${{ steps.tags.outputs.tags }} - cache-from: type=gha - cache-to: type=gha,mode=max - build-args: | - BUILDKIT_INLINE_CACHE=1 - CARGO_BUILD_JOBS=${{ github.event_name == 'pull_request' && '8' || '16' }} - CARGO_INCREMENTAL=1 - RUSTC_WRAPPER="" - CARGO_NET_GIT_FETCH_WITH_CLI=true - BUILDKIT_PROGRESS=plain - TARGETARCH=${{ matrix.arch }} - # Optimize Rust compilation for ARM64 - CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc - # Enable link-time optimization for release builds - CARGO_PROFILE_RELEASE_LTO=thin - CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 - # Use faster linker - CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS="-C link-arg=-fuse-ld=lld" - CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUSTFLAGS="-C link-arg=-fuse-ld=lld" - - # Create multi-arch manifest for final images - create_manifest: - needs: build_multiarch - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - if: github.event_name != 'pull_request' - strategy: - matrix: - image: [extproc, llm-katan, dashboard] - - steps: - - name: Log in to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Set lowercase repository owner - run: echo "REPOSITORY_OWNER_LOWER=$(echo $GITHUB_REPOSITORY_OWNER | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV - - - 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: Create and push manifest - run: | - REPO_LOWER=$(echo $GITHUB_REPOSITORY_OWNER | tr '[:upper:]' '[:lower:]') - - # Create manifest for the specific image - if [ "${{ inputs.is_nightly }}" = "true" ]; then - TAG="nightly-${{ steps.date.outputs.date_tag }}" - else - if [ "${{ github.event_name }}" != "pull_request" ]; then - TAG="${{ github.sha }}" - else - TAG="pr-${{ github.event.number }}" - fi - fi - - # Create and push manifest by combining architecture-specific images - docker buildx imagetools create \ - --tag ghcr.io/${REPO_LOWER}/semantic-router/${{ matrix.image }}:${TAG} \ - ghcr.io/${REPO_LOWER}/semantic-router/${{ matrix.image }}:${TAG}-amd64 \ - ghcr.io/${REPO_LOWER}/semantic-router/${{ matrix.image }}:${TAG}-arm64 - - # Also tag as latest for non-nightly builds - if [ "${{ inputs.is_nightly }}" != "true" ]; then - docker buildx imagetools create \ - --tag ghcr.io/${REPO_LOWER}/semantic-router/${{ matrix.image }}:latest \ - ghcr.io/${REPO_LOWER}/semantic-router/${{ matrix.image }}:${TAG}-amd64 \ - ghcr.io/${REPO_LOWER}/semantic-router/${{ matrix.image }}:${TAG}-arm64 - fi - - - name: Build summary - if: always() - run: | - if [ "${{ job.status }}" = "success" ]; then - echo "::notice title=Build Success::${{ matrix.image }} multi-arch manifest created successfully" - else - echo "::error title=Build Failed::${{ matrix.image }} build failed" - fi +name: Create and publish Docker images + +on: + workflow_dispatch: + workflow_call: + inputs: + tag_suffix: + description: "Custom tag suffix for the Docker image" + required: false + type: string + default: "" + is_nightly: + description: "Whether this is a nightly build" + required: false + type: boolean + default: false + use_cross_compilation: + description: "Use cross-compilation instead of emulation for ARM64" + required: false + type: boolean + default: true + push: + branches: ["main"] + pull_request: + paths: + - ".github/workflows/docker-publish.yml" + - "Dockerfile*" + - "candle-binding/**" + - "src/**" + - "e2e-tests/llm-katan/**" + +jobs: + # Build job for multi-architecture Docker images + build_multiarch: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + strategy: + matrix: + image: [extproc, llm-katan, dashboard] + # Multi-architecture build strategy: + # - AMD64: Native build on ubuntu-latest (fast) + # - ARM64: Cross-compilation on ubuntu-latest (faster than emulation) + # arch: ${{ github.event_name == 'pull_request' && fromJSON('["amd64"]') || fromJSON('["amd64", "arm64"]') }} + arch: ["amd64", "arm64"] + fail-fast: false + + steps: + - name: Free up disk space + run: | + echo "Before cleanup:" + df -h + sudo rm -rf /usr/share/dotnet + sudo rm -rf /usr/local/lib/android + sudo rm -rf /opt/ghc + sudo rm -rf /opt/hostedtoolcache/CodeQL + sudo docker image prune --all --force + echo "After cleanup:" + df -h + + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + driver-opts: | + image=moby/buildkit:latest + network=host + + - name: Set up QEMU for cross-compilation + if: matrix.arch == 'arm64' + uses: docker/setup-qemu-action@v3 + 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 }} + + # Enhanced Rust caching for extproc builds with incremental compilation + - name: Cache Rust dependencies (extproc) + if: matrix.image == 'extproc' + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + candle-binding/target/ + ~/.rustup/ + key: ${{ runner.os }}-cargo-${{ matrix.arch }}-${{ hashFiles('candle-binding/Cargo.toml') }}-${{ hashFiles('candle-binding/Cargo.lock') }}-${{ hashFiles('candle-binding/src/**/*.rs') }} + restore-keys: | + ${{ runner.os }}-cargo-${{ matrix.arch }}-${{ hashFiles('candle-binding/Cargo.toml') }}-${{ hashFiles('candle-binding/Cargo.lock') }}- + ${{ runner.os }}-cargo-${{ matrix.arch }}-${{ hashFiles('candle-binding/Cargo.toml') }}- + ${{ runner.os }}-cargo-${{ matrix.arch }}- + ${{ runner.os }}-cargo- + + # Python caching for llm-katan builds + - name: Cache Python dependencies (llm-katan) + if: matrix.image == 'llm-katan' + uses: actions/cache@v4 + with: + path: | + ~/.cache/pip + e2e-tests/llm-katan/.venv + key: ${{ runner.os }}-pip-${{ matrix.arch }}-${{ hashFiles('e2e-tests/llm-katan/requirements.txt', 'e2e-tests/llm-katan/pyproject.toml') }} + restore-keys: | + ${{ runner.os }}-pip-${{ matrix.arch }}- + ${{ runner.os }}-pip- + + # Node.js and Go caching for dashboard builds + - name: Cache Node.js dependencies (dashboard) + if: matrix.image == 'dashboard' + uses: actions/cache@v4 + with: + path: | + ~/.npm + dashboard/frontend/node_modules + key: ${{ runner.os }}-node-${{ matrix.arch }}-${{ hashFiles('dashboard/frontend/package.json', 'dashboard/frontend/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node-${{ matrix.arch }}- + ${{ runner.os }}-node- + + - name: Cache Go dependencies (dashboard) + if: matrix.image == 'dashboard' + uses: actions/cache@v4 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + dashboard/backend/go.sum + key: ${{ runner.os }}-go-${{ matrix.arch }}-${{ hashFiles('dashboard/backend/go.mod', 'dashboard/backend/go.sum') }} + restore-keys: | + ${{ runner.os }}-go-${{ matrix.arch }}- + ${{ runner.os }}-go- + + - 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 build parameters + id: build-params + run: | + # Default to cross-compilation for ARM64 (always enabled for better performance) + USE_CROSS_COMPILATION="${{ inputs.use_cross_compilation || 'true' }}" + + if [ "${{ matrix.image }}" = "extproc" ]; then + echo "context=." >> $GITHUB_OUTPUT + if [ "$USE_CROSS_COMPILATION" = "true" ] && [ "${{ matrix.arch }}" = "arm64" ]; then + echo "dockerfile=./Dockerfile.extproc.cross" >> $GITHUB_OUTPUT + echo "platform=linux/${{ matrix.arch }}" >> $GITHUB_OUTPUT + else + echo "dockerfile=./Dockerfile.extproc" >> $GITHUB_OUTPUT + echo "platform=linux/${{ matrix.arch }}" >> $GITHUB_OUTPUT + fi + elif [ "${{ matrix.image }}" = "llm-katan" ]; then + echo "context=./e2e-tests/llm-katan" >> $GITHUB_OUTPUT + echo "dockerfile=./e2e-tests/llm-katan/Dockerfile" >> $GITHUB_OUTPUT + echo "platform=linux/${{ matrix.arch }}" >> $GITHUB_OUTPUT + elif [ "${{ matrix.image }}" = "dashboard" ]; then + echo "context=." >> $GITHUB_OUTPUT + echo "dockerfile=./dashboard/backend/Dockerfile" >> $GITHUB_OUTPUT + echo "platform=linux/${{ matrix.arch }}" >> $GITHUB_OUTPUT + fi + + - name: Generate tags + id: tags + run: | + REPO_LOWER=$(echo $GITHUB_REPOSITORY_OWNER | tr '[:upper:]' '[:lower:]') + ARCH_SUFFIX="${{ matrix.arch }}" + + if [ "${{ inputs.is_nightly }}" = "true" ]; then + echo "tags=ghcr.io/${REPO_LOWER}/semantic-router/${{ matrix.image }}:nightly-${{ steps.date.outputs.date_tag }}-${ARCH_SUFFIX}" >> $GITHUB_OUTPUT + else + if [ "${{ github.event_name }}" != "pull_request" ]; then + echo "tags=ghcr.io/${REPO_LOWER}/semantic-router/${{ matrix.image }}:${{ github.sha }}-${ARCH_SUFFIX}" >> $GITHUB_OUTPUT + else + echo "tags=ghcr.io/${REPO_LOWER}/semantic-router/${{ matrix.image }}:pr-${{ github.event.number }}-${ARCH_SUFFIX}" >> $GITHUB_OUTPUT + fi + fi + + - name: Additional cleanup for llm-katan (large Python packages) + if: matrix.image == 'llm-katan' + run: | + echo "Freeing up more space for llm-katan build..." + sudo apt-get clean + sudo rm -rf /var/lib/apt/lists/* + df -h + + - name: Build and push ${{ matrix.image }} Docker image + id: build + uses: docker/build-push-action@v5 + with: + context: ${{ steps.build-params.outputs.context }} + file: ${{ steps.build-params.outputs.dockerfile }} + platforms: ${{ steps.build-params.outputs.platform }} + push: ${{ github.event_name != 'pull_request' }} + load: ${{ github.event_name == 'pull_request' }} + tags: ${{ steps.tags.outputs.tags }} + cache-from: type=gha + cache-to: type=gha,mode=max + build-args: | + BUILDKIT_INLINE_CACHE=1 + CARGO_BUILD_JOBS=${{ github.event_name == 'pull_request' && '8' || '16' }} + CARGO_INCREMENTAL=1 + RUSTC_WRAPPER="" + CARGO_NET_GIT_FETCH_WITH_CLI=true + BUILDKIT_PROGRESS=plain + TARGETARCH=${{ matrix.arch }} + # Optimize Rust compilation for ARM64 + CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc + # Enable link-time optimization for release builds + CARGO_PROFILE_RELEASE_LTO=thin + CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 + # Use faster linker + CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS="-C link-arg=-fuse-ld=lld" + CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUSTFLAGS="-C link-arg=-fuse-ld=lld" + + # Create multi-arch manifest for final images + create_manifest: + needs: build_multiarch + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + if: github.event_name != 'pull_request' + strategy: + matrix: + image: [extproc, llm-katan, dashboard] + + steps: + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set lowercase repository owner + run: echo "REPOSITORY_OWNER_LOWER=$(echo $GITHUB_REPOSITORY_OWNER | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV + + - 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: Create and push manifest + run: | + REPO_LOWER=$(echo $GITHUB_REPOSITORY_OWNER | tr '[:upper:]' '[:lower:]') + + # Create manifest for the specific image + if [ "${{ inputs.is_nightly }}" = "true" ]; then + TAG="nightly-${{ steps.date.outputs.date_tag }}" + else + if [ "${{ github.event_name }}" != "pull_request" ]; then + TAG="${{ github.sha }}" + else + TAG="pr-${{ github.event.number }}" + fi + fi + + # Create and push manifest by combining architecture-specific images + docker buildx imagetools create \ + --tag ghcr.io/${REPO_LOWER}/semantic-router/${{ matrix.image }}:${TAG} \ + ghcr.io/${REPO_LOWER}/semantic-router/${{ matrix.image }}:${TAG}-amd64 \ + ghcr.io/${REPO_LOWER}/semantic-router/${{ matrix.image }}:${TAG}-arm64 + + # Also tag as latest for non-nightly builds + if [ "${{ inputs.is_nightly }}" != "true" ]; then + docker buildx imagetools create \ + --tag ghcr.io/${REPO_LOWER}/semantic-router/${{ matrix.image }}:latest \ + ghcr.io/${REPO_LOWER}/semantic-router/${{ matrix.image }}:${TAG}-amd64 \ + ghcr.io/${REPO_LOWER}/semantic-router/${{ matrix.image }}:${TAG}-arm64 + fi + + - name: Build summary + if: always() + run: | + if [ "${{ job.status }}" = "success" ]; then + echo "::notice title=Build Success::${{ matrix.image }} multi-arch manifest created successfully" + else + echo "::error title=Build Failed::${{ matrix.image }} build failed" + fi diff --git a/.gitignore b/.gitignore index 01b0f24e..2ef8f447 100644 --- a/.gitignore +++ b/.gitignore @@ -142,4 +142,4 @@ dashboard/backend/dashboard-backend dashboard/backend/dashboard-backend.exe # Keep old HTML backup for reference -dashboard/frontend/index.html.old \ No newline at end of file +dashboard/frontend/index.html.old diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 41c055b4..3c77b021 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -95,6 +95,7 @@ repos: language_version: python3 files: \.py$ exclude: ^(\.venv/|venv/|env/|__pycache__/|\.git/|site/) + # Commented out flake8 - only reports issues, doesn't auto-fix # - repo: https://github.com/PyCQA/flake8 # rev: 7.3.0 diff --git a/config/tools_db.json b/config/tools_db.json index dccbf48a..a543511b 100644 --- a/config/tools_db.json +++ b/config/tools_db.json @@ -139,4 +139,4 @@ "category": "productivity", "tags": ["calendar", "event", "meeting", "appointment", "schedule"] } -] \ No newline at end of file +] diff --git a/dashboard/OWNER b/dashboard/OWNER index 57d5a800..fd20844d 100644 --- a/dashboard/OWNER +++ b/dashboard/OWNER @@ -1,3 +1,3 @@ # Dashboard directory Owners @JaredforReal -@Xunzhuo \ No newline at end of file +@Xunzhuo diff --git a/deploy/docker-compose/addons/llm-router-dashboard.json b/deploy/docker-compose/addons/llm-router-dashboard.json index ff136b6e..2c90bb90 100644 --- a/deploy/docker-compose/addons/llm-router-dashboard.json +++ b/deploy/docker-compose/addons/llm-router-dashboard.json @@ -1235,4 +1235,4 @@ "uid": "llm-router-metrics", "version": 14, "weekStart": "" -} \ No newline at end of file +} diff --git a/deploy/kubernetes/istio/tools_db.json b/deploy/kubernetes/istio/tools_db.json index dccbf48a..a543511b 100644 --- a/deploy/kubernetes/istio/tools_db.json +++ b/deploy/kubernetes/istio/tools_db.json @@ -139,4 +139,4 @@ "category": "productivity", "tags": ["calendar", "event", "meeting", "appointment", "schedule"] } -] \ No newline at end of file +] diff --git a/deploy/kubernetes/tools_db.json b/deploy/kubernetes/tools_db.json index dccbf48a..a543511b 100644 --- a/deploy/kubernetes/tools_db.json +++ b/deploy/kubernetes/tools_db.json @@ -139,4 +139,4 @@ "category": "productivity", "tags": ["calendar", "event", "meeting", "appointment", "schedule"] } -] \ No newline at end of file +] diff --git a/deploy/openshift/Dockerfile.llm-katan b/deploy/openshift/Dockerfile.llm-katan index 0ca53782..47540197 100644 --- a/deploy/openshift/Dockerfile.llm-katan +++ b/deploy/openshift/Dockerfile.llm-katan @@ -42,4 +42,4 @@ HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \ CMD curl -f http://localhost:8000/health || exit 1 # Default command - this will be overridden by deployment args -CMD ["llm-katan", "--help"] \ No newline at end of file +CMD ["llm-katan", "--help"] diff --git a/deploy/openshift/cleanup-openshift.sh b/deploy/openshift/cleanup-openshift.sh index 809fc94c..3ba5a9cb 100755 --- a/deploy/openshift/cleanup-openshift.sh +++ b/deploy/openshift/cleanup-openshift.sh @@ -491,4 +491,4 @@ main() { } # Run main function with all arguments -main "$@" \ No newline at end of file +main "$@" diff --git a/deploy/openshift/config-openshift.yaml b/deploy/openshift/config-openshift.yaml index 9cd98925..7aa88b68 100644 --- a/deploy/openshift/config-openshift.yaml +++ b/deploy/openshift/config-openshift.yaml @@ -205,4 +205,4 @@ observability: resource: service_name: "vllm-semantic-router" service_version: "v0.1.0" - deployment_environment: "development" \ No newline at end of file + deployment_environment: "development" diff --git a/deploy/openshift/demo/demo-classification-results.json b/deploy/openshift/demo/demo-classification-results.json index cf4b27c9..4333e139 100644 --- a/deploy/openshift/demo/demo-classification-results.json +++ b/deploy/openshift/demo/demo-classification-results.json @@ -121,4 +121,4 @@ "successful": 2 } } -} \ No newline at end of file +} diff --git a/deploy/openshift/deploy-to-openshift.sh b/deploy/openshift/deploy-to-openshift.sh index 67705cee..95b46139 100755 --- a/deploy/openshift/deploy-to-openshift.sh +++ b/deploy/openshift/deploy-to-openshift.sh @@ -985,4 +985,4 @@ main() { } # Run main function with all arguments -main "$@" \ No newline at end of file +main "$@" diff --git a/deploy/openshift/deployment.yaml b/deploy/openshift/deployment.yaml index 4c1da75b..f670c0ef 100644 --- a/deploy/openshift/deployment.yaml +++ b/deploy/openshift/deployment.yaml @@ -348,4 +348,4 @@ spec: claimName: semantic-router-models - name: cache-volume persistentVolumeClaim: - claimName: semantic-router-cache \ No newline at end of file + claimName: semantic-router-cache diff --git a/deploy/openshift/envoy-openshift.yaml b/deploy/openshift/envoy-openshift.yaml index 4bfbc1f8..94e6fcb3 100644 --- a/deploy/openshift/envoy-openshift.yaml +++ b/deploy/openshift/envoy-openshift.yaml @@ -149,4 +149,4 @@ admin: address: socket_address: address: "127.0.0.1" - port_value: 19000 \ No newline at end of file + port_value: 19000 diff --git a/deploy/openshift/kustomization.yaml b/deploy/openshift/kustomization.yaml index 686dff69..5c83bf64 100644 --- a/deploy/openshift/kustomization.yaml +++ b/deploy/openshift/kustomization.yaml @@ -33,4 +33,4 @@ commonLabels: # Add OpenShift-specific annotations commonAnnotations: - deployment.openshift.io/type: "vllm-semantic-router" \ No newline at end of file + deployment.openshift.io/type: "vllm-semantic-router" diff --git a/deploy/openshift/openwebui/deploy-openwebui-on-openshift.sh b/deploy/openshift/openwebui/deploy-openwebui-on-openshift.sh index 58c37b96..7e2b22a5 100755 --- a/deploy/openshift/openwebui/deploy-openwebui-on-openshift.sh +++ b/deploy/openshift/openwebui/deploy-openwebui-on-openshift.sh @@ -126,4 +126,4 @@ echo " 1. Open https://$ROUTE_URL in your browser" echo " 2. Complete initial setup in OpenWebUI" echo " 3. The models should be automatically available" echo "" -echo -e "${GREEN}✨ Happy chatting with your models!${NC}" \ No newline at end of file +echo -e "${GREEN}✨ Happy chatting with your models!${NC}" diff --git a/deploy/openshift/openwebui/deployment.yaml b/deploy/openshift/openwebui/deployment.yaml index 56b413e8..08fb286d 100644 --- a/deploy/openshift/openwebui/deployment.yaml +++ b/deploy/openshift/openwebui/deployment.yaml @@ -82,4 +82,4 @@ spec: persistentVolumeClaim: claimName: openwebui-data - name: tmp-volume - emptyDir: {} \ No newline at end of file + emptyDir: {} diff --git a/deploy/openshift/openwebui/kustomization.yaml b/deploy/openshift/openwebui/kustomization.yaml index 29a15993..88685f96 100644 --- a/deploy/openshift/openwebui/kustomization.yaml +++ b/deploy/openshift/openwebui/kustomization.yaml @@ -19,4 +19,4 @@ commonLabels: app.kubernetes.io/part-of: semantic-router # Namespace for all resources -namespace: vllm-semantic-router-system \ No newline at end of file +namespace: vllm-semantic-router-system diff --git a/deploy/openshift/openwebui/pvc.yaml b/deploy/openshift/openwebui/pvc.yaml index 5b76d798..b395b2fb 100644 --- a/deploy/openshift/openwebui/pvc.yaml +++ b/deploy/openshift/openwebui/pvc.yaml @@ -13,4 +13,4 @@ spec: requests: storage: 2Gi # Use default storage class for OpenShift - # storageClassName: "" \ No newline at end of file + # storageClassName: "" diff --git a/deploy/openshift/openwebui/route.yaml b/deploy/openshift/openwebui/route.yaml index c31d6fee..327c057d 100644 --- a/deploy/openshift/openwebui/route.yaml +++ b/deploy/openshift/openwebui/route.yaml @@ -19,4 +19,4 @@ spec: tls: termination: edge insecureEdgeTerminationPolicy: Redirect - wildcardPolicy: None \ No newline at end of file + wildcardPolicy: None diff --git a/deploy/openshift/openwebui/service.yaml b/deploy/openshift/openwebui/service.yaml index e49e891c..a2910214 100644 --- a/deploy/openshift/openwebui/service.yaml +++ b/deploy/openshift/openwebui/service.yaml @@ -14,4 +14,4 @@ spec: protocol: TCP name: http selector: - app: openwebui \ No newline at end of file + app: openwebui diff --git a/deploy/openshift/openwebui/uninstall-openwebui.sh b/deploy/openshift/openwebui/uninstall-openwebui.sh index 50b758ad..2bdfb909 100755 --- a/deploy/openshift/openwebui/uninstall-openwebui.sh +++ b/deploy/openshift/openwebui/uninstall-openwebui.sh @@ -156,4 +156,4 @@ echo "" echo -e "${BLUE}💡 To redeploy OpenWebUI:${NC}" echo " ./deploy-openwebui-on-openshift.sh" echo "" -echo -e "${GREEN}✨ Cleanup completed successfully!${NC}" \ No newline at end of file +echo -e "${GREEN}✨ Cleanup completed successfully!${NC}" diff --git a/deploy/openshift/template.yaml b/deploy/openshift/template.yaml index c7f5212f..c14881e4 100644 --- a/deploy/openshift/template.yaml +++ b/deploy/openshift/template.yaml @@ -358,4 +358,4 @@ parameters: - name: METRICS_HOSTNAME description: "Custom hostname for metrics route (leave empty for auto-generated)" value: "" - required: false \ No newline at end of file + required: false diff --git a/e2e-tests/llm-katan/.gitignore b/e2e-tests/llm-katan/.gitignore index 9d5f6256..5d2bf94f 100644 --- a/e2e-tests/llm-katan/.gitignore +++ b/e2e-tests/llm-katan/.gitignore @@ -17,4 +17,4 @@ __pycache__/ # OS files .DS_Store -Thumbs.db \ No newline at end of file +Thumbs.db diff --git a/e2e-tests/llm-katan/demo-embed.html b/e2e-tests/llm-katan/demo-embed.html index b3633fb5..01e3b5d8 100644 --- a/e2e-tests/llm-katan/demo-embed.html +++ b/e2e-tests/llm-katan/demo-embed.html @@ -58,4 +58,4 @@ .pause(800) .type('# Same tiny model, different API names! 🎯') .go(); - \ No newline at end of file + diff --git a/e2e-tests/llm-katan/pyproject.toml b/e2e-tests/llm-katan/pyproject.toml index f9708ec4..e5d679f1 100644 --- a/e2e-tests/llm-katan/pyproject.toml +++ b/e2e-tests/llm-katan/pyproject.toml @@ -71,4 +71,4 @@ target-version = ['py38', 'py39', 'py310', 'py311', 'py312'] [tool.isort] profile = "black" -line_length = 100 \ No newline at end of file +line_length = 100 diff --git a/e2e-tests/llm-katan/terminal-demo.html b/e2e-tests/llm-katan/terminal-demo.html index 562bf51a..4e9ef991 100644 --- a/e2e-tests/llm-katan/terminal-demo.html +++ b/e2e-tests/llm-katan/terminal-demo.html @@ -240,4 +240,4 @@ }, 8500); // Start after both terminals complete (~8.5 seconds) - \ No newline at end of file + diff --git a/e2e-tests/start-llm-katan.sh b/e2e-tests/start-llm-katan.sh index 05934303..027a47d6 100755 --- a/e2e-tests/start-llm-katan.sh +++ b/e2e-tests/start-llm-katan.sh @@ -136,4 +136,4 @@ start_servers_foreground() { } # Main execution - always run in foreground mode -start_servers_foreground \ No newline at end of file +start_servers_foreground diff --git a/scripts/quickstart.sh b/scripts/quickstart.sh index 546173f6..43b7e745 100755 --- a/scripts/quickstart.sh +++ b/scripts/quickstart.sh @@ -287,4 +287,4 @@ main() { trap 'echo; print_color $RED "❌ Setup interrupted!"; exit 1' INT TERM # Run main function -main "$@" \ No newline at end of file +main "$@" diff --git a/src/OWNER b/src/OWNER index aadb3d08..b953aaef 100644 --- a/src/OWNER +++ b/src/OWNER @@ -1,4 +1,4 @@ # Source code owners @rootfs @Xunzhuo -@wangchen615 \ No newline at end of file +@wangchen615 diff --git a/src/training/training_lora/OWNER b/src/training/training_lora/OWNER index 77eb95c4..9b09f2a9 100644 --- a/src/training/training_lora/OWNER +++ b/src/training/training_lora/OWNER @@ -1,2 +1,2 @@ # lora training owners -@OneZero-Y \ No newline at end of file +@OneZero-Y diff --git a/src/training/training_lora/classifier_model_fine_tuning_lora/go.mod b/src/training/training_lora/classifier_model_fine_tuning_lora/go.mod index 0f41b41d..338e6383 100644 --- a/src/training/training_lora/classifier_model_fine_tuning_lora/go.mod +++ b/src/training/training_lora/classifier_model_fine_tuning_lora/go.mod @@ -4,4 +4,4 @@ go 1.24.1 replace github.com/vllm-project/semantic-router/candle-binding => ../../../../candle-binding -require github.com/vllm-project/semantic-router/candle-binding v0.0.0-00010101000000-000000000000 \ No newline at end of file +require github.com/vllm-project/semantic-router/candle-binding v0.0.0-00010101000000-000000000000 diff --git a/src/training/training_lora/classifier_model_fine_tuning_lora/train_cpu_optimized.sh b/src/training/training_lora/classifier_model_fine_tuning_lora/train_cpu_optimized.sh index 4e1d4402..93692d27 100755 --- a/src/training/training_lora/classifier_model_fine_tuning_lora/train_cpu_optimized.sh +++ b/src/training/training_lora/classifier_model_fine_tuning_lora/train_cpu_optimized.sh @@ -304,4 +304,4 @@ echo "" # Display final summary echo "📊 FINAL CPU TRAINING SUMMARY:" -cat "$SUMMARY_FILE" \ No newline at end of file +cat "$SUMMARY_FILE" diff --git a/src/training/training_lora/pii_model_fine_tuning_lora/go.mod b/src/training/training_lora/pii_model_fine_tuning_lora/go.mod index 76e61471..99bdf152 100644 --- a/src/training/training_lora/pii_model_fine_tuning_lora/go.mod +++ b/src/training/training_lora/pii_model_fine_tuning_lora/go.mod @@ -4,4 +4,4 @@ go 1.24.1 replace github.com/vllm-project/semantic-router/candle-binding => ../../../../candle-binding -require github.com/vllm-project/semantic-router/candle-binding v0.0.0-00010101000000-000000000000 \ No newline at end of file +require github.com/vllm-project/semantic-router/candle-binding v0.0.0-00010101000000-000000000000 diff --git a/src/training/training_lora/pii_model_fine_tuning_lora/train_cpu_optimized.sh b/src/training/training_lora/pii_model_fine_tuning_lora/train_cpu_optimized.sh index 49e46ee2..47b7ecbc 100755 --- a/src/training/training_lora/pii_model_fine_tuning_lora/train_cpu_optimized.sh +++ b/src/training/training_lora/pii_model_fine_tuning_lora/train_cpu_optimized.sh @@ -304,4 +304,4 @@ echo "" # Display final summary echo "📊 FINAL CPU TRAINING SUMMARY:" -cat "$SUMMARY_FILE" \ No newline at end of file +cat "$SUMMARY_FILE" diff --git a/src/training/training_lora/prompt_guard_fine_tuning_lora/go.mod b/src/training/training_lora/prompt_guard_fine_tuning_lora/go.mod index b06a96d7..6195d9f1 100644 --- a/src/training/training_lora/prompt_guard_fine_tuning_lora/go.mod +++ b/src/training/training_lora/prompt_guard_fine_tuning_lora/go.mod @@ -4,4 +4,4 @@ go 1.24.1 replace github.com/vllm-project/semantic-router/candle-binding => ../../../../candle-binding -require github.com/vllm-project/semantic-router/candle-binding v0.0.0-00010101000000-000000000000 \ No newline at end of file +require github.com/vllm-project/semantic-router/candle-binding v0.0.0-00010101000000-000000000000 diff --git a/src/training/training_lora/prompt_guard_fine_tuning_lora/train_cpu_optimized.sh b/src/training/training_lora/prompt_guard_fine_tuning_lora/train_cpu_optimized.sh index 7b717205..f3bad088 100755 --- a/src/training/training_lora/prompt_guard_fine_tuning_lora/train_cpu_optimized.sh +++ b/src/training/training_lora/prompt_guard_fine_tuning_lora/train_cpu_optimized.sh @@ -304,4 +304,4 @@ echo "" # Display final summary echo "📊 FINAL CPU TRAINING SUMMARY:" -cat "$SUMMARY_FILE" \ No newline at end of file +cat "$SUMMARY_FILE" diff --git a/tools/linter/go/.golangci.yml b/tools/linter/go/.golangci.yml index 852ba345..1aa6e9e7 100644 --- a/tools/linter/go/.golangci.yml +++ b/tools/linter/go/.golangci.yml @@ -163,4 +163,4 @@ formatters: paths: - examples$ - zz_generated - \ No newline at end of file + diff --git a/tools/make/milvus.mk b/tools/make/milvus.mk index d435dd22..9113db16 100644 --- a/tools/make/milvus.mk +++ b/tools/make/milvus.mk @@ -86,4 +86,4 @@ stop-milvus-ui: @echo "Stopping Attu (Milvus UI) container..." @$(CONTAINER_RUNTIME) stop milvus-ui || true @$(CONTAINER_RUNTIME) rm milvus-ui || true - @echo "Attu container stopped and removed" \ No newline at end of file + @echo "Attu container stopped and removed" diff --git a/tools/make/openshift.mk b/tools/make/openshift.mk index 7c8498b9..47c0d4a9 100644 --- a/tools/make/openshift.mk +++ b/tools/make/openshift.mk @@ -227,4 +227,4 @@ openshift-help: @echo "$(BLUE)Example usage:$(NC)" @echo " make openshift-deploy-auto OPENSHIFT_SERVER=https://api.cluster.example.com:6443 OPENSHIFT_PASSWORD=mypass" @echo " make openshift-status OPENSHIFT_NAMESPACE=my-namespace" - @echo " make openshift-logs" \ No newline at end of file + @echo " make openshift-logs" diff --git a/tools/observability/llm-router-dashboard.json b/tools/observability/llm-router-dashboard.json index ff136b6e..2c90bb90 100644 --- a/tools/observability/llm-router-dashboard.json +++ b/tools/observability/llm-router-dashboard.json @@ -1235,4 +1235,4 @@ "uid": "llm-router-metrics", "version": 14, "weekStart": "" -} \ No newline at end of file +} diff --git a/website/src/components/ZoomableMermaid/styles.module.css b/website/src/components/ZoomableMermaid/styles.module.css index aeb84e13..1c4055f3 100644 --- a/website/src/components/ZoomableMermaid/styles.module.css +++ b/website/src/components/ZoomableMermaid/styles.module.css @@ -372,4 +372,4 @@ .modalContent { animation: none; } -} \ No newline at end of file +} diff --git a/website/src/pages/community/contributing.tsx b/website/src/pages/community/contributing.tsx index 11b7f551..b856231b 100644 --- a/website/src/pages/community/contributing.tsx +++ b/website/src/pages/community/contributing.tsx @@ -228,6 +228,11 @@ pre-commit install && pre-commit run --all-files`} +
+

📝 EditorConfig Use

+

The project provides an EditorConfig configuration file to standardize the code files of the project. On your development tool, you only need to install the EditorConfig plugin to enable it.

+
+

🏷️ Working Group Areas