Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/pr-path-guard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:

jobs:
ensure-no-translator-changes:
name: ensure-no-translator-changes
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
365 changes: 365 additions & 0 deletions .github/workflows/pr-test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,368 @@ jobs:
steps:
- name: Skip build for migrated router compatibility branch
run: echo "Skipping compile step for migrated router compatibility branch."

go-ci:
name: go-ci
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Run full tests with baseline
run: |
mkdir -p target
go test -json ./... > target/test-baseline.json
go test ./... > target/test-baseline.txt
- name: Upload baseline artifact
uses: actions/upload-artifact@v4
with:
name: go-test-baseline
path: |
target/test-baseline.json
target/test-baseline.txt
if-no-files-found: error

quality-ci:
name: quality-ci
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Install golangci-lint
run: |
if ! command -v golangci-lint >/dev/null 2>&1; then
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.1.6
fi
- name: Install staticcheck
run: |
if ! command -v staticcheck >/dev/null 2>&1; then
go install honnef.co/go/tools/cmd/staticcheck@latest
fi
- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run CI quality gates
env:
QUALITY_DIFF_RANGE: "${{ github.event.pull_request.base.sha }}...${{ github.sha }}"
ENABLE_STATICCHECK: "1"
run: task quality:ci

quality-staged-check:
name: quality-staged-check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Install golangci-lint
run: |
if ! command -v golangci-lint >/dev/null 2>&1; then
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.1.6
fi
- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Check staged/diff files in PR range
env:
QUALITY_DIFF_RANGE: "${{ github.event.pull_request.base.sha }}...${{ github.sha }}"
run: task quality:fmt-staged:check

fmt-check:
name: fmt-check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Verify formatting
run: task quality:fmt:check

golangci-lint:
name: golangci-lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Install golangci-lint
run: |
if ! command -v golangci-lint >/dev/null 2>&1; then
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.1.6
fi
- name: Run golangci-lint
run: |
golangci-lint run ./...

route-lifecycle:
name: route-lifecycle
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Run route lifecycle tests
run: |
go test -run 'TestServer_' ./pkg/llmproxy/api

provider-smoke-matrix:
name: provider-smoke-matrix
if: ${{ vars.CLIPROXY_PROVIDER_SMOKE_CASES != '' }}
runs-on: ubuntu-latest
env:
CLIPROXY_PROVIDER_SMOKE_CASES: ${{ vars.CLIPROXY_PROVIDER_SMOKE_CASES }}
CLIPROXY_SMOKE_EXPECT_SUCCESS: ${{ vars.CLIPROXY_SMOKE_EXPECT_SUCCESS }}
CLIPROXY_SMOKE_WAIT_FOR_READY: "1"
CLIPROXY_BASE_URL: "http://127.0.0.1:8317"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Build cliproxy proxy
run: go build -o cliproxyapi++ ./cmd/server
- name: Run proxy in background
run: |
./cliproxyapi++ --config config.example.yaml > /tmp/cliproxy-smoke.log 2>&1 &
echo $! > /tmp/cliproxy-smoke.pid
sleep 1
env:
CLIPROXY_BASE_URL: "${{ env.CLIPROXY_BASE_URL }}"
- name: Run provider smoke matrix
run: |
./scripts/provider-smoke-matrix.sh
- name: Stop proxy
if: always()
run: |
if [ -f /tmp/cliproxy-smoke.pid ]; then
kill "$(cat /tmp/cliproxy-smoke.pid)" || true
fi
wait || true

provider-smoke-matrix-cheapest:
name: provider-smoke-matrix-cheapest
runs-on: ubuntu-latest
env:
CLIPROXY_SMOKE_EXPECT_SUCCESS: "0"
CLIPROXY_SMOKE_WAIT_FOR_READY: "1"
CLIPROXY_BASE_URL: "http://127.0.0.1:8317"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Build cliproxy proxy
run: go build -o cliproxyapi++ ./cmd/server
- name: Run proxy in background
run: |
./cliproxyapi++ --config config.example.yaml > /tmp/cliproxy-smoke.log 2>&1 &
echo $! > /tmp/cliproxy-smoke.pid
sleep 1
- name: Run provider smoke matrix (cheapest aliases)
run: ./scripts/provider-smoke-matrix-cheapest.sh
- name: Stop proxy
if: always()
run: |
if [ -f /tmp/cliproxy-smoke.pid ]; then
kill "$(cat /tmp/cliproxy-smoke.pid)" || true
fi
wait || true

test-smoke:
name: test-smoke
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run startup and control-plane smoke tests
run: task test:smoke

