Skip to content

Commit b76314b

Browse files
Merge pull request #5464 from hannes-steffenhagen-diffblue/CD/create-debian-package-on-release
Cd/create debian package on release
2 parents cbadaa5 + 4e5ba60 commit b76314b

File tree

4 files changed

+87
-1
lines changed

4 files changed

+87
-1
lines changed

.github/workflows/pull-request-checks.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
# user input
5252
DEBIAN_FRONTEND: noninteractive
5353
run: |
54-
sudo apt-get install -yq cmake ninja-build gcc g++ maven flex bison libxml2-utils cpanminus
54+
sudo apt-get install -yq cmake ninja-build gcc g++ maven flex bison libxml2-utils cpanminus dpkg-dev
5555
cpanm Thread::Pool::Simple
5656
- name: Configure using CMake
5757
run: |
@@ -60,6 +60,11 @@ jobs:
6060
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++
6161
- name: Build with Ninja
6262
run: cd build; ninja
63+
- name: Check if package building works
64+
run: |
65+
cd build
66+
ninja package
67+
ls *.deb
6368
- name: Run tests
6469
run: cd build; ctest . -V -L CORE
6570
env:
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
on:
2+
release:
3+
types: [created]
4+
5+
name: Upload additional release assets
6+
jobs:
7+
ubuntu-package:
8+
runs-on: ubuntu-20.04
9+
env:
10+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11+
steps:
12+
- uses: actions/checkout@v2
13+
with:
14+
submodules: recursive
15+
- name: Fetch dependencies
16+
run: sudo apt install g++ flex bison cmake ninja-build maven jq xmllint dpkg-dev
17+
- name: Configure CMake
18+
run: |
19+
mkdir build
20+
cd build
21+
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release
22+
- name: Build using Ninja
23+
run: |
24+
cd build
25+
ninja
26+
- name: Run CTest
27+
run: cd build; ctest -V .
28+
- name: Create packages
29+
id: create_packages
30+
run: |
31+
cd build
32+
ninja package
33+
deb_package_name="$(ls *.deb)"
34+
echo "::set-output name=deb_package::./build/$deb_package_name"
35+
echo "::set-output name=deb_package_name::$deb_package_name"
36+
- name: Get release info
37+
id: get_release_info
38+
uses: bruceadams/get-release@v1.2.0
39+
- name: Upload binary packages
40+
uses: actions/upload-release-asset@v1
41+
with:
42+
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
43+
asset_path: ${{ steps.create_packages.outputs.deb_package }}
44+
asset_name: ${{ steps.create_packages.outputs.deb_package_name }}
45+
asset_content_type: application/x-deb

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,3 +213,5 @@ option(WITH_JBMC "Build the JBMC Java front-end" ON)
213213
if(WITH_JBMC)
214214
add_subdirectory(jbmc)
215215
endif()
216+
217+
include(cmake/packaging.cmake)

cmake/packaging.cmake

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
set(CPACK_PACKAGE_NAME "cbmc")
2+
set(CPACK_PACKAGE_VENDOR "Diffblue Ltd.")
3+
set(CPACK_PACKAGE_CONTACT "info@diffblue.com")
4+
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "CBMC is a Bounded Model Checker for C and C++ programs")
5+
set(CPACK_PACKAGE_DESCRIPTION
6+
"CBMC generates traces that demonstrate how an assertion can be violated,
7+
or proves that the assertion cannot be violated within a given number
8+
of loop iterations.")
9+
10+
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
11+
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
12+
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
13+
14+
# This should always be set, just isn’t by default for awkward backward compatibility reasons
15+
set(CPACK_VERBATIM_VARIABLES YES)
16+
17+
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
18+
set(CPACK_PACKAGE_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
19+
20+
# Automatically find dependencies for shared libraries
21+
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS YES)
22+
23+
# In addition, we depend on gcc for preprocessing
24+
set(CPACK_DEBIAN_PACKAGE_DEPENDS gcc)
25+
26+
# TODO packages for other platforms
27+
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
28+
set(CPACK_GENERATOR TGZ DEB)
29+
endif()
30+
31+
# Yes, this has to go at the bottom,
32+
# otherwise it can’t take into account
33+
# all the variables we set above!
34+
include(CPack)

0 commit comments

Comments
 (0)