Add runner-inventory and benchmark-own-action workflows#3
Open
AlexanderLanin wants to merge 1 commit into
Open
Add runner-inventory and benchmark-own-action workflows#3AlexanderLanin wants to merge 1 commit into
AlexanderLanin wants to merge 1 commit into
Conversation
Comment on lines
+32
to
+77
| name: Steps | ${{ matrix.image }} | ||
| runs-on: ${{ matrix.image }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| image: [ubuntu-24.04] | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Measure before | ||
| id: before | ||
| uses: ./.github/actions/measure-before | ||
|
|
||
| - name: Run more-disk-space (all steps, debug mode) | ||
| uses: ./ | ||
| with: | ||
| ensure-free: 0 | ||
| min-cleanup: 999 | ||
| debug-steps: 'true' | ||
|
|
||
| - name: Measure after and collect debug output | ||
| shell: bash | ||
| env: | ||
| IMAGE: ${{ matrix.image }} | ||
| BEFORE_ROOT: ${{ steps.before.outputs.root_avail }} | ||
| START_TS: ${{ steps.before.outputs.start_ts }} | ||
| run: | | ||
| set -euo pipefail | ||
| END_TS=$(date +%s%3N) | ||
| DURATION=$((END_TS - START_TS)) | ||
| AFTER_ROOT=$(df --output=avail -B1 / | tail -1) | ||
| FREED=$(( AFTER_ROOT - BEFORE_ROOT )) | ||
| FREED_GIB=$(echo "scale=2; $FREED / 1073741824" | bc) | ||
| echo "Total freed: ${FREED_GIB} GiB in ${DURATION}ms" | ||
|
|
||
| - name: Upload job log (for per-step extraction) | ||
| uses: actions/upload-artifact@v4 | ||
| if: always() | ||
| with: | ||
| name: step-debug-${{ matrix.image }} | ||
| path: | | ||
| /tmp/step-debug.txt | ||
| if-no-files-found: ignore | ||
|
|
||
| measure-android-split: |
Comment on lines
+78
to
+144
| name: Android split | ${{ matrix.image }} | ||
| runs-on: ${{ matrix.image }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| image: [ubuntu-24.04] | ||
| path: | ||
| - name: system-images | ||
| path: /usr/local/lib/android/sdk/system-images | ||
| - name: emulator | ||
| path: /usr/local/lib/android/sdk/emulator | ||
| - name: ndk | ||
| path: /usr/local/lib/android/sdk/ndk | ||
| - name: build-tools | ||
| path: /usr/local/lib/android/sdk/build-tools | ||
| - name: platforms | ||
| path: /usr/local/lib/android/sdk/platforms | ||
| - name: platform-tools | ||
| path: /usr/local/lib/android/sdk/platform-tools | ||
| - name: cmdline-tools | ||
| path: /usr/local/lib/android/sdk/cmdline-tools | ||
| - name: extras | ||
| path: /usr/local/lib/android/sdk/extras | ||
| - name: sdk-root-rest | ||
| path: /usr/local/lib/android | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Measure before | ||
| id: before | ||
| uses: ./.github/actions/measure-before | ||
|
|
||
| - name: Check path existence and size | ||
| id: pathinfo | ||
| shell: bash | ||
| run: | | ||
| PATH_TO_CHECK="${{ matrix.path.path }}" | ||
| if [[ -e "$PATH_TO_CHECK" ]]; then | ||
| SIZE=$(sudo du -sb "$PATH_TO_CHECK" 2>/dev/null | cut -f1 || echo 0) | ||
| echo "exists=true" >> "$GITHUB_OUTPUT" | ||
| echo "size_bytes=$SIZE" >> "$GITHUB_OUTPUT" | ||
| echo "Path exists: $PATH_TO_CHECK ($SIZE bytes)" | ||
| else | ||
| echo "exists=false" >> "$GITHUB_OUTPUT" | ||
| echo "size_bytes=0" >> "$GITHUB_OUTPUT" | ||
| echo "Path does not exist: $PATH_TO_CHECK" | ||
| fi | ||
|
|
||
| - name: Remove path | ||
| if: steps.pathinfo.outputs.exists == 'true' | ||
| shell: bash | ||
| run: | | ||
| sudo rm -rf "${{ matrix.path.path }}" || true | ||
|
|
||
| - name: Measure after | ||
| uses: ./.github/actions/measure-after | ||
| with: | ||
| image: ${{ matrix.image }} | ||
| option: android-split | ||
| intensity: ${{ matrix.path.name }} | ||
| repeat: 1 | ||
| before_root_avail: ${{ steps.before.outputs.root_avail }} | ||
| before_ws_avail: ${{ steps.before.outputs.ws_avail }} | ||
| start_ts: ${{ steps.before.outputs.start_ts }} | ||
|
|
||
| aggregate: |
Comment on lines
+145
to
+182
| name: Aggregate | ||
| runs-on: ubuntu-24.04 | ||
| needs: [measure-steps, measure-android-split] | ||
| if: always() | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Download all metrics | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| path: all-metrics | ||
|
|
||
| - name: Combine and summarize | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
| OUT=combined.csv | ||
| echo "image,option,intensity,repeat,before_root,after_root,freed_root,before_ws,after_ws,freed_ws,duration_ms" > "$OUT" | ||
| find all-metrics -name "metrics.csv" -print0 \ | ||
| | xargs -0 -I{} sh -c 'tail -n +2 "{}"' >> "$OUT" 2>/dev/null || true | ||
| wc -l "$OUT" | ||
|
|
||
| echo "## Android Split Results" >> "$GITHUB_STEP_SUMMARY" | ||
| echo "" >> "$GITHUB_STEP_SUMMARY" | ||
| echo "| Path | Freed (GiB) | Duration |" >> "$GITHUB_STEP_SUMMARY" | ||
| echo "|---|---:|---:|" >> "$GITHUB_STEP_SUMMARY" | ||
| tail -n +2 "$OUT" | while IFS=, read -r image option intensity repeat before_root after_root freed_root rest; do | ||
| freed_gib=$(echo "scale=2; $freed_root / 1073741824" | bc) | ||
| dur_ms=$(echo "$rest" | cut -d, -f5) | ||
| echo "| \`$intensity\` | $freed_gib | ${dur_ms}ms |" >> "$GITHUB_STEP_SUMMARY" | ||
| done | ||
|
|
||
| - name: Upload combined CSV | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: android-split-metrics | ||
| path: combined.csv |
Comment on lines
+25
to
+75
| name: Inventory | ${{ matrix.image }} | ||
| runs-on: ${{ matrix.image }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| image: [ubuntu-24.04] | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Capture disk usage (root, 2 levels) | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
| mkdir -p inventory | ||
|
|
||
| IMAGE="${{ matrix.image }}" | ||
|
|
||
| # Overall disk layout | ||
| df -h > inventory/df.txt | ||
|
|
||
| # du for each top-level dir, sorted by size | ||
| sudo du -sh /usr/share/* /usr/local/* /opt/* /home/runner 2>/dev/null \ | ||
| | sort -rh > inventory/du-top.txt || true | ||
|
|
||
| # du 2-level deep from root (skip proc/sys/dev) | ||
| sudo du -d 2 -h \ | ||
| /usr/share /usr/local /opt /home/runner /var \ | ||
| 2>/dev/null | sort -rh > inventory/du-2level.txt || true | ||
|
|
||
| # List /usr/local/lib/android specifically | ||
| if [[ -d /usr/local/lib/android ]]; then | ||
| sudo du -sh /usr/local/lib/android/sdk/* 2>/dev/null \ | ||
| | sort -rh > inventory/du-android.txt || true | ||
| fi | ||
|
|
||
| # Installed apt packages with sizes | ||
| dpkg-query -Wf '${Installed-Size}\t${Package}\n' \ | ||
| | sort -rn | head -100 > inventory/apt-top100.txt | ||
|
|
||
| # Environment variables (useful for ImageOS etc) | ||
| env | sort > inventory/env.txt | ||
|
|
||
| echo "Done. Files:" | ||
| ls -lh inventory/ | ||
|
|
||
| - name: Upload inventory | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: runner-inventory-${{ matrix.image }} | ||
| path: inventory/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
We need two
workflow_dispatch-only workflows for calibration and measurement, butworkflow_dispatchonly works on the default branch (main). These workflows are already committed ondevbut can't be triggered from there.What
runner-inventory: Captures a filesystem snapshot of the GitHub-hosted runner (du 2-level deep, apt top-100, env vars). Committed result will serve as a long-lived reference for estimating step sizes.
benchmark-own-action: Measures each cleanup step individually using
debug-steps: true, and benchmarks Android SDK sub-paths to determine how to split that step. Intended to run onworkflow_dispatch(and optionally scheduled for repeated calibration).Changes
.github/workflows/runner-inventory.yml— new, captures runner filesystem snapshot.github/workflows/benchmark-own-action.yml— new, per-step and android-path benchmarking