From 74e2d30130727edcafc09a53cf3d99cded368d0d Mon Sep 17 00:00:00 2001 From: "Matias N. Goldberg" Date: Sun, 27 Mar 2022 22:58:54 -0300 Subject: [PATCH] Add ABI checker to CI It's not currently working because master does not check against ABI. Only released versions >= 2.4 --- .github/workflows/linux.build.yml | 9 ++++ Scripts/BuildScripts/abi_checker.sh | 72 +++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100755 Scripts/BuildScripts/abi_checker.sh diff --git a/.github/workflows/linux.build.yml b/.github/workflows/linux.build.yml index 0a2b84f0c66..9d8bc5a1060 100644 --- a/.github/workflows/linux.build.yml +++ b/.github/workflows/linux.build.yml @@ -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 diff --git a/Scripts/BuildScripts/abi_checker.sh b/Scripts/BuildScripts/abi_checker.sh new file mode 100755 index 00000000000..9e24b8b1439 --- /dev/null +++ b/Scripts/BuildScripts/abi_checker.sh @@ -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 \ No newline at end of file