1d89ec207b
Signed-off-by: Justin Williams <Justin.Williams@amd.com>
186 行
7.6 KiB
YAML
186 行
7.6 KiB
YAML
name: Minor ABI Compliance Check
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- amd-staging
|
|
- release/rocm-rel-*
|
|
paths:
|
|
- 'include/amd_smi/amdsmi.h'
|
|
push:
|
|
branches:
|
|
- amd-staging
|
|
- release/rocm-rel-*
|
|
paths:
|
|
- 'include/amd_smi/amdsmi.h'
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
check-abi:
|
|
runs-on: lstt5
|
|
steps:
|
|
- name: Setup Environment
|
|
run: |
|
|
sudo rm -rf $GITHUB_WORKSPACE/* || true
|
|
sudo rm -rf $GITHUB_WORKSPACE/.[!.]* || true
|
|
sudo apt-get update
|
|
sudo apt-get install -y perl build-essential git universal-ctags
|
|
git clone https://github.com/lvc/abi-compliance-checker.git
|
|
cd abi-compliance-checker
|
|
sudo make install
|
|
abi-compliance-checker --version
|
|
- name: Checkout feature branch
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ github.head_ref || github.ref_name }}
|
|
submodules: true
|
|
|
|
- name: Copy feature branch file as new
|
|
run: |
|
|
cp include/amd_smi/amdsmi.h amdsmi_new.h
|
|
|
|
- name: Fetch old file
|
|
run: |
|
|
# 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-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-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: |
|
|
# Create a custom descriptor with strict options
|
|
cat > strict_descriptor.xml << EOF
|
|
<descriptor>
|
|
<libs>
|
|
<lib>
|
|
<name>amdsmi</name>
|
|
<headers>
|
|
<path>amdsmi_old.h</path>
|
|
</headers>
|
|
<skip_headers>
|
|
<symbol>assert.h</symbol>
|
|
</skip_headers>
|
|
</lib>
|
|
</libs>
|
|
</descriptor>
|
|
EOF
|
|
|
|
# Set comparison message and run the appropriate check
|
|
if [ "${{ github.event_name }}" = "pull_request" ]; then
|
|
if [ "${{ 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-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"
|
|
# Check for ANY changes in the ABI by examining specific patterns in the report
|
|
CHANGED=0
|
|
# Check for added symbols
|
|
if grep -q "Added Symbols.*[1-9]" abi-report.html; then
|
|
echo "::error::STRICT ABI CHECK FAILED: Found added symbols comparing $COMPARE_MSG"
|
|
CHANGED=1
|
|
fi
|
|
# Check for removed symbols
|
|
if grep -q "Removed Symbols.*[1-9]" abi-report.html; then
|
|
echo "::error::STRICT ABI CHECK FAILED: Found removed symbols comparing $COMPARE_MSG"
|
|
CHANGED=1
|
|
fi
|
|
# Check for problems with data types
|
|
if grep -q "Problems with.*Data Types.*[1-9]" abi-report.html; then
|
|
echo "::error::STRICT ABI CHECK FAILED: Found problems with data types comparing $COMPARE_MSG"
|
|
CHANGED=1
|
|
fi
|
|
# Check for problems with symbols
|
|
if grep -q "Problems with.*Symbols.*[1-9]" abi-report.html; then
|
|
echo "::error::STRICT ABI CHECK FAILED: Found problems with symbols comparing $COMPARE_MSG"
|
|
CHANGED=1
|
|
fi
|
|
# Check for problems with constants
|
|
if grep -q "Problems with.*Constants.*[1-9]" abi-report.html; then
|
|
echo "::error::STRICT ABI CHECK FAILED: Found problems with constants comparing $COMPARE_MSG"
|
|
CHANGED=1
|
|
fi
|
|
# Fail if any changes were found
|
|
if [ "$CHANGED" -eq 1 ]; then
|
|
echo "abi_exit_code=1" > $GITHUB_WORKSPACE/abi_status.txt
|
|
exit 1
|
|
fi
|
|
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
|
|
- name: Label PR as ABI BREAKAGE
|
|
if: github.event_name == 'pull_request' && steps.abi-check.outcome == 'failure'
|
|
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 "MINOR ABI BREAKAGE"
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Upload ABI Report
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: abi-report
|
|
path: abi-report.html
|
|
|
|
- name: Fail Workflow on ABI Check Failure
|
|
if: always()
|
|
run: |
|
|
echo "Checking ABI check exit code..."
|
|
if [ -f $GITHUB_WORKSPACE/abi_status.txt ]; then
|
|
source $GITHUB_WORKSPACE/abi_status.txt
|
|
echo "ABI check exit code: $abi_exit_code"
|
|
if [ "$abi_exit_code" -ne 0 ]; then
|
|
echo "::error::⚠️ CHANGES TO AMDSMI.H FILE FOUND ⚠️ CHECK \"Run ABI Compliance Check\" LOGS OR THE abi-report ARTIFACT ATTACHED TO THIS WORKFLOW FOR MORE DETAILS"
|
|
echo "::error::View the HTML report in the Artifacts section of this workflow run for detailed ABI compatibility analysis"
|
|
exit 1
|
|
else
|
|
echo "✅ ABI check succeeded"
|
|
fi
|
|
else
|
|
echo "::error::ABI status file not found at $GITHUB_WORKSPACE/abi_status.txt, assuming failure"
|
|
exit 1
|
|
fi
|