Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 35 additions & 15 deletions .github/workflows/kernel-build-and-test-multiarch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ on:
required: false
type: string
default: 'x86_64,aarch64'
skip_kselftests:
description: 'Skip the kselftests stage (e.g. for CBR where kselftest coverage is minimal)'
required: false
type: boolean
default: false
secrets:
APP_ID:
required: true
Expand Down Expand Up @@ -110,6 +115,7 @@ jobs:
-v "$PWD/kernel-src-tree":/src \
-v "$PWD/output":/output \
-v "$PWD/kernel-container-build/build-container":/usr/local/build-scripts:ro \
-v "$PWD/kernel-container-build/build-container/image_from_container.sh":/usr/local/bin/image_from_container.sh:ro \
-v "$PWD/kernel-container-build/container/kernel_build.sh":/usr/libexec/kernel_build.sh:ro \
-v "$PWD/kernel-container-build/container/check_kabi.sh":/usr/libexec/check_kabi.sh:ro \
--security-opt label=disable \
Expand Down Expand Up @@ -207,6 +213,7 @@ jobs:
name: Run kselftests (${{ matrix.arch }})
runs-on: ${{ matrix.runner }}
needs: [setup, boot]
if: ${{ !inputs.skip_kselftests }}
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.setup.outputs.matrix) }}
Expand Down Expand Up @@ -274,8 +281,8 @@ jobs:
compare-results:
name: Compare with previous run (${{ matrix.arch }})
runs-on: ${{ matrix.runner }}
needs: [setup, test-kselftest]
if: success() || failure()
needs: [setup, build, boot, test-kselftest]
if: ${{ always() && needs.build.result == 'success' && needs.boot.result == 'success' }}
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.setup.outputs.matrix) }}
Expand All @@ -291,6 +298,7 @@ jobs:
fetch-depth: 1 # Shallow clone - only current commit needed for comparison logic

- name: Download current kselftest logs
if: ${{ !inputs.skip_kselftests }}
uses: actions/download-artifact@v4
with:
name: kselftest-logs-${{ matrix.arch }}
Expand Down Expand Up @@ -325,7 +333,7 @@ jobs:

# Define whitelist of valid base branches
# TODO: Use a centralized place to get the base branches
VALID_BASES="ciqlts9_2 ciqlts9_4 ciqlts8_6 ciqlts9_6"
VALID_BASES="ciqlts9_2 ciqlts9_4 ciqlts8_6 ciqlts9_6 ciqcbr7_9"

echo "Current branch: $BRANCH_NAME"

Expand Down Expand Up @@ -374,7 +382,7 @@ jobs:
echo "Base branch for comparison: $BASE_BRANCH"

- name: Download baseline kselftest logs from last merged PR targeting same base
if: steps.base_branch.outputs.base_branch != ''
if: ${{ !inputs.skip_kselftests && steps.base_branch.outputs.base_branch != '' }}
env:
GH_TOKEN: ${{ steps.generate_token_compare.outputs.token }}
run: |
Expand Down Expand Up @@ -467,6 +475,7 @@ jobs:

- name: Compare test results
id: comparison
if: ${{ !inputs.skip_kselftests }}
run: |
# Check if we have a base branch to compare against
if [ -z "${{ steps.base_branch.outputs.base_branch }}" ]; then
Expand Down Expand Up @@ -536,7 +545,10 @@ jobs:
name: Create Pull Request
runs-on: kernel-build
needs: [setup, build, boot, test-kselftest, compare-results]
if: success() || failure()
if: |
always() &&
needs.build.result == 'success' &&
needs.boot.result == 'success'

steps:
- name: Check if branch name contains curly brackets
Expand All @@ -550,10 +562,12 @@ jobs:

- name: Check if tests passed and no regressions
run: |
# Skip PR if any test stage failed
# Skip PR if any required stage failed
# test-kselftest is optional when skip_kselftests is true (result will be 'skipped')
KSELFTEST_RESULT="${{ needs.test-kselftest.result }}"
if [ "${{ needs.build.result }}" != "success" ] || \
[ "${{ needs.boot.result }}" != "success" ] || \
[ "${{ needs.test-kselftest.result }}" != "success" ]; then
( [ "$KSELFTEST_RESULT" != "success" ] && [ "$KSELFTEST_RESULT" != "skipped" ] ); then
echo "One or more test stages failed, skipping PR creation"
exit 1
fi
Expand Down Expand Up @@ -649,14 +663,14 @@ jobs:
path: artifacts/boot/aarch64

- name: Download kselftest logs (x86_64)
if: steps.detect_arch.outputs.has_x86_64 == 'true'
if: steps.detect_arch.outputs.has_x86_64 == 'true' && !inputs.skip_kselftests
uses: actions/download-artifact@v4
with:
name: kselftest-logs-x86_64
path: artifacts/test/x86_64

- name: Download kselftest logs (aarch64)
if: steps.detect_arch.outputs.has_aarch64 == 'true'
if: steps.detect_arch.outputs.has_aarch64 == 'true' && !inputs.skip_kselftests
uses: actions/download-artifact@v4
with:
name: kselftest-logs-aarch64
Expand All @@ -669,23 +683,23 @@ jobs:
HAS_ARM="${{ steps.detect_arch.outputs.has_aarch64 }}"

# x86_64 stats
if [ "$HAS_X86" = "true" ]; then
if [ "$HAS_X86" = "true" ] && ls artifacts/test/x86_64/kselftests-*.log 1>/dev/null 2>&1; 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"
PASSED_X86="N/A"
FAILED_X86="N/A"
fi
echo "passed_x86_64=$PASSED_X86" >> $GITHUB_OUTPUT
echo "failed_x86_64=$FAILED_X86" >> $GITHUB_OUTPUT

# aarch64 stats
if [ "$HAS_ARM" = "true" ]; then
if [ "$HAS_ARM" = "true" ] && ls artifacts/test/aarch64/kselftests-*.log 1>/dev/null 2>&1; 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"
PASSED_ARM="N/A"
FAILED_ARM="N/A"
fi
echo "passed_aarch64=$PASSED_ARM" >> $GITHUB_OUTPUT
echo "failed_aarch64=$FAILED_ARM" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -783,6 +797,12 @@ jobs:
COMPARISON_STATUS_X86="${{ needs.compare-results.outputs.comparison_status_x86_64 }}"
COMPARISON_STATUS_ARM="${{ needs.compare-results.outputs.comparison_status_aarch64 }}"

# When kselftests are skipped, comparison step doesn't run so status is empty — treat as skipped
if [ "${{ inputs.skip_kselftests }}" = "true" ]; then
[ -z "$COMPARISON_STATUS_X86" ] && COMPARISON_STATUS_X86="skipped"
[ -z "$COMPARISON_STATUS_ARM" ] && COMPARISON_STATUS_ARM="skipped"
fi

# Create comparison section - use printf to avoid code block formatting
COMPARISON_SECTION="### Test Comparison"

Expand Down
Loading