Files
rocm-systems/.github/workflows/abi-check.yml
T
Williams, Justin 661989c339 [SWDEV-527430] Fixed Mainline ABI Check (#310)
Signed-off-by: Justin Williams <Justin.Williams@amd.com>
2025-04-24 10:21:34 -05:00

126 lines
4.5 KiB
YAML

name: 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 }}
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-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
- 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-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
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 "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 "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