Skip to content

firmware: arm_scpi: Ensure scpi_info is not assigned if the probe fails #18

firmware: arm_scpi: Ensure scpi_info is not assigned if the probe fails

firmware: arm_scpi: Ensure scpi_info is not assigned if the probe fails #18

name: Automated kernel build and test (x86_64)
on: [push]
permissions:
contents: read
actions: read
packages: read
jobs:
build:
name: Build kernel
runs-on: kernel-build
steps:
- name: Checkout kernel source
uses: actions/checkout@v4
with:
fetch-depth: 1
path: kernel-src-tree
- name: Checkout kernel-container-build (test branch)
uses: actions/checkout@v4
with:
repository: ctrliq/kernel-container-build
ref: maximize-kselftest-coverage
path: kernel-container-build
token: ${{ secrets.PRIVATE_REPO_ACCESS_TOKEN }}
# Host deps + KVM / FUSE validation
- name: Install host dependencies & verify KVM/FUSE
run: |
set -euxo pipefail
sudo apt-get update
sudo apt-get install -y fuse3 cpu-checker podman
sudo modprobe fuse # guarantee /dev/fuse
if ! sudo kvm-ok ; then
echo "::warning::KVM acceleration not available on this runner."
fi
if [ -e /dev/kvm ]; then
sudo chmod 0666 /dev/kvm
fi
# Kernel build inside CIQ builder (build only, no test)
- name: Build kernel inside CIQ builder container
run: |
set -euxo pipefail
mkdir -p output
df -h
cat /proc/cpuinfo
chmod +x kernel-container-build/build-container/*.sh
podman run --rm --pull=always \
--privileged \
--device=/dev/fuse \
$([ -e /dev/kvm ] && echo "--device=/dev/kvm") \
-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/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 \
pulp.prod.ciq.dev/ciq/cicd/lts-images/builder \
/usr/local/build-scripts/build_kernel.sh -c lts-9.2-kernel-builder 2>&1 | tee output/kernel-build.log
sudo dmesg
# Upload kernel compilation logs
- name: Upload kernel compilation logs
uses: actions/upload-artifact@v4
if: always()
with:
name: kernel-compilation-logs-x86_64
path: output/kernel-build.log
retention-days: 7
# Upload qcow2 image for next stages
- name: Upload qcow2 image
uses: actions/upload-artifact@v4
if: always()
with:
name: kernel-qcow2-image-x86_64
path: |
output/*.qcow2
output/last_build_image.txt
retention-days: 7
boot:
name: Boot verification
runs-on: kernel-build
needs: build
steps:
- name: Checkout kernel-container-build (test branch)
uses: actions/checkout@v4
with:
repository: ctrliq/kernel-container-build
ref: maximize-kselftest-coverage
path: kernel-container-build
token: ${{ secrets.PRIVATE_REPO_ACCESS_TOKEN }}
- name: Install host dependencies
run: |
set -euxo pipefail
sudo apt-get update
sudo apt-get install -y fuse3 cpu-checker podman
sudo modprobe fuse
if [ -e /dev/kvm ]; then
sudo chmod 0666 /dev/kvm
fi
- name: Download qcow2 image
uses: actions/download-artifact@v4
with:
name: kernel-qcow2-image-x86_64
path: output
# Boot verification test
- name: Boot kernel and verify
run: |
set -euxo pipefail
chmod +x kernel-container-build/build-container/*.sh
podman run --rm --pull=always \
--privileged \
--device=/dev/fuse \
$([ -e /dev/kvm ] && echo "--device=/dev/kvm") \
-v "$PWD/output":/output \
-v "$PWD/kernel-container-build/build-container":/usr/local/build-scripts:ro \
--security-opt label=disable \
pulp.prod.ciq.dev/ciq/cicd/lts-images/builder \
/usr/local/build-scripts/boot_kernel.sh
# Upload boot logs
- name: Upload boot logs
uses: actions/upload-artifact@v4
if: always()
with:
name: boot-logs-x86_64
path: output/boot-*.log
retention-days: 7
test-kselftest:
name: Run kselftests
runs-on: kernel-build
needs: boot
steps:
- name: Checkout kernel-container-build (test branch)
uses: actions/checkout@v4
with:
repository: ctrliq/kernel-container-build
ref: maximize-kselftest-coverage
path: kernel-container-build
token: ${{ secrets.PRIVATE_REPO_ACCESS_TOKEN }}
- name: Install host dependencies
run: |
set -euxo pipefail
sudo apt-get update
sudo apt-get install -y fuse3 cpu-checker podman
sudo modprobe fuse
if [ -e /dev/kvm ]; then
sudo chmod 0666 /dev/kvm
fi
- name: Download qcow2 image
uses: actions/download-artifact@v4
with:
name: kernel-qcow2-image-x86_64
path: output
# Run kselftests
- name: Execute kselftests
run: |
set -euxo pipefail
chmod +x kernel-container-build/build-container/*.sh
podman run --rm --pull=always \
--privileged \
--device=/dev/fuse \
$([ -e /dev/kvm ] && echo "--device=/dev/kvm") \
-v "$PWD/output":/output \
-v "$PWD/kernel-container-build/build-container":/usr/local/build-scripts:ro \
--security-opt label=disable \
pulp.prod.ciq.dev/ciq/cicd/lts-images/builder \
/usr/local/build-scripts/test_kselftests.sh
# Upload kselftest logs
- name: Upload kselftest logs
uses: actions/upload-artifact@v4
if: always()
with:
name: kselftest-logs-x86_64
path: |
output/kselftests-*.log
output/dmesg-*.log
retention-days: 7
compare-results:
name: Compare with previous run
runs-on: kernel-build
needs: test-kselftest
if: success() || failure()
steps:
- name: Download current kselftest logs
uses: actions/download-artifact@v4
with:
name: kselftest-logs-x86_64
path: output-current
- name: Download previous kselftest logs
uses: dawidd6/action-download-artifact@v3
with:
workflow: kernel-build-and-test-x86_64.yml
name: kselftest-logs-x86_64
path: output-previous
branch: ${{ github.ref_name }}
workflow_conclusion: success
search_artifacts: true
skip_unpack: false
if_no_artifact_found: warn
continue-on-error: true
- name: Compare test results
run: |
if [ -f output-previous/kselftests-*.log ]; then
# Compare passing tests (ok)
BEFORE_PASS=$(grep -a '^ok' output-previous/kselftests-*.log | wc -l)
AFTER_PASS=$(grep -a '^ok' output-current/kselftests-*.log | wc -l)
# Compare failing tests (not ok)
BEFORE_FAIL=$(grep -a '^not ok' output-previous/kselftests-*.log | wc -l)
AFTER_FAIL=$(grep -a '^not ok' output-current/kselftests-*.log | wc -l)
echo "### Kselftest Comparison (Branch: ${{ github.ref_name }})"
echo "Passing tests: $BEFORE_PASS -> $AFTER_PASS"
echo "Failing tests: $BEFORE_FAIL -> $AFTER_FAIL"
# Calculate differences
PASS_DIFF=$((AFTER_PASS - BEFORE_PASS))
FAIL_DIFF=$((AFTER_FAIL - BEFORE_FAIL))
echo "Pass difference: $PASS_DIFF"
echo "Fail difference: $FAIL_DIFF"
# Check for regression (more than 3 tests difference)
REGRESSION=0
if [ $PASS_DIFF -lt -3 ]; then
echo "::error::Regression detected: $PASS_DIFF passing tests (threshold: -3)"
REGRESSION=1
fi
if [ $FAIL_DIFF -gt 3 ]; then
echo "::error::Regression detected: +$FAIL_DIFF failing tests (threshold: +3)"
REGRESSION=1
fi
if [ $REGRESSION -eq 1 ]; then
echo "::error::Test regression exceeds acceptable threshold of 3 tests"
exit 1
else
echo "::notice::Test results within acceptable range (threshold: ±3 tests)"
fi
else
echo "::warning::No previous successful test results found for branch ${{ github.ref_name }}, skipping comparison"
fi
create-pr:
name: Create Pull Request
runs-on: kernel-build
needs: [build, boot, test-kselftest, compare-results]
if: success()
steps:
- name: Checkout kernel source
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Download kernel compilation logs
uses: actions/download-artifact@v4
with:
name: kernel-compilation-logs-x86_64
path: artifacts/build
- name: Download boot logs
uses: actions/download-artifact@v4
with:
name: boot-logs-x86_64
path: artifacts/boot
- name: Download kselftest logs
uses: actions/download-artifact@v4
with:
name: kselftest-logs-x86_64
path: artifacts/test
- 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
- 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
- name: Get commit information
id: commit_msg
run: |
# Count commits since origin/main (or appropriate base branch)
BASE_BRANCH="main"
if ! git rev-parse origin/$BASE_BRANCH >/dev/null 2>&1; then
# Try other common base branch names
for branch in master lts-9.2 lts-9; do
if git rev-parse origin/$branch >/dev/null 2>&1; then
BASE_BRANCH=$branch
break
fi
done
fi
COMMIT_COUNT=$(git rev-list --count origin/$BASE_BRANCH..HEAD 2>/dev/null || echo "1")
if [ "$COMMIT_COUNT" -eq "1" ]; then
# Single commit: use commit subject
COMMIT_SUBJECT=$(git log -1 --pretty=%s)
echo "commit_subject=$COMMIT_SUBJECT" >> $GITHUB_OUTPUT
COMMIT_MSG=$(git log -1 --pretty=%B)
echo "commit_message<<EOF" >> $GITHUB_OUTPUT
echo "$COMMIT_MSG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
else
# Multiple commits: create summary
echo "commit_subject=Multiple patches tested ($COMMIT_COUNT commits)" >> $GITHUB_OUTPUT
# Get all commit messages
ALL_COMMITS=$(git log origin/$BASE_BRANCH..HEAD --pretty=format:"### %s%n%n%b%n---")
echo "commit_message<<EOF" >> $GITHUB_OUTPUT
echo "$ALL_COMMITS" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
fi
- name: Create Pull Request
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Determine base branch from the upstream tracking branch
BASE_BRANCH=$(git rev-parse --abbrev-ref --symbolic-full-name @{u} 2>/dev/null | sed 's|^origin/||' || echo "")
if [ -z "$BASE_BRANCH" ]; then
# Fallback: use merge-base to find the common ancestor branch
echo "No upstream tracking branch found, using merge-base to find parent branch"
for branch in lts-9.2 lts-9 main master; do
if git rev-parse origin/$branch >/dev/null 2>&1; then
MERGE_BASE=$(git merge-base HEAD origin/$branch 2>/dev/null || echo "")
if [ -n "$MERGE_BASE" ]; then
BASE_BRANCH=$branch
echo "Found common ancestor with origin/$branch"
break
fi
fi
done
fi
if [ -z "$BASE_BRANCH" ]; then
echo "ERROR: Could not determine base branch for PR"
exit 1
fi
echo "Creating PR from ${{ github.ref_name }} to $BASE_BRANCH"
# Create PR body
cat > pr_body.md << 'EOF'
## Summary
This PR has been automatically created after successful completion of all CI stages.
## Commit Message(s)
```
${{ steps.commit_msg.outputs.commit_message }}
```
## Test Results
### ✅ Build Stage
- Status: Passed
- Build Time: ${{ steps.build_info.outputs.build_time }}
- Total Time: ${{ steps.build_info.outputs.total_time }}
- [View build logs](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
### ✅ Boot Verification
- Status: Passed
- [View boot logs](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
### ✅ Kernel Selftests
- **Passed:** ${{ steps.stats.outputs.passed }}
- **Failed:** ${{ steps.stats.outputs.failed }}
- [View kselftest logs](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
### ✅ Test Comparison
- Comparison against previous run: Within acceptable threshold (±3 tests)
- Branch: ${{ github.ref_name }}
---
🤖 This PR was automatically generated by GitHub Actions
Run ID: ${{ github.run_id }}
EOF
# Check if PR already exists
EXISTING_PR=$(gh pr list --head "${{ github.ref_name }}" --base "$BASE_BRANCH" --json number --jq '.[0].number' || echo "")
if [ -n "$EXISTING_PR" ]; then
echo "PR #$EXISTING_PR already exists, updating it"
gh pr edit "$EXISTING_PR" \
--title "[${{ github.ref_name }}] ${{ steps.commit_msg.outputs.commit_subject }}" \
--body-file pr_body.md
else
echo "Creating new PR from ${{ github.ref_name }} to $BASE_BRANCH"
gh pr create \
--base "$BASE_BRANCH" \
--head "${{ github.ref_name }}" \
--title "[${{ github.ref_name }}] ${{ steps.commit_msg.outputs.commit_subject }}" \
--body-file pr_body.md \
--label "automated,tested,ready-for-review"
fi