From f3ecdef1525d4b2097792b091390bcf125b7b397 Mon Sep 17 00:00:00 2001 From: Shreeya Patel Date: Fri, 23 Jan 2026 10:59:40 +0000 Subject: [PATCH 1/2] [github-actions] Add multi-arch support Extended the kernel build and test workflow to support multiple architectures. The workflow now builds and tests kernels for both x86_64 and aarch64 platforms in parallel. Important changes :- - Renamed workflow from kernel-build-and-test-x86_64.yml to kernel-build-and-test-multiarch.yml - Added dynamic matrix generation based on architecture input parameter - Separate runners for each architecture (kernel-build for x86_64, kernel-build-arm64 for aarch64) - Per-architecture artifact uploads and comparison results - Architecture-specific kselftest baseline tracking and regression detection - PR creation includes results from both architectures with separate status sections Signed-off-by: Shreeya Patel --- ...ml => kernel-build-and-test-multiarch.yml} | 339 ++++++++++++++---- 1 file changed, 275 insertions(+), 64 deletions(-) rename .github/workflows/{kernel-build-and-test-x86_64.yml => kernel-build-and-test-multiarch.yml} (65%) diff --git a/.github/workflows/kernel-build-and-test-x86_64.yml b/.github/workflows/kernel-build-and-test-multiarch.yml similarity index 65% rename from .github/workflows/kernel-build-and-test-x86_64.yml rename to .github/workflows/kernel-build-and-test-multiarch.yml index 6c5ca6116fd28..7b1ac120d2a0f 100644 --- a/.github/workflows/kernel-build-and-test-x86_64.yml +++ b/.github/workflows/kernel-build-and-test-multiarch.yml @@ -1,7 +1,13 @@ -name: Automated kernel build and test (x86_64) +name: Automated kernel build and test (multi-arch) on: workflow_call: + inputs: + architectures: + description: 'Comma-separated architectures to build (x86_64, aarch64)' + required: false + type: string + default: 'x86_64,aarch64' secrets: APP_ID: required: true @@ -15,10 +21,41 @@ permissions: pull-requests: write jobs: + setup: + name: Setup matrix + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - name: Generate dynamic matrix + id: set-matrix + run: | + # Parse architectures input and build matrix + ARCHS="${{ inputs.architectures }}" + + MATRIX_ITEMS='[]' + + if echo "$ARCHS" | grep -q "x86_64"; then + MATRIX_ITEMS=$(echo "$MATRIX_ITEMS" | jq -c '. + [{"arch": "x86_64", "runner": "kernel-build"}]') + fi + + if echo "$ARCHS" | grep -q "aarch64"; then + MATRIX_ITEMS=$(echo "$MATRIX_ITEMS" | jq -c '. + [{"arch": "aarch64", "runner": "kernel-build-arm64"}]') + fi + + # Compact JSON output on a single line + MATRIX_JSON=$(echo "{\"include\":$MATRIX_ITEMS}" | jq -c .) + echo "matrix=$MATRIX_JSON" >> $GITHUB_OUTPUT + echo "Generated matrix: $MATRIX_JSON" + build: - name: Build kernel - runs-on: kernel-build + name: Build kernel (${{ matrix.arch }}) + runs-on: ${{ matrix.runner }} + needs: setup if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[ci skip]')" + strategy: + fail-fast: false + matrix: ${{ fromJSON(needs.setup.outputs.matrix) }} steps: - name: Generate GitHub App token @@ -85,7 +122,7 @@ jobs: uses: actions/upload-artifact@v4 if: always() with: - name: kernel-compilation-logs-x86_64 + name: kernel-compilation-logs-${{ matrix.arch }} path: output/kernel-build.log retention-days: 7 @@ -94,16 +131,19 @@ jobs: uses: actions/upload-artifact@v4 if: always() with: - name: kernel-qcow2-image-x86_64 + name: kernel-qcow2-image-${{ matrix.arch }} path: | output/*.qcow2 output/last_build_image.txt retention-days: 7 boot: - name: Boot verification - runs-on: kernel-build - needs: build + name: Boot verification (${{ matrix.arch }}) + runs-on: ${{ matrix.runner }} + needs: [setup, build] + strategy: + fail-fast: false + matrix: ${{ fromJSON(needs.setup.outputs.matrix) }} steps: - name: Generate GitHub App token @@ -136,7 +176,7 @@ jobs: - name: Download qcow2 image uses: actions/download-artifact@v4 with: - name: kernel-qcow2-image-x86_64 + name: kernel-qcow2-image-${{ matrix.arch }} path: output # Boot verification test @@ -159,14 +199,17 @@ jobs: uses: actions/upload-artifact@v4 if: always() with: - name: boot-logs-x86_64 + name: boot-logs-${{ matrix.arch }} path: output/boot-*.log retention-days: 7 test-kselftest: - name: Run kselftests - runs-on: kernel-build - needs: boot + name: Run kselftests (${{ matrix.arch }}) + runs-on: ${{ matrix.runner }} + needs: [setup, boot] + strategy: + fail-fast: false + matrix: ${{ fromJSON(needs.setup.outputs.matrix) }} steps: - name: Generate GitHub App token @@ -199,7 +242,7 @@ jobs: - name: Download qcow2 image uses: actions/download-artifact@v4 with: - name: kernel-qcow2-image-x86_64 + name: kernel-qcow2-image-${{ matrix.arch }} path: output # Run kselftests @@ -222,31 +265,35 @@ jobs: uses: actions/upload-artifact@v4 if: always() with: - name: kselftest-logs-x86_64 + name: kselftest-logs-${{ matrix.arch }} path: | output/kselftests-*.log output/dmesg-*.log retention-days: 7 compare-results: - name: Compare with previous run - runs-on: kernel-build - needs: test-kselftest + name: Compare with previous run (${{ matrix.arch }}) + runs-on: ${{ matrix.runner }} + needs: [setup, test-kselftest] if: success() || failure() + strategy: + fail-fast: false + matrix: ${{ fromJSON(needs.setup.outputs.matrix) }} outputs: base_branch: ${{ steps.base_branch.outputs.base_branch }} - comparison_status: ${{ steps.comparison.outputs.comparison_status }} + comparison_status_x86_64: ${{ matrix.arch == 'x86_64' && steps.comparison.outputs.comparison_status || '' }} + comparison_status_aarch64: ${{ matrix.arch == 'aarch64' && steps.comparison.outputs.comparison_status || '' }} steps: - name: Checkout kernel source uses: actions/checkout@v4 with: - fetch-depth: 0 # Full history needed for reliable merge-base detection + fetch-depth: 1 # Shallow clone - only current commit needed for comparison logic - name: Download current kselftest logs uses: actions/download-artifact@v4 with: - name: kselftest-logs-x86_64 + name: kselftest-logs-${{ matrix.arch }} path: output-current - name: Install GitHub CLI @@ -341,7 +388,7 @@ jobs: # Get last 50 successful workflow runs (cast a wider net to find PRs targeting this base) # We need to check each run to see if it targets the same base branch SUCCESSFUL_RUNS=$(gh run list \ - --workflow kernel-build-and-test-x86_64.yml \ + --workflow kernel-build-and-test-multiarch.yml \ --status success \ --limit 50 \ --json databaseId,headBranch,createdAt) @@ -373,7 +420,7 @@ jobs: echo "Found candidate run $RUN_ID from branch $HEAD_BRANCH (targets: $BASE_BRANCH)" # Try to download artifact from this run - if gh run download "$RUN_ID" --name kselftest-logs-x86_64 --dir output-previous 2>/dev/null; then + if gh run download "$RUN_ID" --name kselftest-logs-${{ matrix.arch }} --dir output-previous 2>/dev/null; then echo "Successfully downloaded baseline from run $RUN_ID (branch: $HEAD_BRANCH, created: $CREATED_AT)" echo "BASELINE_RUN_ID=$RUN_ID" >> $GITHUB_ENV echo "BASELINE_BRANCH=$HEAD_BRANCH" >> $GITHUB_ENV @@ -414,7 +461,7 @@ jobs: BEFORE_FAIL=$(grep -a '^not ok' output-previous/kselftests-*.log | wc -l || echo "0") AFTER_FAIL=$(grep -a '^not ok' output-current/kselftests-*.log | wc -l || echo "0") - echo "### Kselftest Comparison" + echo "### Kselftest Comparison (${{ matrix.arch }})" echo "Baseline (from $BASELINE_SOURCE targeting ${{ steps.base_branch.outputs.base_branch }}): $BEFORE_PASS passing, $BEFORE_FAIL failing" echo "Current (${{ github.ref_name }}): $AFTER_PASS passing, $AFTER_FAIL failing" @@ -455,10 +502,11 @@ jobs: echo "comparison_status=skipped" >> $GITHUB_OUTPUT echo "comparison_message=No baseline results available from ${{ steps.base_branch.outputs.base_branch }}" >> $GITHUB_OUTPUT fi + create-pr: name: Create Pull Request runs-on: kernel-build - needs: [build, boot, test-kselftest, compare-results] + needs: [setup, build, boot, test-kselftest, compare-results] if: success() || failure() steps: @@ -481,8 +529,28 @@ jobs: exit 1 fi - # Skip PR if regression was detected (but allow if comparison was skipped/unavailable) - if [ "${{ needs.compare-results.outputs.comparison_status }}" = "failed" ]; then + # Determine which architectures are enabled + ARCHS="${{ inputs.architectures }}" + REGRESSION_DETECTED=false + + # Check x86_64 regression if enabled + if echo "$ARCHS" | grep -q "x86_64"; then + if [ "${{ needs.compare-results.outputs.comparison_status_x86_64 }}" = "failed" ]; then + echo "x86_64: Test regression detected" + REGRESSION_DETECTED=true + fi + fi + + # Check aarch64 regression if enabled + if echo "$ARCHS" | grep -q "aarch64"; then + if [ "${{ needs.compare-results.outputs.comparison_status_aarch64 }}" = "failed" ]; then + echo "aarch64: Test regression detected" + REGRESSION_DETECTED=true + fi + fi + + # Skip PR if any regression was detected (but allow if comparison was skipped/unavailable) + if [ "$REGRESSION_DETECTED" = "true" ]; then echo "Test regression detected, skipping PR creation" exit 1 fi @@ -504,39 +572,122 @@ jobs: echo "Fetched base branch: $BASE_BRANCH" fi - - name: Download kernel compilation logs + - name: Detect available architectures + id: detect_arch + run: | + ARCHS="${{ inputs.architectures }}" + HAS_X86_64=false + HAS_AARCH64=false + + if echo "$ARCHS" | grep -q "x86_64"; then + HAS_X86_64=true + fi + + if echo "$ARCHS" | grep -q "aarch64"; then + HAS_AARCH64=true + fi + + echo "has_x86_64=$HAS_X86_64" >> $GITHUB_OUTPUT + echo "has_aarch64=$HAS_AARCH64" >> $GITHUB_OUTPUT + echo "Architectures enabled: x86_64=$HAS_X86_64, aarch64=$HAS_AARCH64" + + - name: Download kernel compilation logs (x86_64) + if: steps.detect_arch.outputs.has_x86_64 == 'true' uses: actions/download-artifact@v4 with: name: kernel-compilation-logs-x86_64 - path: artifacts/build + path: artifacts/build/x86_64 - - name: Download boot logs + - name: Download kernel compilation logs (aarch64) + if: steps.detect_arch.outputs.has_aarch64 == 'true' + uses: actions/download-artifact@v4 + with: + name: kernel-compilation-logs-aarch64 + path: artifacts/build/aarch64 + + - name: Download boot logs (x86_64) + if: steps.detect_arch.outputs.has_x86_64 == 'true' uses: actions/download-artifact@v4 with: name: boot-logs-x86_64 - path: artifacts/boot + path: artifacts/boot/x86_64 - - name: Download kselftest logs + - name: Download boot logs (aarch64) + if: steps.detect_arch.outputs.has_aarch64 == 'true' + uses: actions/download-artifact@v4 + with: + name: boot-logs-aarch64 + path: artifacts/boot/aarch64 + + - name: Download kselftest logs (x86_64) + if: steps.detect_arch.outputs.has_x86_64 == 'true' uses: actions/download-artifact@v4 with: name: kselftest-logs-x86_64 - path: artifacts/test + path: artifacts/test/x86_64 + + - name: Download kselftest logs (aarch64) + if: steps.detect_arch.outputs.has_aarch64 == 'true' + uses: actions/download-artifact@v4 + with: + name: kselftest-logs-aarch64 + path: artifacts/test/aarch64 - name: Extract test statistics id: stats run: | - PASSED=$(grep -a '^ok' artifacts/test/kselftests-*.log | wc -l || echo "0") - FAILED=$(grep -a '^not ok' artifacts/test/kselftests-*.log | wc -l || echo "0") - echo "passed=$PASSED" >> $GITHUB_OUTPUT - echo "failed=$FAILED" >> $GITHUB_OUTPUT + HAS_X86="${{ steps.detect_arch.outputs.has_x86_64 }}" + HAS_ARM="${{ steps.detect_arch.outputs.has_aarch64 }}" + + # x86_64 stats + if [ "$HAS_X86" = "true" ]; then + PASSED_X86=$(grep -a '^ok' artifacts/test/x86_64/kselftests-*.log | wc -l || echo "0") + FAILED_X86=$(grep -a '^not ok' artifacts/test/x86_64/kselftests-*.log | wc -l || echo "0") + else + PASSED_X86="0" + FAILED_X86="0" + fi + echo "passed_x86_64=$PASSED_X86" >> $GITHUB_OUTPUT + echo "failed_x86_64=$FAILED_X86" >> $GITHUB_OUTPUT + + # aarch64 stats + if [ "$HAS_ARM" = "true" ]; then + PASSED_ARM=$(grep -a '^ok' artifacts/test/aarch64/kselftests-*.log | wc -l || echo "0") + FAILED_ARM=$(grep -a '^not ok' artifacts/test/aarch64/kselftests-*.log | wc -l || echo "0") + else + PASSED_ARM="0" + FAILED_ARM="0" + fi + echo "passed_aarch64=$PASSED_ARM" >> $GITHUB_OUTPUT + echo "failed_aarch64=$FAILED_ARM" >> $GITHUB_OUTPUT - name: Extract build timers id: build_info run: | - BUILD_TIME=$(grep -oP '\[TIMER\]\{BUILD\}:\s*\K[0-9]+' artifacts/build/kernel-build.log | head -1 || echo "N/A") - TOTAL_TIME=$(grep -oP '\[TIMER\]\{TOTAL\}\s*\K[0-9]+' artifacts/build/kernel-build.log | head -1 || echo "N/A") - echo "build_time=${BUILD_TIME}s" >> $GITHUB_OUTPUT - echo "total_time=${TOTAL_TIME}s" >> $GITHUB_OUTPUT + HAS_X86="${{ steps.detect_arch.outputs.has_x86_64 }}" + HAS_ARM="${{ steps.detect_arch.outputs.has_aarch64 }}" + + # x86_64 build times + if [ "$HAS_X86" = "true" ]; then + BUILD_TIME_X86=$(grep -oP '\[TIMER\]\{BUILD\}:\s*\K[0-9]+' artifacts/build/x86_64/kernel-build.log | head -1 || echo "N/A") + TOTAL_TIME_X86=$(grep -oP '\[TIMER\]\{TOTAL\}\s*\K[0-9]+' artifacts/build/x86_64/kernel-build.log | head -1 || echo "N/A") + else + BUILD_TIME_X86="N/A" + TOTAL_TIME_X86="N/A" + fi + echo "build_time_x86_64=${BUILD_TIME_X86}s" >> $GITHUB_OUTPUT + echo "total_time_x86_64=${TOTAL_TIME_X86}s" >> $GITHUB_OUTPUT + + # aarch64 build times + if [ "$HAS_ARM" = "true" ]; then + BUILD_TIME_ARM=$(grep -oP '\[TIMER\]\{BUILD\}:\s*\K[0-9]+' artifacts/build/aarch64/kernel-build.log | head -1 || echo "N/A") + TOTAL_TIME_ARM=$(grep -oP '\[TIMER\]\{TOTAL\}\s*\K[0-9]+' artifacts/build/aarch64/kernel-build.log | head -1 || echo "N/A") + else + BUILD_TIME_ARM="N/A" + TOTAL_TIME_ARM="N/A" + fi + echo "build_time_aarch64=${BUILD_TIME_ARM}s" >> $GITHUB_OUTPUT + echo "total_time_aarch64=${TOTAL_TIME_ARM}s" >> $GITHUB_OUTPUT - name: Get commit information id: commit_msg @@ -571,10 +722,10 @@ jobs: git log -1 $commit --format=%B | awk 'BEGIN{print "```"} /^$/{empty++} empty==2{exit} {print} END{print "```"}' >> /tmp/commit_message.txt done - - name: Fetch PR body script from main + - name: Fetch PR body script from shreeya_kernelci_main run: | - git fetch origin main:main - git checkout origin/main -- .github/scripts/create-pr-body.sh + git fetch origin shreeya_kernelci_main:shreeya_kernelci_main + git checkout origin/shreeya_kernelci_main -- .github/scripts/create-pr-body.sh chmod +x .github/scripts/create-pr-body.sh - name: Generate GitHub App token @@ -601,34 +752,94 @@ jobs: echo "Creating/updating PR from ${{ github.ref_name }} to $BASE_BRANCH" - # Determine comparison status message - COMPARISON_STATUS="${{ needs.compare-results.outputs.comparison_status }}" - if [ "$COMPARISON_STATUS" = "passed" ]; then - COMPARISON_SECTION="### ✅ Test Comparison - - Status: Passed - Within acceptable threshold (±3 tests) - - Compared against: $BASE_BRANCH" - elif [ "$COMPARISON_STATUS" = "skipped" ]; then - COMPARISON_SECTION="### ⚠️ Test Comparison - - Status: Skipped - - Reason: No baseline test results available from $BASE_BRANCH - - **Note:** Manual review recommended to ensure no regressions" + # Determine which architectures are enabled + HAS_X86="${{ steps.detect_arch.outputs.has_x86_64 }}" + HAS_ARM="${{ steps.detect_arch.outputs.has_aarch64 }}" + + # Create comparison section + COMPARISON_SECTION="### Test Comparison" + + # Add x86_64 status + if [ "$HAS_X86" = "true" ]; then + COMPARISON_SECTION="$COMPARISON_SECTION + +**x86_64:**" + case "${{ needs.compare-results.outputs.comparison_status_x86_64 }}" in + passed) + COMPARISON_SECTION="$COMPARISON_SECTION +- ✅ Status: Passed - Within acceptable threshold (±3 tests) +- Compared against: $BASE_BRANCH" + ;; + skipped) + COMPARISON_SECTION="$COMPARISON_SECTION +- ⚠️ Status: Skipped - No baseline available" + ;; + *) + COMPARISON_SECTION="$COMPARISON_SECTION +- ❌ Status: Failed - Regression detected" + ;; + esac + fi + + # Add aarch64 status + if [ "$HAS_ARM" = "true" ]; then + COMPARISON_SECTION="$COMPARISON_SECTION + +**aarch64:**" + case "${{ needs.compare-results.outputs.comparison_status_aarch64 }}" in + passed) + COMPARISON_SECTION="$COMPARISON_SECTION +- ✅ Status: Passed - Within acceptable threshold (±3 tests) +- Compared against: $BASE_BRANCH" + ;; + skipped) + COMPARISON_SECTION="$COMPARISON_SECTION +- ⚠️ Status: Skipped - No baseline available" + ;; + *) + COMPARISON_SECTION="$COMPARISON_SECTION +- ❌ Status: Failed - Regression detected" + ;; + esac + fi + + # Determine architecture parameter and which stats to use + if [ "$HAS_X86" = "true" ] && [ "$HAS_ARM" = "true" ]; then + ARCH_PARAM="x86_64,aarch64" + BUILD_TIME_PARAM="${{ steps.build_info.outputs.build_time_x86_64 }}" + TOTAL_TIME_PARAM="${{ steps.build_info.outputs.total_time_x86_64 }}" + PASSED_PARAM="${{ steps.stats.outputs.passed_x86_64 }}" + FAILED_PARAM="${{ steps.stats.outputs.failed_x86_64 }}" + # Add aarch64 parameters for multi-arch + EXTRA_PARAMS="${{ steps.build_info.outputs.build_time_aarch64 }} ${{ steps.build_info.outputs.total_time_aarch64 }} ${{ steps.stats.outputs.passed_aarch64 }} ${{ steps.stats.outputs.failed_aarch64 }}" + elif [ "$HAS_X86" = "true" ]; then + ARCH_PARAM="x86_64" + BUILD_TIME_PARAM="${{ steps.build_info.outputs.build_time_x86_64 }}" + TOTAL_TIME_PARAM="${{ steps.build_info.outputs.total_time_x86_64 }}" + PASSED_PARAM="${{ steps.stats.outputs.passed_x86_64 }}" + FAILED_PARAM="${{ steps.stats.outputs.failed_x86_64 }}" + EXTRA_PARAMS="" else - COMPARISON_SECTION="### ❌ Test Comparison - - Status: Failed - Regression detected - - Compared against: $BASE_BRANCH - - **Action Required:** Review test differences before merging" + ARCH_PARAM="aarch64" + BUILD_TIME_PARAM="${{ steps.build_info.outputs.build_time_aarch64 }}" + TOTAL_TIME_PARAM="${{ steps.build_info.outputs.total_time_aarch64 }}" + PASSED_PARAM="${{ steps.stats.outputs.passed_aarch64 }}" + FAILED_PARAM="${{ steps.stats.outputs.failed_aarch64 }}" + EXTRA_PARAMS="" fi - # Create PR body using script + # Call script with appropriate parameters .github/scripts/create-pr-body.sh \ - "${{ steps.build_info.outputs.build_time }}" \ - "${{ steps.build_info.outputs.total_time }}" \ - "${{ steps.stats.outputs.passed }}" \ - "${{ steps.stats.outputs.failed }}" \ + "$ARCH_PARAM" \ + "$BUILD_TIME_PARAM" \ + "$TOTAL_TIME_PARAM" \ + "$PASSED_PARAM" \ + "$FAILED_PARAM" \ "${{ github.run_id }}" \ "$COMPARISON_SECTION" \ "${{ github.repository }}" \ "/tmp/commit_message.txt" \ + $EXTRA_PARAMS \ > pr_body.md # Check if any open PR already exists from this head branch (regardless of base) From 20917afba97d89de5a7e05dbdffe29fdaf53504b Mon Sep 17 00:00:00 2001 From: Shreeya Patel Date: Fri, 23 Jan 2026 11:31:22 +0000 Subject: [PATCH 2/2] [github-actions] Add aarch64 support in the PR template Signed-off-by: Shreeya Patel --- .github/scripts/create-pr-body.sh | 99 +++++++++++++++++++++++-------- 1 file changed, 75 insertions(+), 24 deletions(-) diff --git a/.github/scripts/create-pr-body.sh b/.github/scripts/create-pr-body.sh index 04fe61ac6fa50..0a7c377850e21 100755 --- a/.github/scripts/create-pr-body.sh +++ b/.github/scripts/create-pr-body.sh @@ -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 [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 [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" +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 [commit_message_file]" >&2 + echo "Usage: $0 [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} - [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