-
Notifications
You must be signed in to change notification settings - Fork 10
[github-actions] Add multi-arch support #844
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
base: main
Are you sure you want to change the base?
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 |
|---|---|---|
| @@ -1,30 +1,41 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Script to create PR body | ||
| # Arguments: build_time total_time passed failed run_id comparison_section repo commit_message_file | ||
| # Arguments: arch build_time total_time passed failed run_id comparison_section repo commit_message_file [build_time_aarch64 total_time_aarch64 passed_aarch64 failed_aarch64] | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| # Check number of arguments | ||
| if [ $# -lt 7 ] || [ $# -gt 8 ]; then | ||
| echo "Error: Expected 7 or 8 arguments, got $#" >&2 | ||
| echo "Usage: $0 <build_time> <total_time> <passed> <failed> <run_id> <comparison_section> <repo> [commit_message_file]" >&2 | ||
| # Check number of arguments (8-9 for single arch, 13 for multi-arch) | ||
| if [ $# -lt 8 ] || ([ $# -gt 9 ] && [ $# -ne 13 ]); then | ||
| echo "Error: Expected 8-9 arguments (single arch) or 13 arguments (multi-arch), got $#" >&2 | ||
| echo "Usage: $0 <arch> <build_time> <total_time> <passed> <failed> <run_id> <comparison_section> <repo> [commit_message_file] [build_time_aarch64 total_time_aarch64 passed_aarch64 failed_aarch64]" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| BUILD_TIME="$1" | ||
| TOTAL_TIME="$2" | ||
| PASSED="$3" | ||
| FAILED="$4" | ||
| RUN_ID="$5" | ||
| COMPARISON_SECTION="$6" | ||
| REPO="$7" | ||
| COMMIT_MESSAGE_FILE="${8:-/tmp/commit_message.txt}" | ||
| ARCH="$1" | ||
| BUILD_TIME_X86="$2" | ||
| TOTAL_TIME_X86="$3" | ||
| PASSED_X86="$4" | ||
| FAILED_X86="$5" | ||
|
Comment on lines
+16
to
+19
|
||
| RUN_ID="$6" | ||
| COMPARISON_SECTION="$7" | ||
| REPO="$8" | ||
| COMMIT_MESSAGE_FILE="${9:-/tmp/commit_message.txt}" | ||
|
|
||
| # Multi-arch parameters (optional) | ||
| MULTIARCH=false | ||
| if [ $# -eq 13 ]; then | ||
| MULTIARCH=true | ||
| BUILD_TIME_ARM="${10}" | ||
| TOTAL_TIME_ARM="${11}" | ||
| PASSED_ARM="${12}" | ||
| FAILED_ARM="${13}" | ||
| fi | ||
|
|
||
| # Validate required arguments are not empty | ||
| if [ -z "$BUILD_TIME" ] || [ -z "$TOTAL_TIME" ] || [ -z "$PASSED" ] || [ -z "$FAILED" ] || [ -z "$RUN_ID" ] || [ -z "$COMPARISON_SECTION" ] || [ -z "$REPO" ]; then | ||
| if [ -z "$ARCH" ] || [ -z "$BUILD_TIME_X86" ] || [ -z "$TOTAL_TIME_X86" ] || [ -z "$PASSED_X86" ] || [ -z "$FAILED_X86" ] || [ -z "$RUN_ID" ] || [ -z "$COMPARISON_SECTION" ] || [ -z "$REPO" ]; then | ||
| echo "Error: One or more required arguments are empty" >&2 | ||
| echo "Usage: $0 <build_time> <total_time> <passed> <failed> <run_id> <comparison_section> <repo> [commit_message_file]" >&2 | ||
| echo "Usage: $0 <arch> <build_time> <total_time> <passed> <failed> <run_id> <comparison_section> <repo> [commit_message_file] [build_time_aarch64 total_time_aarch64 passed_aarch64 failed_aarch64]" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
|
|
@@ -42,8 +53,13 @@ convert_time() { | |
| echo "${minutes}m ${remaining_seconds}s" | ||
| } | ||
|
|
||
| BUILD_TIME_READABLE=$(convert_time "$BUILD_TIME") | ||
| TOTAL_TIME_READABLE=$(convert_time "$TOTAL_TIME") | ||
| BUILD_TIME_X86_READABLE=$(convert_time "$BUILD_TIME_X86") | ||
| TOTAL_TIME_X86_READABLE=$(convert_time "$TOTAL_TIME_X86") | ||
|
|
||
| if [ "$MULTIARCH" = true ]; then | ||
| BUILD_TIME_ARM_READABLE=$(convert_time "$BUILD_TIME_ARM") | ||
| TOTAL_TIME_ARM_READABLE=$(convert_time "$TOTAL_TIME_ARM") | ||
| fi | ||
|
|
||
| cat << EOF | ||
| ## Summary | ||
|
|
@@ -56,23 +72,57 @@ EOF | |
| cat "$COMMIT_MESSAGE_FILE" | ||
| echo "" | ||
|
|
||
| cat << EOF | ||
| if [ "$MULTIARCH" = true ]; then | ||
| cat << EOF | ||
|
|
||
| ## Test Results | ||
|
|
||
| ### ✅ Build Stage | ||
| - Status: Passed | ||
| - Build Time: ${BUILD_TIME_READABLE} | ||
| - Total Time: ${TOTAL_TIME_READABLE} | ||
|
|
||
| | Architecture | Build Time | Total Time | | ||
| |--------------|------------|------------| | ||
| | x86_64 | ${BUILD_TIME_X86_READABLE} | ${TOTAL_TIME_X86_READABLE} | | ||
| | aarch64 | ${BUILD_TIME_ARM_READABLE} | ${TOTAL_TIME_ARM_READABLE} | | ||
|
|
||
| - [View build logs](https://github.com/${REPO}/actions/runs/${RUN_ID}) | ||
|
|
||
| ### ✅ Boot Verification | ||
| - Status: Passed | ||
| - Status: Passed (both architectures) | ||
| - [View boot logs](https://github.com/${REPO}/actions/runs/${RUN_ID}) | ||
|
|
||
| ### ✅ Kernel Selftests | ||
| - **Passed:** ${PASSED} | ||
| - **Failed:** ${FAILED} | ||
|
|
||
| | Architecture | Passed | Failed | | ||
| |--------------|---------|--------| | ||
| | x86_64 | ${PASSED_X86} | ${FAILED_X86} | | ||
| | aarch64 | ${PASSED_ARM} | ${FAILED_ARM} | | ||
|
|
||
| - [View kselftest logs](https://github.com/${REPO}/actions/runs/${RUN_ID}) | ||
|
|
||
| ${COMPARISON_SECTION} | ||
|
|
||
| --- | ||
| 🤖 This PR was automatically generated by GitHub Actions | ||
| Run ID: ${RUN_ID} | ||
| EOF | ||
| else | ||
| cat << EOF | ||
|
|
||
| ## Test Results | ||
|
|
||
| ### ✅ Build Stage | ||
| - Status: Passed (${ARCH}) | ||
| - Build Time: ${BUILD_TIME_X86_READABLE} | ||
| - Total Time: ${TOTAL_TIME_X86_READABLE} | ||
| - [View build logs](https://github.com/${REPO}/actions/runs/${RUN_ID}) | ||
|
|
||
| ### ✅ Boot Verification | ||
| - Status: Passed (${ARCH}) | ||
| - [View boot logs](https://github.com/${REPO}/actions/runs/${RUN_ID}) | ||
|
|
||
| ### ✅ Kernel Selftests (${ARCH}) | ||
| - **Passed:** ${PASSED_X86} | ||
| - **Failed:** ${FAILED_X86} | ||
|
Comment on lines
+114
to
+125
|
||
| - [View kselftest logs](https://github.com/${REPO}/actions/runs/${RUN_ID}) | ||
|
|
||
| ${COMPARISON_SECTION} | ||
|
|
@@ -81,3 +131,4 @@ ${COMPARISON_SECTION} | |
| 🤖 This PR was automatically generated by GitHub Actions | ||
| Run ID: ${RUN_ID} | ||
| EOF | ||
| fi | ||
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.
The error message validation logic checks if the argument count is either 8-9 or exactly 13, but the comment says "8-9 for single arch" which suggests 8 and 9 are both valid. However, looking at the usage, position 9 is the optional commit_message_file which has a default value. The validation should clarify whether 8 or 9 is the expected count, or document why both are acceptable.