|
| 1 | +name: Iris - CoreWeave CI |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [opened, synchronize] |
| 6 | + paths: |
| 7 | + - "lib/iris/**" |
| 8 | + issue_comment: |
| 9 | + types: [created] |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +permissions: |
| 13 | + contents: read |
| 14 | + packages: write |
| 15 | + pull-requests: read # needed for issue_comment to access PR metadata |
| 16 | + statuses: write # post commit status from issue_comment trigger |
| 17 | + |
| 18 | +# Single concurrency group — only one CW CI run at a time across all PRs. |
| 19 | +# The warm cluster is shared; concurrent runs would conflict. |
| 20 | +concurrency: |
| 21 | + group: iris-coreweave-ci |
| 22 | + cancel-in-progress: false |
| 23 | + |
| 24 | +jobs: |
| 25 | + cw-ci-test: |
| 26 | + if: >- |
| 27 | + (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || |
| 28 | + github.event_name == 'workflow_dispatch' || |
| 29 | + ( |
| 30 | + github.event_name == 'issue_comment' && |
| 31 | + github.event.issue.pull_request && |
| 32 | + contains(github.event.comment.body, '/iris-ci-cw') && |
| 33 | + ( |
| 34 | + github.event.comment.author_association == 'MEMBER' || |
| 35 | + github.event.comment.author_association == 'COLLABORATOR' || |
| 36 | + github.event.comment.author_association == 'OWNER' |
| 37 | + ) |
| 38 | + ) |
| 39 | + runs-on: ubuntu-latest |
| 40 | + timeout-minutes: 60 |
| 41 | + env: |
| 42 | + IRIS_NAMESPACE: iris-ci |
| 43 | + # Must match Labels(label_prefix).iris_managed from the cluster config |
| 44 | + IRIS_MANAGED_LABEL: iris-iris-ci-managed |
| 45 | + steps: |
| 46 | + - name: Checkout code |
| 47 | + uses: actions/checkout@v4 |
| 48 | + with: |
| 49 | + ref: ${{ github.event_name == 'issue_comment' && format('refs/pull/{0}/head', github.event.issue.number) || '' }} |
| 50 | + |
| 51 | + - name: Set commit status to pending |
| 52 | + if: github.event_name == 'issue_comment' |
| 53 | + env: |
| 54 | + GH_TOKEN: ${{ github.token }} |
| 55 | + run: | |
| 56 | + sha=$(git rev-parse HEAD) |
| 57 | + gh api repos/${{ github.repository }}/statuses/"$sha" \ |
| 58 | + -f state=pending \ |
| 59 | + -f context="Iris CoreWeave CI" \ |
| 60 | + -f target_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" || true |
| 61 | +
|
| 62 | + - name: Set up Python 3.12 |
| 63 | + uses: actions/setup-python@v5 |
| 64 | + with: |
| 65 | + python-version: "3.12" |
| 66 | + |
| 67 | + - name: Install uv |
| 68 | + uses: astral-sh/setup-uv@v7 |
| 69 | + with: |
| 70 | + enable-cache: true |
| 71 | + cache-dependency-glob: "lib/iris/pyproject.toml" |
| 72 | + |
| 73 | + - name: Write kubeconfig |
| 74 | + run: | |
| 75 | + mkdir -p ~/.kube |
| 76 | + echo "${{ secrets.CW_KUBECONFIG }}" > ~/.kube/coreweave-iris |
| 77 | + chmod 600 ~/.kube/coreweave-iris |
| 78 | +
|
| 79 | + - name: Log in to GitHub Container Registry |
| 80 | + uses: docker/login-action@v3 |
| 81 | + with: |
| 82 | + registry: ghcr.io |
| 83 | + username: ${{ github.actor }} |
| 84 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 85 | + |
| 86 | + - name: Set up Docker Buildx |
| 87 | + uses: docker/setup-buildx-action@v3 |
| 88 | + |
| 89 | + # Delete stale worker pods so the autoscaler recreates them with fresh images. |
| 90 | + # Nodepools (and their underlying nodes) survive — this is the "warm start". |
| 91 | + - name: Reset worker pods |
| 92 | + run: | |
| 93 | + export KUBECONFIG=~/.kube/coreweave-iris |
| 94 | + kubectl delete pods -n "$IRIS_NAMESPACE" -l "$IRIS_MANAGED_LABEL=true" --grace-period=0 --ignore-not-found || true |
| 95 | +
|
| 96 | + # Rebuild images and (re)start the controller. `cluster start` is fully |
| 97 | + # idempotent on K8s: it applies namespace/RBAC/ConfigMap/Deployment/Service |
| 98 | + # and triggers a rollout restart, so both cold starts and warm restarts |
| 99 | + # work without needing to tunnel to an existing controller first. |
| 100 | + - name: Start controller |
| 101 | + env: |
| 102 | + R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }} |
| 103 | + R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }} |
| 104 | + run: | |
| 105 | + cd lib/iris && uv run --group dev iris -v \ |
| 106 | + --config=examples/coreweave-ci.yaml \ |
| 107 | + cluster start |
| 108 | +
|
| 109 | + - name: Run integration tests |
| 110 | + env: |
| 111 | + WANDB_MODE: disabled |
| 112 | + WANDB_API_KEY: "" |
| 113 | + JAX_TRACEBACK_FILTERING: off |
| 114 | + # When set, the marin-on-iris test uploads fixtures and writes |
| 115 | + # intermediate data to S3 (R2) so remote Zephyr pods can access them. |
| 116 | + MARIN_CI_S3_PREFIX: s3://marin-na/temp/ci |
| 117 | + AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }} |
| 118 | + AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }} |
| 119 | + AWS_ENDPOINT_URL: https://74981a43be0de7712369306c7b19133d.r2.cloudflarestorage.com |
| 120 | + FSSPEC_S3: '{"endpoint_url": "https://74981a43be0de7712369306c7b19133d.r2.cloudflarestorage.com"}' |
| 121 | + run: | |
| 122 | + export KUBECONFIG=~/.kube/coreweave-iris |
| 123 | + kubectl port-forward -n "$IRIS_NAMESPACE" svc/iris-ci-controller-svc 10000:10000 & |
| 124 | + PF_PID=$! |
| 125 | + echo "PF_PID=$PF_PID" >> "$GITHUB_ENV" |
| 126 | +
|
| 127 | + IRIS_CONTROLLER_URL="http://localhost:10000" |
| 128 | +
|
| 129 | + # Controller deployment is already confirmed ready by `cluster start`; |
| 130 | + # this just waits for the port-forward to be usable. |
| 131 | + HEALTHY=false |
| 132 | + for i in $(seq 1 60); do |
| 133 | + if ! kill -0 "$PF_PID" 2>/dev/null; then |
| 134 | + echo "port-forward process died unexpectedly" |
| 135 | + exit 1 |
| 136 | + fi |
| 137 | + if curl -sf "$IRIS_CONTROLLER_URL/health" > /dev/null 2>&1; then |
| 138 | + HEALTHY=true |
| 139 | + break |
| 140 | + fi |
| 141 | + sleep 5 |
| 142 | + done |
| 143 | + if [ "$HEALTHY" != "true" ]; then |
| 144 | + echo "Controller did not become healthy within timeout" |
| 145 | + exit 1 |
| 146 | + fi |
| 147 | +
|
| 148 | + uv run pytest tests/integration/iris/ \ |
| 149 | + --controller-url "$IRIS_CONTROLLER_URL" \ |
| 150 | + -v --tb=short --timeout=600 \ |
| 151 | + -o "addopts=" \ |
| 152 | + -x |
| 153 | +
|
| 154 | + - name: Run full integration pipeline |
| 155 | + env: |
| 156 | + WANDB_MODE: disabled |
| 157 | + WANDB_API_KEY: "" |
| 158 | + JAX_TRACEBACK_FILTERING: off |
| 159 | + MARIN_CI_S3_PREFIX: s3://marin-na/temp/ci |
| 160 | + AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }} |
| 161 | + AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }} |
| 162 | + AWS_ENDPOINT_URL: https://74981a43be0de7712369306c7b19133d.r2.cloudflarestorage.com |
| 163 | + FSSPEC_S3: '{"endpoint_url": "https://74981a43be0de7712369306c7b19133d.r2.cloudflarestorage.com"}' |
| 164 | + run: | |
| 165 | + IRIS_CONTROLLER_URL="http://localhost:10000" |
| 166 | + timeout 600 uv run tests/integration/iris/run_iris_full_integration.py \ |
| 167 | + --controller-url "$IRIS_CONTROLLER_URL" |
| 168 | +
|
| 169 | + - name: Stop port-forward |
| 170 | + if: always() |
| 171 | + run: | |
| 172 | + [ -n "$PF_PID" ] && kill "$PF_PID" 2>/dev/null || true |
| 173 | + pkill -f "kubectl port-forward.*$IRIS_NAMESPACE" 2>/dev/null || true |
| 174 | +
|
| 175 | + - name: Capture failure diagnostics |
| 176 | + if: failure() |
| 177 | + run: | |
| 178 | + export KUBECONFIG=~/.kube/coreweave-iris |
| 179 | + echo "=== Controller logs ===" |
| 180 | + kubectl -n "$IRIS_NAMESPACE" logs -l app=iris-controller --tail=500 || true |
| 181 | + echo "=== Controller pod describe ===" |
| 182 | + kubectl -n "$IRIS_NAMESPACE" describe pod -l app=iris-controller || true |
| 183 | + echo "=== Worker pods ===" |
| 184 | + kubectl -n "$IRIS_NAMESPACE" get pods -l "$IRIS_MANAGED_LABEL=true" || true |
| 185 | + echo "=== Warning events ===" |
| 186 | + kubectl -n "$IRIS_NAMESPACE" get events --sort-by='.lastTimestamp' --field-selector type!=Normal || true |
| 187 | +
|
| 188 | + - name: Set commit status to result |
| 189 | + if: always() && github.event_name == 'issue_comment' |
| 190 | + env: |
| 191 | + GH_TOKEN: ${{ github.token }} |
| 192 | + run: | |
| 193 | + sha=$(git rev-parse HEAD) |
| 194 | + if [ "${{ job.status }}" = "success" ]; then |
| 195 | + state=success |
| 196 | + else |
| 197 | + state=failure |
| 198 | + fi |
| 199 | + gh api repos/${{ github.repository }}/statuses/"$sha" \ |
| 200 | + -f state="$state" \ |
| 201 | + -f context="Iris CoreWeave CI" \ |
| 202 | + -f target_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" |
0 commit comments