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




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

    ci: check ABI

 .gitlab-ci.yml | 23 +++++++++++++++++++++++
 check-abi      | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 75 insertions(+)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 39f7c3927..b455e2ea9 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -4,6 +4,7 @@ stages:
 
 variables:
   DEBIAN_FRONTEND: noninteractive
+  LAST_ABI_BREAK: 841fe4e32ff97b7725694dc60828048fa187f758
 
 .install-ubuntu-dependencies: &install-ubuntu-dependencies
   apt-get install -q -y --no-install-recommends
@@ -51,6 +52,28 @@ 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
+                      universal-ctags
+  variables:
+    CFLAGS: "-g -Og"
+  script:
+    - ./check-abi ${LAST_ABI_BREAK} $(git rev-parse 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..e89ccef9d
--- /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',
+    '-check-private-abi',
+    '-l', 'libgnome-panel',
+    '-old', old_abi,
+    '-new', new_abi
+  ])
+except subprocess.CalledProcessError as e:
+  sys.exit(e.returncode)


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