pre-release-config-compat-smoke:
name: pre-release-config-compat-smoke
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Validate config compatibility path
run: |
task quality:release-lint

distributed-critical-paths:
name: distributed-critical-paths
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Run targeted critical-path checks
run: ./.github/scripts/check-distributed-critical-paths.sh

changelog-scope-classifier:
name: changelog-scope-classifier
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Detect change scopes
run: |
mkdir -p target
if [ "${{ github.base_ref }}" = "" ]; then
base_ref="HEAD~1"
else
base_ref="origin/${{ github.base_ref }}"
fi
if git rev-parse --verify "${base_ref}" >/dev/null 2>&1; then
true
else
git fetch origin "${{ github.base_ref }}" --depth=1 || true
fi
if [ "${{ github.event_name }}" = "pull_request" ]; then
git fetch origin "${{ github.base_ref }}"
changed_files="$(git diff --name-only "${base_ref}...${{ github.sha }}")"
else
changed_files="$(git diff --name-only HEAD~1...HEAD)"
fi

if [ -z "${changed_files}" ]; then
echo "No changed files detected; scope=none"
echo "scope=none" >> "$GITHUB_ENV"
echo "scope=none" > target/changelog-scope.txt
exit 0
fi

scope="none"
if echo "${changed_files}" | grep -qE '(^|/)pkg/(auth|config|runtime|api|usage)/|(^|/)sdk/(access|auth|cliproxy)/'; then
scope="routing"
elif echo "${changed_files}" | grep -qE '(^|/)docs/'; then
scope="docs"
elif echo "${changed_files}" | grep -qE '(^|/)security|policy|oauth|token|auth'; then
scope="security"
fi
echo "Detected changelog scope: ${scope}"
echo "scope=${scope}" >> "$GITHUB_ENV"
echo "scope=${scope}" > target/changelog-scope.txt
- name: Upload changelog scope artifact
uses: actions/upload-artifact@v4
with:
name: changelog-scope
path: target/changelog-scope.txt

docs-build:
name: docs-build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
cache-dependency-path: docs/package.json
- name: Build docs
working-directory: docs
run: |
npm install
npm run docs:build

ci-summary:
name: ci-summary
runs-on: ubuntu-latest
needs:
- quality-ci
- quality-staged-check
- go-ci
- fmt-check
- golangci-lint
- route-lifecycle
- test-smoke
- pre-release-config-compat-smoke
- distributed-critical-paths
- provider-smoke-matrix
- provider-smoke-matrix-cheapest
- changelog-scope-classifier
- docs-build
if: always()
steps:
- name: Summarize PR CI checks
run: |
echo "### cliproxyapi++ PR CI summary" >> "$GITHUB_STEP_SUMMARY"
echo "- quality-ci: ${{ needs.quality-ci.result }}" >> "$GITHUB_STEP_SUMMARY"
echo "- quality-staged-check: ${{ needs.quality-staged-check.result }}" >> "$GITHUB_STEP_SUMMARY"
echo "- go-ci: ${{ needs.go-ci.result }}" >> "$GITHUB_STEP_SUMMARY"
echo "- fmt-check: ${{ needs.fmt-check.result }}" >> "$GITHUB_STEP_SUMMARY"
echo "- golangci-lint: ${{ needs.golangci-lint.result }}" >> "$GITHUB_STEP_SUMMARY"
echo "- route-lifecycle: ${{ needs.route-lifecycle.result }}" >> "$GITHUB_STEP_SUMMARY"
echo "- test-smoke: ${{ needs.test-smoke.result }}" >> "$GITHUB_STEP_SUMMARY"
echo "- pre-release-config-compat-smoke: ${{ needs.pre-release-config-compat-smoke.result }}" >> "$GITHUB_STEP_SUMMARY"
echo "- distributed-critical-paths: ${{ needs.distributed-critical-paths.result }}" >> "$GITHUB_STEP_SUMMARY"
echo "- provider-smoke-matrix: ${{ needs.provider-smoke-matrix.result }}" >> "$GITHUB_STEP_SUMMARY"
echo "- provider-smoke-matrix-cheapest: ${{ needs.provider-smoke-matrix-cheapest.result }}" >> "$GITHUB_STEP_SUMMARY"
echo "- changelog-scope-classifier: ${{ needs.changelog-scope-classifier.result }}" >> "$GITHUB_STEP_SUMMARY"
echo "- docs-build: ${{ needs.docs-build.result }}" >> "$GITHUB_STEP_SUMMARY"
Loading
Loading