7aa45b2f55
Signed-off-by: Justin Williams <Justin.Williams@amd.com>
173 строки
7.0 KiB
YAML
173 строки
7.0 KiB
YAML
name: Strict ABI Compliance Check
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- amd-staging
|
|
- amd-mainline
|
|
- release/rocm-rel-*
|
|
paths:
|
|
- 'include/amd_smi/amdsmi.h'
|
|
push:
|
|
branches:
|
|
- amd-staging
|
|
- amd-mainline
|
|
- 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: |
|
|
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
|
|
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
|
|
# 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; }
|
|
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 "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 "ABI check failed with exit code $abi_exit_code. Check logs for more Details."
|
|
exit 1
|
|
else
|
|
echo "ABI check succeeded"
|
|
fi
|
|
else
|
|
echo "ABI status file not found at $GITHUB_WORKSPACE/abi_status.txt, assuming failure"
|
|
exit 1
|
|
fi
|