[gnome-panel/wip/muktupavels/api-break] ci: check ABI




commit 2528d3cf7a7bd3caefd6e5b5c302cdfecbd13108
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Mon May 31 22:02:08 2021 +0300

    ci: check ABI

 .gitlab-ci.yml | 22 ++++++++++++++++++++++
 check-abi      | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 74 insertions(+)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 39f7c3927..f1972a904 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -4,6 +4,7 @@ stages:
 
 variables:
   DEBIAN_FRONTEND: noninteractive
+  LAST_ABI_BREAK: 841fe4e32ff9
 
 .install-ubuntu-dependencies: &install-ubuntu-dependencies
   apt-get install -q -y --no-install-recommends
@@ -51,6 +52,27 @@ ubuntu:
     - make
     - make distcheck
 
+check-abi:
+  image: ubuntu:devel
+  stage: build
+  except:
+    - tags
+  before_script:
+    - apt-get update
+    - *install-ubuntu-dependencies
+    - apt-get install -q -y --no-install-recommends
+                      abi-compliance-checker
+                      abi-dumper
+                      git
+  variables:
+    CFLAGS: "-g -Og"
+  script:
+    - ./check-abi ${LAST_ABI_BREAK} $(git rev-parse --short=12 HEAD)
+  artifacts:
+    paths:
+      - compat_reports/libgnome-panel/
+    when: always
+
 coverity:
   image: ubuntu:devel
   stage: analysis
diff --git a/check-abi b/check-abi
new file mode 100755
index 000000000..2efdad780
--- /dev/null
+++ b/check-abi
@@ -0,0 +1,52 @@
+#!/usr/bin/python3
+
+import argparse
+import os
+import subprocess
+import sys
+
+def dump_abi(revision):
+  install_dir = os.path.normpath(os.path.join(os.getcwd(), 'install', revision))
+  build_dir = os.path.normpath(os.path.join(os.getcwd(), 'build', revision))
+  lib_dir = os.path.join(build_dir, 'libgnome-panel')
+
+  os.makedirs(build_dir)
+  subprocess.check_call(['git', 'checkout', '-q', revision])
+  subprocess.check_call([
+    '../../autogen.sh',
+    '--prefix=' + install_dir,
+    '--enable-debug=no'
+  ], cwd=build_dir)
+  subprocess.check_call(['make'], cwd=lib_dir)
+  subprocess.check_call(['make', 'install'], cwd=lib_dir)
+
+  subprocess.check_call([
+    'abi-dumper',
+    os.path.join(install_dir, 'lib', 'libgnome-panel.so'),
+    '-public-headers', os.path.join(install_dir, 'include'),
+    '-o', revision + '.dump'
+  ])
+
+  return revision + '.dump'
+
+parser = argparse.ArgumentParser()
+parser.add_argument('old')
+parser.add_argument('new')
+args = parser.parse_args()
+
+if args.old == args.new:
+  sys.exit(0)
+
+try:
+  new_abi = dump_abi(args.new)
+  old_abi = dump_abi(args.old)
+
+  subprocess.check_call([
+    'abi-compliance-checker',
+    '-l', 'libgnome-panel',
+    '-old', old_abi,
+    '-new', new_abi
+  ])
+except subprocess.CalledProcessError as e:
+  print(e.output)
+  sys.exit(e.returncode)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]