[SWDEV-527430] Fixed Mainline ABI Check (#310)

Signed-off-by: Justin Williams <Justin.Williams@amd.com>

[ROCm/amdsmi commit: 661989c339]
Αυτή η υποβολή περιλαμβάνεται σε:
Williams, Justin
2025-04-24 08:21:34 -07:00
υποβλήθηκε από GitHub
γονέας 58a16a1998
υποβολή d668c1e9f5
2 αρχεία άλλαξαν με 85 προσθήκες και 52 διαγραφές
+34 -31
Προβολή Αρχείου
@@ -19,7 +19,7 @@ on:
permissions:
contents: read
pull-requests: write
pull-requests: write
jobs:
check-abi:
@@ -39,7 +39,7 @@ jobs:
- name: Checkout feature branch
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref || github.ref_name }}
ref: ${{ github.head_ref }}
submodules: true
- name: Copy feature branch file as new
@@ -48,51 +48,54 @@ jobs:
- name: Fetch old file
run: |
if [ "${{ github.event_name }}" = "push" ] && [ "${{ github.ref_name }}" = "amd-mainline" ]; then
# Push to amd-mainline: use amd-mainline as old
git fetch origin amd-mainline:amd-mainline
git checkout amd-mainline -- include/amd_smi/amdsmi.h
# Print debug info
echo "Pull request base branch: ${{ github.base_ref }}"
echo "Pull request head branch: ${{ github.head_ref }}"
# Fetch the appropriate base branch
if [ "${{ github.base_ref }}" = "amd-mainline" ]; then
# Pull request to amd-mainline: use amd-mainline as old
git fetch origin amd-mainline
git checkout FETCH_HEAD -- include/amd_smi/amdsmi.h
mv include/amd_smi/amdsmi.h amdsmi_old.h
# Overwrite new with amd-staging
git fetch origin amd-staging:amd-staging
git checkout amd-staging -- include/amd_smi/amdsmi.h
mv include/amd_smi/amdsmi.h amdsmi_new.h
else
# Default: use amd-staging as old
git fetch origin amd-staging:amd-staging
git checkout amd-staging -- include/amd_smi/amdsmi.h
elif [ "${{ github.base_ref }}" = "amd-staging" ]; then
# Pull request to amd-staging: use amd-staging as old
git fetch origin amd-staging
git checkout FETCH_HEAD -- include/amd_smi/amdsmi.h
mv include/amd_smi/amdsmi.h amdsmi_old.h
fi
- name: Run ABI Compliance Check
id: abi-check
run: |
# Run checker and capture exit code in a single step
if [ "${{ github.event_name }}" = "push" ] && [ "${{ github.ref_name }}" = "amd-mainline" ]; then
abi-compliance-checker -lib amdsmi -old amdsmi_old.h -new amdsmi_new.h -v1 amd-mainline -v2 amd-staging -report-path abi-report.html || { EXIT_CODE=$?; echo "abi_exit_code=$EXIT_CODE" > $GITHUB_WORKSPACE/abi_status.txt; exit $EXIT_CODE; }
else
abi-compliance-checker -lib amdsmi -old amdsmi_old.h -new amdsmi_new.h -v1 amd-staging -v2 ${{ github.ref_name }} -report-path abi-report.html || { EXIT_CODE=$?; echo "abi_exit_code=$EXIT_CODE" > $GITHUB_WORKSPACE/abi_status.txt; exit $EXIT_CODE; }
# Create a status file with default failure
echo "abi_exit_code=1" > $GITHUB_WORKSPACE/abi_status.txt
if [ "${{ github.base_ref }}" = "amd-mainline" ]; then
echo "Comparing amd-mainline (old) with ${{ github.head_ref }} (new)"
abi-compliance-checker -lib amdsmi -old amdsmi_old.h -new amdsmi_new.h -v1 amd-mainline -v2 ${{ github.head_ref }} -report-path abi-report.html && echo "abi_exit_code=0" > $GITHUB_WORKSPACE/abi_status.txt
elif [ "${{ github.base_ref }}" = "amd-staging" ]; then
echo "Comparing amd-staging (old) with ${{ github.head_ref }} (new)"
abi-compliance-checker -lib amdsmi -old amdsmi_old.h -new amdsmi_new.h -v1 amd-staging -v2 ${{ github.head_ref }} -report-path abi-report.html && echo "abi_exit_code=0" > $GITHUB_WORKSPACE/abi_status.txt
fi
# If successful, write exit code 0
echo "abi_exit_code=0" > $GITHUB_WORKSPACE/abi_status.txt
echo "ABI check wrote exit code to $GITHUB_WORKSPACE/abi_status.txt"
continue-on-error: true
- name: Display ABI Check Logs
if: always()
run: |
echo "Displaying ABI compliance check logs for ${{ github.ref_name }}"
if [ -f logs/amdsmi/${{ github.ref_name }}/log.txt ]; then
cat logs/amdsmi/${{ github.ref_name }}/log.txt
else
echo "No ABI check log found at logs/amdsmi/${{ github.ref_name }}/log.txt"
fi
echo "Displaying ABI compliance check logs"
find logs -type f -name "*.txt" -exec cat {} \;
- name: Label PR as ABI BREAKAGE
if: github.event_name == 'pull_request' && steps.abi-check.outcome == 'failure'
if: always() && github.event_name == 'pull_request'
run: |
echo "ABI check failed, adding ABI BREAKAGE label to PR #${{ github.event.pull_request.number }}"
gh pr edit ${{ github.event.pull_request.number }} --add-label "ABI BREAKAGE"
if [ -f $GITHUB_WORKSPACE/abi_status.txt ]; then
source $GITHUB_WORKSPACE/abi_status.txt
if [ "$abi_exit_code" -ne 0 ]; then
echo "ABI check failed, adding ABI BREAKAGE label to PR #${{ github.event.pull_request.number }}"
gh pr edit ${{ github.event.pull_request.number }} --add-label "ABI BREAKAGE"
fi
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+51 -21
Προβολή Αρχείου
@@ -44,23 +44,41 @@ jobs:
- name: Copy feature branch file as new
run: |
cp include/amd_smi/amdsmi.h amdsmi_new.h
- name: Fetch old file
run: |
if [ "${{ github.event_name }}" = "push" ] && [ "${{ github.ref_name }}" = "amd-mainline" ]; then
# Push to amd-mainline: use amd-mainline as old
git fetch origin amd-mainline:amd-mainline
git checkout amd-mainline -- include/amd_smi/amdsmi.h
mv include/amd_smi/amdsmi.h amdsmi_old.h
# Overwrite new with amd-staging
git fetch origin amd-staging:amd-staging
git checkout amd-staging -- include/amd_smi/amdsmi.h
mv include/amd_smi/amdsmi.h amdsmi_new.h
else
# Default: use amd-staging as old
git fetch origin amd-staging:amd-staging
git checkout amd-staging -- include/amd_smi/amdsmi.h
mv include/amd_smi/amdsmi.h amdsmi_old.h
# Print debug info
echo "Pull request base branch: ${{ github.base_ref }}"
echo "Pull request head branch: ${{ github.head_ref }}"
if [ "${{ github.event_name }}" = "pull_request" ]; then
# For pull requests, use the target branch as the old file
if [ "${{ github.base_ref }}" = "amd-mainline" ]; then
# Pull request to amd-mainline: use amd-mainline as old
git fetch origin amd-mainline
git checkout FETCH_HEAD -- include/amd_smi/amdsmi.h
mv include/amd_smi/amdsmi.h amdsmi_old.h
elif [ "${{ github.base_ref }}" = "amd-staging" ]; then
# Pull request to amd-staging: use amd-staging as old
git fetch origin amd-staging
git checkout FETCH_HEAD -- include/amd_smi/amdsmi.h
mv include/amd_smi/amdsmi.h amdsmi_old.h
fi
elif [ "${{ github.event_name }}" = "push" ]; then
# For pushes, determine which branch was pushed to
if [ "${{ github.ref_name }}" = "amd-mainline" ]; then
# Push to amd-mainline: use amd-mainline as old
git fetch origin amd-mainline
git checkout FETCH_HEAD -- include/amd_smi/amdsmi.h
mv include/amd_smi/amdsmi.h amdsmi_old.h
elif [ "${{ github.ref_name }}" = "amd-staging" ]; then
# Push to amd-staging: use amd-staging as old
git fetch origin amd-staging
git checkout FETCH_HEAD -- include/amd_smi/amdsmi.h
mv include/amd_smi/amdsmi.h amdsmi_old.h
fi
fi
- name: Run ABI Compliance Check
id: abi-check
run: |
@@ -80,14 +98,26 @@ jobs:
</libs>
</descriptor>
EOF
# Run checker and capture exit code in a single step
if [ "${{ github.event_name }}" = "push" ] && [ "${{ github.ref_name }}" = "amd-mainline" ]; then
COMPARE_MSG="amd-mainline vs amd-staging"
abi-compliance-checker -l amdsmi -old amdsmi_old.h -new amdsmi_new.h -v1 amd-mainline -v2 amd-staging -report-path abi-report.html -strict || { EXIT_CODE=$?; echo "abi_exit_code=$EXIT_CODE" > $GITHUB_WORKSPACE/abi_status.txt; exit $EXIT_CODE; }
else
COMPARE_MSG="amd-staging vs ${{ github.ref_name }}"
abi-compliance-checker -l amdsmi -old amdsmi_old.h -new amdsmi_new.h -v1 amd-staging -v2 ${{ github.ref_name }} -report-path abi-report.html -strict || { EXIT_CODE=$?; echo "abi_exit_code=$EXIT_CODE" > $GITHUB_WORKSPACE/abi_status.txt; exit $EXIT_CODE; }
# Set comparison message and run the appropriate check
if [ "${{ github.event_name }}" = "pull_request" ]; then
if [ "${{ github.base_ref }}" = "amd-mainline" ]; then
COMPARE_MSG="amd-mainline vs ${{ github.head_ref }}"
abi-compliance-checker -l amdsmi -old amdsmi_old.h -new amdsmi_new.h -v1 amd-mainline -v2 ${{ github.head_ref }} -report-path abi-report.html -strict || { EXIT_CODE=$?; echo "abi_exit_code=$EXIT_CODE" > $GITHUB_WORKSPACE/abi_status.txt; exit $EXIT_CODE; }
elif [ "${{ github.base_ref }}" = "amd-staging" ]; then
COMPARE_MSG="amd-staging vs ${{ github.head_ref }}"
abi-compliance-checker -l amdsmi -old amdsmi_old.h -new amdsmi_new.h -v1 amd-staging -v2 ${{ github.head_ref }} -report-path abi-report.html -strict || { EXIT_CODE=$?; echo "abi_exit_code=$EXIT_CODE" > $GITHUB_WORKSPACE/abi_status.txt; exit $EXIT_CODE; }
fi
elif [ "${{ github.event_name }}" = "push" ]; then
if [ "${{ github.ref_name }}" = "amd-mainline" ]; then
COMPARE_MSG="amd-mainline vs amd-staging"
abi-compliance-checker -l amdsmi -old amdsmi_old.h -new amdsmi_new.h -v1 amd-mainline -v2 amd-staging -report-path abi-report.html -strict || { EXIT_CODE=$?; echo "abi_exit_code=$EXIT_CODE" > $GITHUB_WORKSPACE/abi_status.txt; exit $EXIT_CODE; }
elif [ "${{ github.ref_name }}" = "amd-staging" ]; then
COMPARE_MSG="amd-staging vs ${{ github.ref_name }}"
abi-compliance-checker -l amdsmi -old amdsmi_old.h -new amdsmi_new.h -v1 amd-staging -v2 ${{ github.ref_name }} -report-path abi-report.html -strict || { EXIT_CODE=$?; echo "abi_exit_code=$EXIT_CODE" > $GITHUB_WORKSPACE/abi_status.txt; exit $EXIT_CODE; }
fi
fi
# If the report was generated, check for ANY changes
if [ -f abi-report.html ]; then
echo "Report generated successfully"