Skip to content

Commit 7197ff2

Browse files
committed
Created abi test workflow
1 parent 3d5cd73 commit 7197ff2

File tree

3 files changed

+6600
-15
lines changed

3 files changed

+6600
-15
lines changed

.github/workflows/abi.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#
2+
# Copyright 2024 Ribose Inc. (https://www.ribose.com)
3+
#
4+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
5+
# this software and associated documentation files (the "Software"), to deal in
6+
# the Software without restriction, including without limitation the rights to
7+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8+
# the Software, and to permit persons to whom the Software is furnished to do so,
9+
# subject to the following conditions:
10+
#
11+
# The above copyright notice and this permission notice shall be included in all
12+
# copies or substantial portions of the Software.
13+
#
14+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20+
#
21+
22+
name: abi
23+
24+
on:
25+
push:
26+
branches: [ main ]
27+
pull_request:
28+
workflow_dispatch:
29+
30+
concurrency:
31+
group: '${{ github.workflow }}-${{ github.job }}-${{ github.head_ref || github.ref_name }}'
32+
cancel-in-progress: true
33+
34+
jobs:
35+
abi-test:
36+
runs-on: ubuntu-latest
37+
env:
38+
CC: gcc
39+
CXX: g++
40+
MAKEFLAGS: j4
41+
steps:
42+
- name: Checkout
43+
uses: actions/checkout@v4
44+
with:
45+
fetch-depth: 1
46+
47+
- name: Install abi tools
48+
run: |
49+
sudo apt-get install abi-compliance-checker abi-dumper
50+
51+
- name: Configure
52+
run: |
53+
cmake -Bbuild -DWITH_ABI_TEST=ON
54+
55+
- name: Build
56+
run: cmake --build build
57+
58+
- name: Generate abi dump
59+
run: abi-dumper build/libsexpp.so -o build/libsexpp.abi -lver 0
60+
61+
- name: Test abi compatibility
62+
run: abi-compliance-checker -l libsexpp -new build/libsexpp.abi -old tests/abi/libsexpp.0.abi -report-path build/abi-report.html
63+
64+
- name: Upload abi report
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: abi-report
68+
path: build/abi-report.html

CMakeLists.txt

Lines changed: 42 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright 2021-2023 Ribose Inc. (https://www.ribose.com)
2+
# Copyright 2021-2024 Ribose Inc. (https://www.ribose.com)
33
#
44
# Permission is hereby granted, free of charge, to any person obtaining a copy of
55
# this software and associated documentation files (the "Software"), to deal in
@@ -35,33 +35,21 @@ option(WITH_SEXP_TESTS "Build tests" ON)
3535
option(WITH_SEXP_CLI "Build sexp console application" ON)
3636
option(WITH_SANITIZERS "Enable ASAN and other sanitizers" OFF)
3737
option(WITH_COVERAGE "Enable coverage report" OFF)
38+
option(WITH_ABI_TEST "Configure for ABI compatibility test" OFF)
3839
option(DOWNLOAD_GTEST "Download googletest" ON)
3940
option(BUILD_SHARED_LIBS "Build shared library" OFF)
4041

4142
include(GNUInstallDirs)
4243
include(CheckCXXSourceCompiles)
4344

44-
if (BUILD_SHARED_LIBS)
45-
set(TYPE "SHARED")
46-
else (BUILD_SHARED_LIBS)
47-
set(TYPE "STATIC")
48-
endif (BUILD_SHARED_LIBS)
49-
50-
if (BUILD_SHARED_LIBS AND MSVC)
51-
message(FATAL_ERROR "Building sexp shared library with MSVC is not supported")
52-
endif(BUILD_SHARED_LIBS AND MSVC)
53-
54-
55-
message(STATUS "Building ${TYPE} library")
56-
5745
if (WITH_SANITIZERS)
5846
if (NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
5947
message(FATAL_ERROR "Sanitizers work with clang compiler only.")
6048
endif()
6149
if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
6250
message(STATUS "Forcing build type to Debug for sanitizers")
6351
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Build type. Forced to Debug" FORCE)
64-
set(WITH_TESTS ON CACHE STRING "Forced to ON" FORCE)
52+
set(WITH_SEXP_TESTS ON CACHE STRING "Forced to ON" FORCE)
6553
endif()
6654
endif()
6755

@@ -72,10 +60,45 @@ if (WITH_COVERAGE)
7260
if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
7361
message(STATUS "Forcing build type to Debug for coverage")
7462
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Build type. Forced to Debug" FORCE)
63+
set(WITH_SEXP_TESTS ON CACHE STRING "Forced to ON" FORCE)
64+
endif()
65+
endif()
66+
67+
if (WITH_ABI_TEST)
68+
if (NOT CMAKE_CXX_COMPILER_ID MATCHES "GNU")
69+
message(FATAL_ERROR "Abi test works with GNU compiler only.")
70+
endif()
71+
if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
72+
message(STATUS "Forcing build type to Debug for abi test")
73+
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Build type. Forced to Debug" FORCE)
7574
set(WITH_TESTS ON CACHE STRING "Forced to ON" FORCE)
7675
endif()
76+
if(WITH_SEXP_TESTS)
77+
message(STATUS "Disabling tests build for abi test")
78+
set(WITH_SEXP_TESTS OFF CACHE STRING "Forced to OFF" FORCE)
79+
endif()
80+
if(WITH_SEXP_CLI)
81+
message(STATUS "Disabling sexp cli application build for abi test")
82+
set(WITH_SEXP_CLI OFF CACHE STRING "Forced to OFF" FORCE)
83+
endif()
84+
if(NOT BUILD_SHARED_LIBS)
85+
message(STATUS "Forcing shared libs for abi test")
86+
set(BUILD_SHARED_LIBS ON CACHE STRING "Forced to ON" FORCE)
87+
endif()
7788
endif()
7889

90+
if (BUILD_SHARED_LIBS)
91+
set(TYPE "SHARED")
92+
else (BUILD_SHARED_LIBS)
93+
set(TYPE "STATIC")
94+
endif (BUILD_SHARED_LIBS)
95+
96+
if (BUILD_SHARED_LIBS AND MSVC)
97+
message(FATAL_ERROR "Building sexp shared library with MSVC is not supported")
98+
endif(BUILD_SHARED_LIBS AND MSVC)
99+
100+
message(STATUS "Building ${TYPE} library")
101+
79102
if(NOT CMAKE_BUILD_TYPE)
80103
message(STATUS "Defaulting build type to Debug")
81104
set(CMAKE_BUILD_TYPE Debug)
@@ -93,6 +116,10 @@ if (WITH_COVERAGE)
93116
link_libraries(--coverage)
94117
endif(WITH_COVERAGE)
95118

119+
if (WITH_ABI_TEST)
120+
add_compile_options(-Og)
121+
endif(WITH_ABI_TEST)
122+
96123
# set warning flags at the top level
97124
if(NOT MSVC)
98125
add_compile_options(

0 commit comments

Comments
 (0)