| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- name: LTS Download Speed Test
- on:
- workflow_dispatch:
- permissions:
- contents: read
- actions: read
- jobs:
- benchmark-download:
- runs-on: ubuntu-latest
- timeout-minutes: 180
- strategy:
- fail-fast: false
- max-parallel: 7
- matrix:
- branch:
- - android12-5.10-lts
- - android13-5.10-lts
- - android13-5.15-lts
- - android14-5.15-lts
- - android14-6.1-lts
- - android15-6.6-lts
- - android16-6.12-lts
- name: ${{ matrix.branch }} / minimal-shallow
- steps:
- - name: Install repo tool
- shell: bash
- run: |
- set -euo pipefail
- mkdir -p "$HOME/.local/bin"
- curl -fsSL https://storage.googleapis.com/git-repo-downloads/repo -o "$HOME/.local/bin/repo"
- chmod +x "$HOME/.local/bin/repo"
- echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- - name: Benchmark repo sync
- shell: bash
- run: |
- set -euo pipefail
- workdir="$RUNNER_TEMP/kernel-speed-test/${{ matrix.branch }}/minimal-shallow"
- mkdir -p "$workdir"
- cd "$workdir"
- combo_name="minimal-shallow"
- result_file="$RUNNER_TEMP/kernel-speed-test-result.json"
- branch="common-${{ matrix.branch }}"
- init_start_ns=$(date +%s%N)
- init_status=0
- sync_status=0
- error_message=""
- set +e
- repo init -u https://android.googlesource.com/kernel/manifest -b "$branch" --depth=1
- init_status=$?
- set -e
- if [ "$init_status" -ne 0 ]; then
- error_message="repo init failed (exit ${init_status})"
- fi
- init_end_ns=$(date +%s%N)
- init_elapsed_ms=$(( (init_end_ns - init_start_ns) / 1000000 ))
- sync_cmd=(repo sync -c --current-branch --no-clone-bundle --no-tags --jobs-checkout=4 -j4)
- sync_elapsed_ms=""
- total_elapsed_ms=""
- if [ "$init_status" -eq 0 ]; then
- sync_start_ns=$(date +%s%N)
- set +e
- timeout 20m "${sync_cmd[@]}"
- sync_status=$?
- set -e
- sync_end_ns=$(date +%s%N)
- sync_elapsed_ms=$(( (sync_end_ns - sync_start_ns) / 1000000 ))
- total_elapsed_ms=$(( (sync_end_ns - init_start_ns) / 1000000 ))
- if [ "$sync_status" -ne 0 ] && [ -z "$error_message" ]; then
- error_message="repo sync failed (exit ${sync_status})"
- fi
- fi
- status_value="ok"
- if [ -n "$error_message" ]; then
- status_value="failed"
- fi
- cat > "$result_file" <<EOF
- {
- "branch": "$branch",
- "profile": "$combo_name",
- "mode": "unset",
- "init_ms": ${init_elapsed_ms},
- "sync_ms": ${sync_elapsed_ms:-null},
- "total_ms": ${total_elapsed_ms:-null},
- "init_status": ${init_status},
- "sync_status": ${sync_status},
- "status": "${status_value}",
- "error": "${error_message}"
- }
- EOF
- - name: Upload benchmark result
- if: always()
- uses: actions/upload-artifact@v4
- with:
- name: benchmark-${{ matrix.branch }}-minimal-shallow
- path: ${{ runner.temp }}/kernel-speed-test-result.json
- if-no-files-found: error
- summarize-results:
- runs-on: ubuntu-latest
- needs: benchmark-download
- if: always()
- steps:
- - name: Download benchmark results
- uses: actions/download-artifact@v4
- with:
- path: benchmark-results
- - name: Build summary table
- shell: bash
- run: |
- set -euo pipefail
- python3 - <<'PY'
- import json
- from pathlib import Path
- root = Path('benchmark-results')
- rows = []
- for path in sorted(root.glob('*/kernel-speed-test-result.json')):
- rows.append(json.loads(path.read_text()))
- rows.sort(key=lambda row: (row.get('total_ms') is None, row.get('total_ms') or 10**18))
- def fmt_ms(value):
- return f"{value/1000:.2f}s" if value is not None else 'n/a'
- summary = []
- summary.append('## LTS download benchmark summary')
- summary.append('')
- summary.append('| Branch | Profile | Repo init | Repo sync | Total | Status |')
- summary.append('| --- | --- | ---: | ---: | ---: | --- |')
- for row in rows:
- summary.append(
- f"| {row['branch']} | {row['profile']} | {fmt_ms(row.get('init_ms'))} | {fmt_ms(row.get('sync_ms'))} | {fmt_ms(row.get('total_ms'))} | {row.get('status', 'unknown')} |"
- )
- if rows:
- summary.append('')
- summary.append('### Best total times')
- for row in rows[:5]:
- summary.append(f"- {fmt_ms(row['total_ms'])} - {row['branch']} / {row['profile']}")
- summary.append('')
- summary.append('### Worst total times')
- for row in rows[-5:][::-1]:
- summary.append(f"- {fmt_ms(row['total_ms'])} - {row['branch']} / {row['profile']}")
- Path('benchmark-summary.md').write_text('\n'.join(summary) + '\n')
- PY
- - name: Publish benchmark summary
- shell: bash
- run: cat benchmark-summary.md >> "$GITHUB_STEP_SUMMARY"
|