Repository navigation
ci: reuse compiler state from cancelled PR runs #13128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -728,13 +728,14 @@ jobs: | |
| needs: | ||
| - changes | ||
| - linux-preflight | ||
| - swift-package-tests | ||
| - macos-compile-admission | ||
| # !cancelled() disables the implicit success() gate, which GitHub evaluates | ||
| # over the transitive needs chain: linux-preflight runs behind routed linux | ||
| # jobs that legitimately skip (web/go/agent-session paths), and that | ||
| # transitive skip otherwise marks every macOS job skipped even when | ||
| # linux-preflight itself succeeds. Require the direct needs explicitly. | ||
| if: ${{ !cancelled() && needs.changes.result == 'success' && needs.linux-preflight.result == 'success' && needs.macos-compile-admission.result == 'success' && needs.changes.outputs.macos == 'true' }} | ||
| if: ${{ !cancelled() && needs.changes.result == 'success' && needs.linux-preflight.result == 'success' && needs.swift-package-tests.result == 'success' && needs.macos-compile-admission.result == 'success' && needs.changes.outputs.macos == 'true' }} | ||
| name: app-host unit tests (${{ matrix.shard }}/6) | ||
| # App-host XCTest needs a runner that can broker testmanagerd control | ||
| # sessions, so route through the shared MACOS_RUNNER_15 var like the other | ||
|
|
@@ -2225,12 +2226,13 @@ jobs: | |
| needs: | ||
| - changes | ||
| - linux-preflight | ||
| - swift-package-tests | ||
| # Spend one macOS slot proving that the app-host test product compiles | ||
| # before starting the six test shards. The shards download this run's | ||
| # build products and run test-without-building, so a compiler failure | ||
| # cannot fan out across every macOS worker and a successful build is not | ||
| # repeated six times. | ||
| if: ${{ !cancelled() && needs.changes.result == 'success' && needs.linux-preflight.result == 'success' && needs.changes.outputs.macos == 'true' }} | ||
| if: ${{ !cancelled() && needs.changes.result == 'success' && needs.linux-preflight.result == 'success' && needs.swift-package-tests.result == 'success' && needs.changes.outputs.macos == 'true' }} | ||
| runs-on: ${{ vars.MACOS_RUNNER_15 || 'blacksmith-6vcpu-macos-15' }} | ||
| timeout-minutes: 75 | ||
| outputs: | ||
|
|
@@ -2308,6 +2310,25 @@ jobs: | |
| set -euo pipefail | ||
| echo "fingerprint=$(scripts/ci/compile-app-host-test-product.sh fingerprint "$CMUX_COMPILE_ADMISSION_DERIVED_DATA")" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Select persistent compilation cache | ||
| id: persistent-compilation-cache | ||
| env: | ||
| BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | ||
| PR_NUMBER: ${{ github.event.pull_request.number || 'push' }} | ||
| COMPILATION_FINGERPRINT: ${{ steps.compilation-cache-key.outputs.fingerprint }} | ||
| run: | | ||
| set -euo pipefail | ||
| # A cancelled run may leave valid Xcode CAS entries behind. Keep the | ||
| # local state scoped to this branch so it cannot cross PR trust | ||
| # boundaries into another contributor's build. | ||
| scope="$(printf 'pr-%s-%s' "$PR_NUMBER" "$BRANCH_NAME" | tr -c 'A-Za-z0-9._-' '-' | cut -c1-120)" | ||
| [ -n "$scope" ] || scope=default | ||
| cas_path="$RUNNER_TOOL_CACHE/cmux-ci-compile-admission/$scope/$COMPILATION_FINGERPRINT" | ||
| mkdir -p "$cas_path" | ||
|
Comment on lines
+2326
to
+2327
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Each PR, branch, and compiler combination creates a retained CAS directory under |
||
| echo "CMUX_COMPILE_ADMISSION_CAS=$cas_path" >> "$GITHUB_ENV" | ||
| echo "path=$cas_path" >> "$GITHUB_OUTPUT" | ||
| echo "Using branch-scoped compilation CAS: $cas_path" | ||
|
|
||
| # Read-only on purpose: nightly.yml `refresh-test-compilation-cache` is the | ||
| # only writer. A cache saved here would be scoped to this pull request and | ||
| # would spend the cache budget that keeps the main seed alive. | ||
|
|
@@ -2328,6 +2349,19 @@ jobs: | |
| "$CMUX_COMPILE_ADMISSION_CAS" \ | ||
| "$RUNNER_TEMP/cmux-compile-admission.txt" | ||
|
|
||
| - name: Report reusable compilation state | ||
| if: ${{ !cancelled() }} | ||
| run: | | ||
| set -euo pipefail | ||
| cas_size="$(du -sh "$CMUX_COMPILE_ADMISSION_CAS" | awk '{print $1}')" | ||
|
Comment on lines
+2353
to
+2356
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| echo "Compilation CAS retained for superseding runs: $cas_size" | ||
| { | ||
| echo "### Reusable compilation state" | ||
| echo | ||
| echo "- Branch-scoped Xcode CAS: \`$cas_size\`" | ||
| echo "- Scope: retained on the self-hosted runner for replacement runs on this branch" | ||
| } >> "$GITHUB_STEP_SUMMARY" | ||
|
|
||
| - name: Package compiled app-host test product | ||
| id: package-products | ||
| run: | | ||
|
|
@@ -2364,13 +2398,14 @@ jobs: | |
| needs: | ||
| - changes | ||
| - linux-preflight | ||
| - swift-package-tests | ||
| - macos-compile-admission | ||
| # !cancelled() disables the implicit success() gate, which GitHub evaluates | ||
| # over the transitive needs chain: linux-preflight runs behind routed linux | ||
| # jobs that legitimately skip (web/go/agent-session paths), and that | ||
| # transitive skip otherwise marks every macOS job skipped even when | ||
| # linux-preflight itself succeeds. Require the direct needs explicitly. | ||
| if: ${{ !cancelled() && needs.changes.result == 'success' && needs.linux-preflight.result == 'success' && needs.macos-compile-admission.result == 'success' && needs.changes.outputs.macos == 'true' }} | ||
| if: ${{ !cancelled() && needs.changes.result == 'success' && needs.linux-preflight.result == 'success' && needs.swift-package-tests.result == 'success' && needs.macos-compile-admission.result == 'success' && needs.changes.outputs.macos == 'true' }} | ||
| # Build the full cmux scheme once, then run the required display/runtime | ||
| # regressions from the same DerivedData instead of queuing a second display | ||
| # runner for UI-only checks. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: manaflow-ai/cmux
Length of output: 50372
🏁 Script executed:
Repository: manaflow-ai/cmux
Length of output: 12390
🏁 Script executed:
Repository: manaflow-ai/cmux
Length of output: 11303
Remove the false persistent-cache setup and report.
$RUNNER_TOOL_CACHEis local to the ephemeral Tart VM, so a replacement run cannot reuse this CAS. The repository does not establish a material delay or cost from that lost reuse. DeleteSelect persistent compilation cacheandReport reusable compilation state; the earlier preparation step already provides a valid$RUNNER_TEMPpath for the read-only restore.🤖 Prompt for AI Agents