|
| 1 | +name: Integration Tests |
| 2 | + |
| 3 | +# Run integration tests on: |
| 4 | +# - Nightly schedule (comprehensive validation) |
| 5 | +# - Manual trigger (for debugging/pre-merge validation) |
| 6 | +# - Push to main (after PR merge) |
| 7 | +# - Pull requests that modify relevant paths (embedding infrastructure) |
| 8 | +on: |
| 9 | + schedule: |
| 10 | + # Run nightly at 3:00 AM UTC (after main test-and-build at 2:00 AM) |
| 11 | + - cron: "0 3 * * *" |
| 12 | + |
| 13 | + workflow_dispatch: |
| 14 | + inputs: |
| 15 | + test_suite: |
| 16 | + description: 'Integration test suite to run' |
| 17 | + required: false |
| 18 | + default: 'all' |
| 19 | + type: choice |
| 20 | + options: |
| 21 | + - all # All integration tests |
| 22 | + - embedding # Only embedding tests |
| 23 | + - cache # Only cache integration tests (future) |
| 24 | + |
| 25 | + push: |
| 26 | + branches: |
| 27 | + - main |
| 28 | + |
| 29 | + pull_request: |
| 30 | + branches: |
| 31 | + - main |
| 32 | + # Only run if relevant files changed |
| 33 | + paths: |
| 34 | + - 'candle-binding/**' |
| 35 | + - 'src/semantic-router/test/integration/**' |
| 36 | + - 'src/semantic-router/pkg/classification/**' |
| 37 | + - '.github/workflows/integration-tests-embedding.yml' |
| 38 | + |
| 39 | +jobs: |
| 40 | + integration-tests: |
| 41 | + runs-on: ubuntu-latest |
| 42 | + |
| 43 | + steps: |
| 44 | + - name: Check out the repo |
| 45 | + uses: actions/checkout@v4 |
| 46 | + |
| 47 | + - name: Set up Rust |
| 48 | + uses: dtolnay/rust-toolchain@stable |
| 49 | + with: |
| 50 | + toolchain: 1.90 |
| 51 | + |
| 52 | + - name: Set up Go |
| 53 | + uses: actions/setup-go@v5 |
| 54 | + with: |
| 55 | + go-version: "1.24" |
| 56 | + |
| 57 | + - name: Install system dependencies |
| 58 | + run: | |
| 59 | + sudo apt-get update |
| 60 | + sudo apt-get install -y \ |
| 61 | + make \ |
| 62 | + build-essential \ |
| 63 | + pkg-config |
| 64 | +
|
| 65 | + - name: Cache Rust dependencies |
| 66 | + uses: actions/cache@v4 |
| 67 | + with: |
| 68 | + path: | |
| 69 | + ~/.cargo/bin/ |
| 70 | + ~/.cargo/registry/index/ |
| 71 | + ~/.cargo/registry/cache/ |
| 72 | + ~/.cargo/git/db/ |
| 73 | + candle-binding/target/ |
| 74 | + key: ${{ runner.os }}-cargo-integration-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }} |
| 75 | + restore-keys: | |
| 76 | + ${{ runner.os }}-cargo-integration- |
| 77 | + ${{ runner.os }}-cargo- |
| 78 | +
|
| 79 | + - name: Cache Go dependencies |
| 80 | + uses: actions/cache@v4 |
| 81 | + with: |
| 82 | + path: | |
| 83 | + ~/go/pkg/mod |
| 84 | + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} |
| 85 | + restore-keys: | |
| 86 | + ${{ runner.os }}-go- |
| 87 | +
|
| 88 | + - name: Cache Integration Test Models |
| 89 | + uses: actions/cache@v4 |
| 90 | + with: |
| 91 | + path: | |
| 92 | + models/Qwen3-Embedding-0.6B/ |
| 93 | + models/embeddinggemma-300m/ |
| 94 | + models/lora_*_model/ |
| 95 | + key: ${{ runner.os }}-integration-models-${{ hashFiles('tools/make/models.mk') }} |
| 96 | + restore-keys: | |
| 97 | + ${{ runner.os }}-integration-models- |
| 98 | + continue-on-error: true |
| 99 | + |
| 100 | + - name: Build Rust library (CPU-only, no CUDA) |
| 101 | + run: make rust-ci |
| 102 | + |
| 103 | + - name: Build Go router |
| 104 | + run: make build-router |
| 105 | + |
| 106 | + - name: Install HuggingFace CLI |
| 107 | + run: | |
| 108 | + pip install -U "huggingface_hub[cli]" hf_transfer |
| 109 | +
|
| 110 | + - name: Download embedding models |
| 111 | + env: |
| 112 | + HF_HUB_ENABLE_HF_TRANSFER: 1 |
| 113 | + HF_HUB_DISABLE_TELEMETRY: 1 |
| 114 | + HF_TOKEN: ${{ secrets.HF_TOKEN }} |
| 115 | + run: | |
| 116 | + echo "Downloading models for integration tests..." |
| 117 | + make download-models-lora |
| 118 | +
|
| 119 | + - name: Run embedding integration tests |
| 120 | + run: make test-embedding |
| 121 | + env: |
| 122 | + CI: true |
| 123 | + CGO_ENABLED: 1 |
| 124 | + LD_LIBRARY_PATH: ${{ github.workspace }}/candle-binding/target/release |
| 125 | + timeout-minutes: 30 |
| 126 | + |
| 127 | + - name: Run embedding benchmarks (nightly only) |
| 128 | + if: github.event_name == 'schedule' |
| 129 | + run: make bench-embedding |
| 130 | + env: |
| 131 | + CI: true |
| 132 | + CGO_ENABLED: 1 |
| 133 | + LD_LIBRARY_PATH: ${{ github.workspace }}/candle-binding/target/release |
| 134 | + timeout-minutes: 45 |
| 135 | + |
| 136 | + - name: Upload test results on failure |
| 137 | + if: failure() |
| 138 | + uses: actions/upload-artifact@v4 |
| 139 | + with: |
| 140 | + name: integration-test-results |
| 141 | + path: | |
| 142 | + **/*.log |
| 143 | + **/test-output.* |
| 144 | + retention-days: 7 |
| 145 | + |
| 146 | + - name: Notify on failure |
| 147 | + if: failure() && github.event_name == 'schedule' |
| 148 | + run: | |
| 149 | + echo "::error::Integration tests failed on nightly run. Please investigate." |
0 commit comments