lts-download-speed-test.yml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. name: LTS Download Speed Test
  2. on:
  3. workflow_dispatch:
  4. permissions:
  5. contents: read
  6. actions: read
  7. jobs:
  8. benchmark-download:
  9. runs-on: ubuntu-latest
  10. timeout-minutes: 180
  11. strategy:
  12. fail-fast: false
  13. max-parallel: 7
  14. matrix:
  15. branch:
  16. - android12-5.10-lts
  17. - android13-5.10-lts
  18. - android13-5.15-lts
  19. - android14-5.15-lts
  20. - android14-6.1-lts
  21. - android15-6.6-lts
  22. - android16-6.12-lts
  23. name: ${{ matrix.branch }} / minimal-shallow
  24. steps:
  25. - name: Install repo tool
  26. shell: bash
  27. run: |
  28. set -euo pipefail
  29. mkdir -p "$HOME/.local/bin"
  30. curl -fsSL https://storage.googleapis.com/git-repo-downloads/repo -o "$HOME/.local/bin/repo"
  31. chmod +x "$HOME/.local/bin/repo"
  32. echo "$HOME/.local/bin" >> "$GITHUB_PATH"
  33. - name: Benchmark repo sync
  34. shell: bash
  35. run: |
  36. set -euo pipefail
  37. workdir="$RUNNER_TEMP/kernel-speed-test/${{ matrix.branch }}/minimal-shallow"
  38. mkdir -p "$workdir"
  39. cd "$workdir"
  40. combo_name="minimal-shallow"
  41. result_file="$RUNNER_TEMP/kernel-speed-test-result.json"
  42. branch="common-${{ matrix.branch }}"
  43. init_start_ns=$(date +%s%N)
  44. init_status=0
  45. sync_status=0
  46. error_message=""
  47. set +e
  48. repo init -u https://android.googlesource.com/kernel/manifest -b "$branch" --depth=1
  49. init_status=$?
  50. set -e
  51. if [ "$init_status" -ne 0 ]; then
  52. error_message="repo init failed (exit ${init_status})"
  53. fi
  54. init_end_ns=$(date +%s%N)
  55. init_elapsed_ms=$(( (init_end_ns - init_start_ns) / 1000000 ))
  56. sync_cmd=(repo sync -c --current-branch --no-clone-bundle --no-tags --jobs-checkout=4 -j4)
  57. sync_elapsed_ms=""
  58. total_elapsed_ms=""
  59. if [ "$init_status" -eq 0 ]; then
  60. sync_start_ns=$(date +%s%N)
  61. set +e
  62. timeout 20m "${sync_cmd[@]}"
  63. sync_status=$?
  64. set -e
  65. sync_end_ns=$(date +%s%N)
  66. sync_elapsed_ms=$(( (sync_end_ns - sync_start_ns) / 1000000 ))
  67. total_elapsed_ms=$(( (sync_end_ns - init_start_ns) / 1000000 ))
  68. if [ "$sync_status" -ne 0 ] && [ -z "$error_message" ]; then
  69. error_message="repo sync failed (exit ${sync_status})"
  70. fi
  71. fi
  72. status_value="ok"
  73. if [ -n "$error_message" ]; then
  74. status_value="failed"
  75. fi
  76. cat > "$result_file" <<EOF
  77. {
  78. "branch": "$branch",
  79. "profile": "$combo_name",
  80. "mode": "unset",
  81. "init_ms": ${init_elapsed_ms},
  82. "sync_ms": ${sync_elapsed_ms:-null},
  83. "total_ms": ${total_elapsed_ms:-null},
  84. "init_status": ${init_status},
  85. "sync_status": ${sync_status},
  86. "status": "${status_value}",
  87. "error": "${error_message}"
  88. }
  89. EOF
  90. - name: Upload benchmark result
  91. if: always()
  92. uses: actions/upload-artifact@v4
  93. with:
  94. name: benchmark-${{ matrix.branch }}-minimal-shallow
  95. path: ${{ runner.temp }}/kernel-speed-test-result.json
  96. if-no-files-found: error
  97. summarize-results:
  98. runs-on: ubuntu-latest
  99. needs: benchmark-download
  100. if: always()
  101. steps:
  102. - name: Download benchmark results
  103. uses: actions/download-artifact@v4
  104. with:
  105. path: benchmark-results
  106. - name: Build summary table
  107. shell: bash
  108. run: |
  109. set -euo pipefail
  110. python3 - <<'PY'
  111. import json
  112. from pathlib import Path
  113. root = Path('benchmark-results')
  114. rows = []
  115. for path in sorted(root.glob('*/kernel-speed-test-result.json')):
  116. rows.append(json.loads(path.read_text()))
  117. rows.sort(key=lambda row: (row.get('total_ms') is None, row.get('total_ms') or 10**18))
  118. def fmt_ms(value):
  119. return f"{value/1000:.2f}s" if value is not None else 'n/a'
  120. summary = []
  121. summary.append('## LTS download benchmark summary')
  122. summary.append('')
  123. summary.append('| Branch | Profile | Repo init | Repo sync | Total | Status |')
  124. summary.append('| --- | --- | ---: | ---: | ---: | --- |')
  125. for row in rows:
  126. summary.append(
  127. 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')} |"
  128. )
  129. if rows:
  130. summary.append('')
  131. summary.append('### Best total times')
  132. for row in rows[:5]:
  133. summary.append(f"- {fmt_ms(row['total_ms'])} - {row['branch']} / {row['profile']}")
  134. summary.append('')
  135. summary.append('### Worst total times')
  136. for row in rows[-5:][::-1]:
  137. summary.append(f"- {fmt_ms(row['total_ms'])} - {row['branch']} / {row['profile']}")
  138. Path('benchmark-summary.md').write_text('\n'.join(summary) + '\n')
  139. PY
  140. - name: Publish benchmark summary
  141. shell: bash
  142. run: cat benchmark-summary.md >> "$GITHUB_STEP_SUMMARY"