Skip to content

Commit 5e47c48

Browse files
Merge pull request #5474 from hannes-steffenhagen-diffblue/CD/msi_installer
Create MSI installer on release
2 parents 4aa38dd + 550fd06 commit 5e47c48

File tree

4 files changed

+126
-2
lines changed

4 files changed

+126
-2
lines changed

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

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,40 @@ jobs:
170170
MERGE_BRANCH: ${{ github.ref }}
171171
run: ./.github/workflows/pull-request-check-cpplint.sh
172172

173+
# I just added this to check if my stuff is working on github actions
174+
windows-msi-package:
175+
runs-on: windows-2019
176+
env:
177+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
178+
steps:
179+
- uses: actions/checkout@v2
180+
with:
181+
submodules: recursive
182+
- name: Fetch dependencies
183+
run: |
184+
choco install winflexbison3
185+
- uses: microsoft/[email protected]
186+
- name: Configure with cmake
187+
run: |
188+
New-Item -ItemType Directory -Path build
189+
Set-Location build
190+
cmake ..
191+
- name: Build Release
192+
run: |
193+
Set-Location build
194+
cmake --build . --config Release
195+
- name: Create packages
196+
id: create_packages
197+
# We need to get the path to cpack because fascinatingly,
198+
# chocolatey also includes a command called "cpack" which takes precedence
199+
run: |
200+
Set-Location build
201+
$cpack = "$(Split-Path -Parent (Get-Command cmake).Source)\cpack.exe"
202+
& $cpack . -C Release
203+
$msi_name = (Get-ChildItem -name *.msi).Name
204+
Write-Output "::set-output name=msi_installer::build/$msi_name"
205+
Write-Output "::set-output name=msi_name::$msi_name"
206+
173207
check-string-table:
174208
runs-on: ubuntu-20.04
175209
steps:

.github/workflows/release-packages.yaml

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
cd build
2525
ninja
2626
- name: Run CTest
27-
run: cd build; ctest . -V -L CORE -C Release
27+
run: cd build; ctest . -V -L CORE -C Release
2828
- name: Create packages
2929
id: create_packages
3030
run: |
@@ -56,3 +56,44 @@ jobs:
5656
brew bump-formula-pr --tag "$RELEASE_TAG" --revision "$GITHUB_SHA" cbmc
5757
env:
5858
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.DB_CI_CPROVER_ACCESS_TOKEN }}
59+
60+
windows-msi-package:
61+
env:
62+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63+
steps:
64+
- uses: actions/checkout@v2
65+
with:
66+
submodules: recursive
67+
- name: Fetch dependencies
68+
run: |
69+
choco install winflexbison3
70+
- uses: microsoft/[email protected]
71+
name: Setup Visual Studio environment
72+
- name: Configure with cmake
73+
run: |
74+
New-Item -ItemType Directory -Path build
75+
Set-Location build
76+
cmake ..
77+
- name: Build Release
78+
run: |
79+
Set-Location build
80+
cmake --build . --config Release
81+
- name: Create packages
82+
id: create_packages
83+
run: |
84+
Set-Location build
85+
$cpack = "$(Split-Path -Parent (Get-Command cmake).Source)\cpack.exe"
86+
& $cpack . -C Release
87+
$msi_name = (Get-ChildItem -name *.msi).Name
88+
Write-Output "::set-output name=msi_installer::build/$msi_name"
89+
Write-Output "::set-output name=msi_name::$msi_name"
90+
- name: Get release info
91+
id: get_release_info
92+
uses: bruceadams/[email protected]
93+
- name: Upload binary packages
94+
uses: actions/upload-release-asset@v1
95+
with:
96+
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
97+
asset_path: ${{ steps.create_packages.outputs.msi_installer }}
98+
asset_name: ${{ steps.create_packages.outputs.msi_name }}
99+
asset_content_type: application/x-msi

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,19 @@ Get the [latest release](https://github.com/diffblue/cbmc/releases)
3030
Get the current *develop* version: `git clone https://github.com/diffblue/cbmc.git`
3131
* Develop versions are not recommended for production use.
3232

33+
Installing
34+
==========
35+
36+
### Windows
37+
38+
For windows you can install cbmc binaries via the .msi's found on the
39+
[releases](https://github.com/diffblue/cbmc/releases) page.
40+
41+
Note that we depend on the Visual C++ redistributables. You likely
42+
already have these, if not please download and run vcredist.x64.exe from
43+
[Microsoft](https://support.microsoft.com/en-gb/help/2977003/the-latest-supported-visual-c-downloads) to install them prior to running
44+
cbmc.
45+
3346
Report bugs
3447
===========
3548

cmake/packaging.cmake

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
1414
# This should always be set, just isn’t by default for awkward backward compatibility reasons
1515
set(CPACK_VERBATIM_VARIABLES YES)
1616

17-
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
17+
# The WiX package generator expects licenses to end in .txt or .rtf...
18+
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
19+
file(RENAME "${CMAKE_CURRENT_BINARY_DIR}/LICENSE" "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt")
20+
21+
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt")
1822
set(CPACK_PACKAGE_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
1923

2024
# Automatically find dependencies for shared libraries
@@ -23,9 +27,41 @@ set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS YES)
2327
# In addition, we depend on gcc for preprocessing
2428
set(CPACK_DEBIAN_PACKAGE_DEPENDS gcc)
2529

30+
# For windows we need to set up product and update GUID
31+
# See: https://docs.microsoft.com/en-us/windows/win32/msi/productcode
32+
# and https://docs.microsoft.com/en-us/windows/win32/msi/upgradecode
33+
# confusingly, the "product" GUID here is the one that changes between releases,
34+
# the upgrade one is the one that stays the same. CMake takes care of setting these,
35+
# but we want to fix the upgrade GUID to a specific value so new installs override
36+
# old ones.
37+
set(NIL_UUID "00000000-0000-0000-0000-000000000000")
38+
string(UUID CPACK_WIX_UPGRADE_GUID
39+
NAMESPACE ${NIL_UUID}
40+
NAME "cprover-cbmc"
41+
TYPE SHA1
42+
UPPER)
43+
44+
45+
# This is AFAICT only used for windows installers.
46+
# Basically the package-specific part of the install directory,
47+
# e.g. C:\Program Files\${CPACK_PACKAGE_INSTALL_DIRECTORY}.
48+
# The default here includes the version number which we don't want,
49+
# because upgrades will overwrite the files here so we could be in the
50+
# odd situation where C:\Program Files\cbmc-5.12.6\bin\cbmc --version
51+
# gives you back "5.16.1" because 5.12.6 just happened to be the first
52+
# installed version.
53+
set(CPACK_PACKAGE_INSTALL_DIRECTORY "cbmc")
54+
55+
2656
# TODO packages for other platforms
2757
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
2858
set(CPACK_GENERATOR TGZ DEB)
59+
elseif(WIN32)
60+
# Note: We don't ship VC redistributables with
61+
# the windows installer; We assume these are likely
62+
# already present on a developer machine, and if not
63+
# can easily be installed separately via vcredist.exe
64+
set(CPACK_GENERATOR ZIP WIX)
2965
endif()
3066

3167
# Yes, this has to go at the bottom,

0 commit comments

Comments
 (0)