Skip to content

Commit 74e2d30

Browse files
committed
Add ABI checker to CI
It's not currently working because master does not check against ABI. Only released versions >= 2.4
1 parent 100db3d commit 74e2d30

File tree

2 files changed

+81
-0
lines changed

2 files changed

+81
-0
lines changed

.github/workflows/linux.build.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,12 @@ jobs:
2020
- name: Run Linux C++11
2121
working-directory: ./
2222
run: ./Scripts/BuildScripts/build_ci_linux.sh
23+
- name: ABI Checker Report Generation
24+
if: ${{ github.base_ref != 'master' }}
25+
run: ./Scripts/BuildScripts/abi_checker.sh 2 $GITHUB_BASE_REF
26+
- name: ABI Checker Upload
27+
uses: actions/upload-artifact@v2
28+
if: ${{ github.base_ref != 'master' }}
29+
with:
30+
name: abi-checker-reports
31+
path: ./build/Debug/lib/compat_reports

Scripts/BuildScripts/abi_checker.sh

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#!/bin/bash
2+
3+
# Usage:
4+
#
5+
# Scripts/BuildScripts/abi_checker.sh 2 branch_name
6+
#
7+
# Where 2 is the lver
8+
# branch_name is optional and is the name of the git branch
9+
10+
cd build/Debug/lib
11+
mkdir -p AbiDump/$1
12+
13+
if [ -z $2 ]; then
14+
branch_name=`git branch --show-current`
15+
else
16+
# Pull Requests can't use git branch, so Github provides it for us
17+
branch_name=$2
18+
fi
19+
20+
#if [[ $branch_name == "master" && $1 != 1 ]]; then
21+
# echo "We're in master. Master does not do ABI checks. We're done."
22+
# exit
23+
#fi
24+
25+
if [[ $1 != 1 ]]; then
26+
echo "--- Fetching base dumps to compare against ---"
27+
wget https://github.com/OGRECave/ogre-next/releases/download/bin-releases/AbiDumps_Ubuntu.18.04.LTS.$2.7z
28+
29+
echo "--- Extracting base dumps ---"
30+
7z x AbiDumps_Ubuntu.18.04.LTS.$2.7z
31+
fi
32+
33+
sudo apt-get install -y abi-compliance-checker
34+
35+
# Dump the libs
36+
FILES="*.so*"
37+
for file in $FILES
38+
do
39+
# Ignore symlinks
40+
if ! [[ -L "$file" ]]; then
41+
echo "Dumping $file"
42+
abi-dumper "$file" -o "AbiDump/$1/$file.dump" -lver $1 &
43+
fi
44+
done
45+
46+
wait
47+
48+
# Generate all reports. We need to gather their exit codes to see if they've failed
49+
PIDs=()
50+
for file in $FILES
51+
do
52+
# Ignore symlinks
53+
if ! [[ -L "$file" ]]; then
54+
echo "Checking AbiDump/1/$file.dump vs AbiDump/$1/$file.dump"
55+
abi-compliance-checker -l "$file" -old "AbiDump/1/$file.dump" -new "AbiDump/$1/$file.dump" &
56+
PIDs+=($!)
57+
fi
58+
done
59+
60+
EXIT_CODE=0
61+
for pid in "${PIDs[@]}"
62+
do
63+
echo Waiting for $pid
64+
wait "$pid"
65+
CODE="$?"
66+
if [[ "${CODE}" != "0" ]]; then
67+
echo "At least one report failed with exit code => ${CODE}";
68+
EXIT_CODE=1;
69+
fi
70+
done
71+
72+
exit $EXIT_CODE

0 commit comments

Comments
 (0)