Files
rocm-systems/.github/workflows/abi-check.yml
T
2025-05-05 18:41:46 -05:00

117 行
4.0 KiB
YAML

name: Major 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 }}
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 }}"
# Fetch the appropriate base branch
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
- name: Run ABI Compliance Check
id: abi-check
run: |
# Create a status file with default failure
echo "abi_exit_code=1" > $GITHUB_WORKSPACE/abi_status.txt
if [ "${{ 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
continue-on-error: true
- name: Display ABI Check Logs
if: always()
run: |
echo "Displaying ABI compliance check logs"
find logs -type f -name "*.txt" -exec cat {} \;
- name: Label PR as ABI BREAKAGE
if: always() && github.event_name == 'pull_request'
run: |
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 "MAJOR ABI BREAKAGE"
fi
fi
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::⚠️ ABI BREAKAGE 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 "ABI status file not found at $GITHUB_WORKSPACE/abi_status.txt, assuming failure"
exit 1
fi