Skip to content

Commit

Permalink
Add ABI checker to CI
Browse files Browse the repository at this point in the history
It's not currently working because master does not check against ABI.
Only released versions >= 2.4
  • Loading branch information
darksylinc committed Mar 28, 2022
1 parent 100db3d commit 74e2d30
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/linux.build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,12 @@ jobs:
- name: Run Linux C++11
working-directory: ./
run: ./Scripts/BuildScripts/build_ci_linux.sh
- name: ABI Checker Report Generation
if: ${{ github.base_ref != 'master' }}
run: ./Scripts/BuildScripts/abi_checker.sh 2 $GITHUB_BASE_REF
- name: ABI Checker Upload
uses: actions/upload-artifact@v2
if: ${{ github.base_ref != 'master' }}
with:
name: abi-checker-reports
path: ./build/Debug/lib/compat_reports
72 changes: 72 additions & 0 deletions Scripts/BuildScripts/abi_checker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/bin/bash

# Usage:
#
# Scripts/BuildScripts/abi_checker.sh 2 branch_name
#
# Where 2 is the lver
# branch_name is optional and is the name of the git branch

cd build/Debug/lib
mkdir -p AbiDump/$1

if [ -z $2 ]; then
branch_name=`git branch --show-current`
else
# Pull Requests can't use git branch, so Github provides it for us
branch_name=$2
fi

#if [[ $branch_name == "master" && $1 != 1 ]]; then
# echo "We're in master. Master does not do ABI checks. We're done."
# exit
#fi

if [[ $1 != 1 ]]; then
echo "--- Fetching base dumps to compare against ---"
wget https://github.com/OGRECave/ogre-next/releases/download/bin-releases/AbiDumps_Ubuntu.18.04.LTS.$2.7z

echo "--- Extracting base dumps ---"
7z x AbiDumps_Ubuntu.18.04.LTS.$2.7z
fi

sudo apt-get install -y abi-compliance-checker

# Dump the libs
FILES="*.so*"
for file in $FILES
do
# Ignore symlinks
if ! [[ -L "$file" ]]; then
echo "Dumping $file"
abi-dumper "$file" -o "AbiDump/$1/$file.dump" -lver $1 &
fi
done

wait

# Generate all reports. We need to gather their exit codes to see if they've failed
PIDs=()
for file in $FILES
do
# Ignore symlinks
if ! [[ -L "$file" ]]; then
echo "Checking AbiDump/1/$file.dump vs AbiDump/$1/$file.dump"
abi-compliance-checker -l "$file" -old "AbiDump/1/$file.dump" -new "AbiDump/$1/$file.dump" &
PIDs+=($!)
fi
done

EXIT_CODE=0
for pid in "${PIDs[@]}"
do
echo Waiting for $pid
wait "$pid"
CODE="$?"
if [[ "${CODE}" != "0" ]]; then
echo "At least one report failed with exit code => ${CODE}";
EXIT_CODE=1;
fi
done

exit $EXIT_CODE

0 comments on commit 74e2d30

Please sign in to comment.