-
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
Open
shreeya-patel98
wants to merge
2
commits into
main
Choose a base branch
from
shreeya_kernelci_multiarch
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+357
−86
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| 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 | ||
shreeya-patel98 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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_ARCH1="$2" | ||
| TOTAL_TIME_ARCH1="$3" | ||
| PASSED_ARCH1="$4" | ||
| FAILED_ARCH1="$5" | ||
| 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_ARCH2="${10}" | ||
| TOTAL_TIME_ARCH2="${11}" | ||
| PASSED_ARCH2="${12}" | ||
| FAILED_ARCH2="${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_ARCH1" ] || [ -z "$TOTAL_TIME_ARCH1" ] || [ -z "$PASSED_ARCH1" ] || [ -z "$FAILED_ARCH1" ] || [ -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,20 @@ convert_time() { | |
| echo "${minutes}m ${remaining_seconds}s" | ||
| } | ||
|
|
||
| BUILD_TIME_READABLE=$(convert_time "$BUILD_TIME") | ||
| TOTAL_TIME_READABLE=$(convert_time "$TOTAL_TIME") | ||
| BUILD_TIME_ARCH1_READABLE=$(convert_time "$BUILD_TIME_ARCH1") | ||
| TOTAL_TIME_ARCH1_READABLE=$(convert_time "$TOTAL_TIME_ARCH1") | ||
|
|
||
| if [ "$MULTIARCH" = true ]; then | ||
| BUILD_TIME_ARCH2_READABLE=$(convert_time "$BUILD_TIME_ARCH2") | ||
| TOTAL_TIME_ARCH2_READABLE=$(convert_time "$TOTAL_TIME_ARCH2") | ||
|
|
||
| # Parse architecture names from ARCH variable (e.g., "x86_64,aarch64") | ||
| ARCH1_NAME=$(echo "$ARCH" | cut -d',' -f1) | ||
| ARCH2_NAME=$(echo "$ARCH" | cut -d',' -f2) | ||
| else | ||
| # Single architecture case | ||
| ARCH1_NAME="$ARCH" | ||
| fi | ||
|
|
||
| cat << EOF | ||
| ## Summary | ||
|
|
@@ -56,23 +79,31 @@ 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 | | ||
| |--------------|------------|------------| | ||
| | ${ARCH1_NAME} | ${BUILD_TIME_ARCH1_READABLE} | ${TOTAL_TIME_ARCH1_READABLE} | | ||
| | ${ARCH2_NAME} | ${BUILD_TIME_ARCH2_READABLE} | ${TOTAL_TIME_ARCH2_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 | | ||
| |--------------|---------|--------| | ||
| | ${ARCH1_NAME} | ${PASSED_ARCH1} | ${FAILED_ARCH1} | | ||
| | ${ARCH2_NAME} | ${PASSED_ARCH2} | ${FAILED_ARCH2} | | ||
| - [View kselftest logs](https://github.com/${REPO}/actions/runs/${RUN_ID}) | ||
| ${COMPARISON_SECTION} | ||
|
|
@@ -81,3 +112,30 @@ ${COMPARISON_SECTION} | |
| 🤖 This PR was automatically generated by GitHub Actions | ||
| Run ID: ${RUN_ID} | ||
| EOF | ||
| else | ||
| cat << EOF | ||
| ## Test Results | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a lot of duplication. I prefer to just add 3 ifs if MULTIARCH and add the second arch there. |
||
| ### ✅ Build Stage | ||
| - Status: Passed (${ARCH1_NAME}) | ||
| - Build Time: ${BUILD_TIME_ARCH1_READABLE} | ||
| - Total Time: ${TOTAL_TIME_ARCH1_READABLE} | ||
| - [View build logs](https://github.com/${REPO}/actions/runs/${RUN_ID}) | ||
| ### ✅ Boot Verification | ||
| - Status: Passed (${ARCH1_NAME}) | ||
| - [View boot logs](https://github.com/${REPO}/actions/runs/${RUN_ID}) | ||
| ### ✅ Kernel Selftests (${ARCH1_NAME}) | ||
| - **Passed:** ${PASSED_ARCH1} | ||
| - **Failed:** ${FAILED_ARCH1} | ||
| - [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 | ||
| fi | ||
Oops, something went wrong.
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.
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.
I find this confusing.
So arch can be x86_64,aarch64 or just one of them right?
But then, buil_time, total time etc do not seem to be arch specific based on the name, even though it is because they represent the first arch given.
Also, the optional params are named after aarch64. What if x86 is the optional arch?
I may be missing something, but I personally find this hard to read.