|
| 1 | +name: CI - Coordinator Test |
| 2 | + |
| 3 | +# Runs coordinator unit tests and e2e tests. Path filter excludes the |
| 4 | +# sidecar-only paths so this workflow only triggers for coordinator changes. |
| 5 | +on: |
| 6 | + push: |
| 7 | + branches: |
| 8 | + - main |
| 9 | + - 'release-*' |
| 10 | + pull_request: |
| 11 | + branches: |
| 12 | + - main |
| 13 | + |
| 14 | +permissions: |
| 15 | + contents: read |
| 16 | + actions: read |
| 17 | + |
| 18 | +concurrency: |
| 19 | + group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }} |
| 20 | + cancel-in-progress: true |
| 21 | + |
| 22 | +jobs: |
| 23 | + check-changes: |
| 24 | + runs-on: ubuntu-latest |
| 25 | + outputs: |
| 26 | + src: ${{ steps.filter.outputs.src }} |
| 27 | + steps: |
| 28 | + - name: Checkout source |
| 29 | + uses: actions/checkout@v7 |
| 30 | + - uses: dorny/paths-filter@v4 |
| 31 | + id: filter |
| 32 | + with: |
| 33 | + filters: | |
| 34 | + src: |
| 35 | + - '**/*.go' |
| 36 | + - Dockerfile.* |
| 37 | + - Makefile* |
| 38 | + - go.mod |
| 39 | + - go.sum |
| 40 | + - scripts/** |
| 41 | + - hack/** |
| 42 | + - test/** |
| 43 | + - .github/actions/docker-build-and-push/action.yml |
| 44 | + - .github/actions/e2e-runner-setup/action.yml |
| 45 | + - .github/workflows/ci-coordinator.yaml |
| 46 | + - '!Dockerfile.sidecar' |
| 47 | + - '!cmd/pd-sidecar/**' |
| 48 | + - '!pkg/sidecar/**' |
| 49 | + - '!test/sidecar/**' |
| 50 | +
|
| 51 | + unit-tests: |
| 52 | + needs: check-changes |
| 53 | + if: ${{ needs.check-changes.outputs.src == 'true' }} |
| 54 | + runs-on: ubuntu-latest |
| 55 | + timeout-minutes: 30 |
| 56 | + steps: |
| 57 | + - name: Checkout source |
| 58 | + uses: actions/checkout@v7 |
| 59 | + |
| 60 | + - name: Create Go cache dirs |
| 61 | + id: go-cache |
| 62 | + run: | |
| 63 | + mkdir -p "$HOME/.cache/llm-d-gomodcache" "$HOME/.cache/llm-d-gobuildcache" |
| 64 | + echo "mod=$HOME/.cache/llm-d-gomodcache" >> "$GITHUB_OUTPUT" |
| 65 | + echo "build=$HOME/.cache/llm-d-gobuildcache" >> "$GITHUB_OUTPUT" |
| 66 | +
|
| 67 | + - name: Cache Go modules and build cache |
| 68 | + uses: actions/cache@v6 |
| 69 | + with: |
| 70 | + path: | |
| 71 | + ${{ steps.go-cache.outputs.mod }} |
| 72 | + ${{ steps.go-cache.outputs.build }} |
| 73 | + key: go-cache-${{ runner.os }}-${{ hashFiles('go.sum') }} |
| 74 | + restore-keys: | |
| 75 | + go-cache-${{ runner.os }}- |
| 76 | +
|
| 77 | + - name: Run coordinator unit tests |
| 78 | + shell: bash |
| 79 | + env: |
| 80 | + GO_MOD_CACHE_VOL: ${{ steps.go-cache.outputs.mod }} |
| 81 | + GO_BUILD_CACHE_VOL: ${{ steps.go-cache.outputs.build }} |
| 82 | + run: make -f Makefile.coord.mk test-unit |
| 83 | + |
| 84 | + e2e-tests: |
| 85 | + needs: check-changes |
| 86 | + if: ${{ needs.check-changes.outputs.src == 'true' }} |
| 87 | + runs-on: ubuntu-latest |
| 88 | + timeout-minutes: 60 |
| 89 | + steps: |
| 90 | + - name: Checkout source |
| 91 | + uses: actions/checkout@v7 |
| 92 | + |
| 93 | + - name: Set up e2e runner |
| 94 | + id: e2e-setup |
| 95 | + uses: ./.github/actions/e2e-runner-setup |
| 96 | + |
| 97 | + - name: Run coordinator e2e tests |
| 98 | + shell: bash |
| 99 | + env: |
| 100 | + GO_MOD_CACHE_VOL: ${{ steps.e2e-setup.outputs.go-mod-cache }} |
| 101 | + GO_BUILD_CACHE_VOL: ${{ steps.e2e-setup.outputs.go-build-cache }} |
| 102 | + run: make -f Makefile.coord.mk test-e2e-coordinator |
0 commit comments