Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
71 changes: 71 additions & 0 deletions .github/actions/download-test-product/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Download compiled test product
description: Download the exact-run test artifact and report transfer cost.
inputs:
artifact-id:
description: Artifact ID emitted by compile admission.
required: true
path:
description: Destination for the downloaded test archive.
required: true
runs:
using: composite
steps:
- name: Start transfer measurement
id: clock
shell: bash
run: echo "started=$(date +%s)" >> "$GITHUB_OUTPUT"
Comment thread
teamleaderleo marked this conversation as resolved.
Resolved

- name: Download artifact
id: download
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
artifact-ids: ${{ inputs.artifact-id }}
path: ${{ inputs.path }}
merge-multiple: true

- name: Report transfer measurement
if: always()
# Observability must not fail a successful transfer. A failed download
# still fails the composite action and prevents product restoration.
continue-on-error: true
shell: bash
env:
TRANSFER_STARTED: ${{ steps.clock.outputs.started }}
TRANSFER_OUTCOME: ${{ steps.download.outcome }}
TRANSFER_ARTIFACT_ID: ${{ inputs.artifact-id }}
TRANSFER_PATH: ${{ inputs.path }}
run: |
python3 - <<'PY'
import json
import os
from pathlib import Path
import time

elapsed = max(0, round(time.time() - float(os.environ["TRANSFER_STARTED"]), 3))
archive = Path(os.environ["TRANSFER_PATH"]) / "app-host-products.tar.gz"
archive_bytes = archive.stat().st_size if archive.is_file() else None
complete = os.environ["TRANSFER_OUTCOME"] == "success"
record = {
"artifact_id": os.environ["TRANSFER_ARTIFACT_ID"],
"run_id": os.environ.get("GITHUB_RUN_ID"),
"run_attempt": os.environ.get("GITHUB_RUN_ATTEMPT"),
"job": os.environ.get("GITHUB_JOB"),
"shard": os.environ.get("CMUX_APP_HOST_SHARD"),
"runner_name": os.environ.get("RUNNER_NAME"),
"runner_os": os.environ.get("RUNNER_OS"),
"outcome": os.environ["TRANSFER_OUTCOME"],
"elapsed_seconds": elapsed,
"archive_bytes": archive_bytes,
# Includes artifact lookup, download/retries, and outer ZIP extraction.
# This is effective archive throughput, not raw network bandwidth.
"effective_archive_mib_per_second": (
round(archive_bytes / (1024 * 1024) / elapsed, 3)
if complete and archive_bytes is not None and elapsed > 0 else None
),
}
print("CMUX_TEST_PRODUCT_TRANSFER " + json.dumps(record, sort_keys=True))
with open(os.environ["GITHUB_STEP_SUMMARY"], "a") as summary:
summary.write("### Compiled test product transfer\n\n```json\n")
summary.write(json.dumps(record, indent=2, sort_keys=True))
summary.write("\n```\n\nElapsed time includes artifact lookup, transfer/retries, and outer ZIP extraction.\n")
PY
5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -839,11 +839,10 @@ jobs:
echo "CMUX_DERIVED_DATA_PATH=$DERIVED_DATA_PATH" >> "$GITHUB_ENV"

- name: Download compiled app-host test product
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
uses: ./.github/actions/download-test-product
with:
artifact-ids: ${{ needs.macos-compile-admission.outputs.artifact_id }}
artifact-id: ${{ needs.macos-compile-admission.outputs.artifact_id }}
path: ${{ runner.temp }}/app-host-products
merge-multiple: true

- name: Restore compiled app-host test product
env:
Expand Down
Loading