Skip to content

Commit 37a5a38

Browse files
committed
CMake: Add GitHub Actions
Add CMake build for cabextract and libmspack on GitHub Actions. Will test on Ubuntu, macOS, Windows. Added build badges to the readme for each project.
1 parent 67db401 commit 37a5a38

5 files changed

Lines changed: 295 additions & 8 deletions

File tree

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
name: CMake Build Cabextract
2+
3+
# Controls when the action will run. Triggers the workflow on push or pull request
4+
# events but only for the master branch
5+
on:
6+
push:
7+
branches:
8+
- master
9+
- cmake-tooling
10+
pull_request:
11+
branches:
12+
- master
13+
14+
env:
15+
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
16+
BUILD_TYPE: Release
17+
VCPKG_GIT_REF: 8a9a97315aefb3f8bc5d81bf66ca0025938b9c91
18+
19+
jobs:
20+
build-windows:
21+
runs-on: windows-latest
22+
23+
steps:
24+
- uses: actions/checkout@v1
25+
26+
- uses: lukka/get-cmake@latest
27+
28+
# Restore from cache the previously built ports. If cache-miss, download, build vcpkg ports.
29+
- name: Restore vcpkg ports from cache or install vcpkg
30+
# Download and build vcpkg, without installing any port. If content is cached already, it is a no-op.
31+
uses: lukka/run-vcpkg@v5
32+
id: runvcpkg
33+
with:
34+
vcpkgArguments: "libiconv"
35+
vcpkgGitCommitId: "${{ env.VCPKG_GIT_REF }}"
36+
vcpkgTriplet: "x64-windows"
37+
38+
- name: Print the VCPKG_ROOT & VCPKG_TRIPLET (for debugging)
39+
shell: bash
40+
run: echo "'${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}' '${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_TRIPLET_OUT }}' "
41+
42+
- name: dir the VCPKG_ROOT
43+
run: dir ${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}
44+
45+
- name: Create Build Directory
46+
shell: bash
47+
# Some projects don't allow in-source building, so create a separate build directory
48+
# We'll use this as our working directory for all subsequent commands
49+
run: cmake -E make_directory ${{runner.workspace}}/cabextract-build
50+
51+
- name: Run CMake+Ninja with triplet (cmd)
52+
uses: lukka/run-cmake@main
53+
id: runcmake_cmd
54+
with:
55+
cmakeGenerator: "Ninja" # Visual Studio 15 2017
56+
cmakeListsOrSettingsJson: "CMakeListsTxtBasic"
57+
cmakeListsTxtPath: "${{runner.workspace}}/libmspack/cabextract/CMakeLists.txt"
58+
useVcpkgToolchainFile: true
59+
cmakeAppendedArgs: '-A x64 -DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" -- -v'
60+
cmakeBuildType: "${{ env.BUILD_TYPE }}"
61+
vcpkgTriplet: ${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_TRIPLET_OUT }}
62+
buildDirectory: "${{runner.workspace}}/cabextract-build"
63+
64+
- name: Test
65+
working-directory: ${{runner.workspace}}/cabextract-build
66+
# Execute tests defined by the CMake configuration.
67+
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
68+
run: ctest -C ${{ env.BUILD_TYPE }} -V
69+
70+
build-macos:
71+
runs-on: macos-latest
72+
73+
steps:
74+
- uses: actions/checkout@v1
75+
76+
- uses: lukka/get-cmake@latest
77+
78+
- name: Create Build Directory
79+
shell: bash
80+
# Some projects don't allow in-source building, so create a separate build directory
81+
# We'll use this as our working directory for all subsequent commands
82+
run: cmake -E make_directory ${{runner.workspace}}/cabextract-build
83+
84+
- name: Configure CMake
85+
# Use a bash shell so we can use the same syntax for environment variable
86+
# access regardless of the host operating system
87+
working-directory: ${{runner.workspace}}/cabextract-build
88+
# Note the current convention is to use the -S and -B options here to specify source
89+
# and build directories, but this is only available with CMake 3.13 and higher.
90+
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
91+
run:
92+
cmake ${{runner.workspace}}/libmspack/libmspack -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
93+
94+
- name: Build
95+
shell: bash
96+
working-directory: ${{runner.workspace}}/cabextract-build
97+
# Execute the build. You can specify a specific target with "--target <NAME>"
98+
run: cmake --build . --config ${{ env.BUILD_TYPE }}
99+
100+
- name: Test
101+
shell: bash
102+
working-directory: ${{runner.workspace}}/cabextract-build
103+
# Execute tests defined by the CMake configuration.
104+
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
105+
run: ctest -C ${{ env.BUILD_TYPE }} -V
106+
107+
build-ubuntu:
108+
runs-on: ubuntu-latest
109+
110+
steps:
111+
- uses: actions/checkout@v1
112+
113+
- uses: lukka/get-cmake@latest
114+
115+
- name: Create Build Directory
116+
shell: bash
117+
# Some projects don't allow in-source building, so create a separate build directory
118+
# We'll use this as our working directory for all subsequent commands
119+
run: cmake -E make_directory ${{runner.workspace}}/cabextract-build
120+
121+
- name: Configure CMake
122+
# Use a bash shell so we can use the same syntax for environment variable
123+
# access regardless of the host operating system
124+
working-directory: ${{runner.workspace}}/cabextract-build
125+
# Note the current convention is to use the -S and -B options here to specify source
126+
# and build directories, but this is only available with CMake 3.13 and higher.
127+
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
128+
run:
129+
cmake ${{runner.workspace}}/libmspack/libmspack -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
130+
131+
- name: Build
132+
shell: bash
133+
working-directory: ${{runner.workspace}}/cabextract-build
134+
# Execute the build. You can specify a specific target with "--target <NAME>"
135+
run: cmake --build . --config ${{ env.BUILD_TYPE }}
136+
137+
- name: Test
138+
shell: bash
139+
working-directory: ${{runner.workspace}}/cabextract-build
140+
# Execute tests defined by the CMake configuration.
141+
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
142+
run: ctest -C ${{ env.BUILD_TYPE }} -V
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
name: CMake Build Libmspack
2+
3+
# Controls when the action will run. Triggers the workflow on push or pull request
4+
# events but only for the master branch
5+
on:
6+
push:
7+
branches:
8+
- master
9+
- cmake-tooling
10+
pull_request:
11+
branches:
12+
- master
13+
14+
env:
15+
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
16+
BUILD_TYPE: Release
17+
VCPKG_GIT_REF: 8a9a97315aefb3f8bc5d81bf66ca0025938b9c91
18+
19+
jobs:
20+
build-windows:
21+
runs-on: windows-latest
22+
23+
steps:
24+
- uses: actions/checkout@v1
25+
26+
- uses: lukka/get-cmake@latest
27+
28+
# Restore from cache the previously built ports. If cache-miss, download, build vcpkg ports.
29+
- name: Restore vcpkg ports from cache or install vcpkg
30+
# Download and build vcpkg, without installing any port. If content is cached already, it is a no-op.
31+
uses: lukka/run-vcpkg@v5
32+
id: runvcpkg
33+
with:
34+
vcpkgArguments: "libiconv"
35+
vcpkgGitCommitId: "${{ env.VCPKG_GIT_REF }}"
36+
vcpkgTriplet: "x64-windows"
37+
38+
- name: Print the VCPKG_ROOT & VCPKG_TRIPLET (for debugging)
39+
shell: bash
40+
run: echo "'${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}' '${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_TRIPLET_OUT }}' "
41+
42+
- name: dir the VCPKG_ROOT
43+
run: dir ${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}
44+
45+
- name: Create Build Directory
46+
shell: bash
47+
# Some projects don't allow in-source building, so create a separate build directory
48+
# We'll use this as our working directory for all subsequent commands
49+
run: cmake -E make_directory ${{runner.workspace}}/libmspack-build
50+
51+
- name: Run CMake+Ninja with triplet (cmd)
52+
uses: lukka/run-cmake@main
53+
id: runcmake_cmd
54+
with:
55+
cmakeGenerator: "Ninja" # Visual Studio 15 2017
56+
cmakeListsOrSettingsJson: "CMakeListsTxtBasic"
57+
cmakeListsTxtPath: "${{runner.workspace}}/libmspack/libmspack/CMakeLists.txt"
58+
useVcpkgToolchainFile: true
59+
cmakeAppendedArgs: '-A x64 -DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" -- -v'
60+
cmakeBuildType: "${{ env.BUILD_TYPE }}"
61+
vcpkgTriplet: ${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_TRIPLET_OUT }}
62+
buildDirectory: "${{runner.workspace}}/libmspack-build"
63+
64+
- name: Test
65+
working-directory: ${{runner.workspace}}/libmspack-build
66+
# Execute tests defined by the CMake configuration.
67+
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
68+
run: ctest -C ${{ env.BUILD_TYPE }} -V
69+
70+
build-macos:
71+
runs-on: macos-latest
72+
73+
steps:
74+
- uses: actions/checkout@v1
75+
76+
- uses: lukka/get-cmake@latest
77+
78+
- name: Create Build Directory
79+
shell: bash
80+
# Some projects don't allow in-source building, so create a separate build directory
81+
# We'll use this as our working directory for all subsequent commands
82+
run: cmake -E make_directory ${{runner.workspace}}/libmspack-build
83+
84+
- name: Configure CMake
85+
# Use a bash shell so we can use the same syntax for environment variable
86+
# access regardless of the host operating system
87+
working-directory: ${{runner.workspace}}/libmspack-build
88+
# Note the current convention is to use the -S and -B options here to specify source
89+
# and build directories, but this is only available with CMake 3.13 and higher.
90+
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
91+
run:
92+
cmake ${{runner.workspace}}/libmspack/libmspack -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
93+
94+
- name: Build
95+
shell: bash
96+
working-directory: ${{runner.workspace}}/libmspack-build
97+
# Execute the build. You can specify a specific target with "--target <NAME>"
98+
run: cmake --build . --config ${{ env.BUILD_TYPE }}
99+
100+
- name: Test
101+
shell: bash
102+
working-directory: ${{runner.workspace}}/libmspack-build
103+
# Execute tests defined by the CMake configuration.
104+
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
105+
run: ctest -C ${{ env.BUILD_TYPE }} -V
106+
107+
build-ubuntu:
108+
runs-on: ubuntu-latest
109+
110+
steps:
111+
- uses: actions/checkout@v1
112+
113+
- uses: lukka/get-cmake@latest
114+
115+
- name: Create Build Directory
116+
shell: bash
117+
# Some projects don't allow in-source building, so create a separate build directory
118+
# We'll use this as our working directory for all subsequent commands
119+
run: cmake -E make_directory ${{runner.workspace}}/libmspack-build
120+
121+
- name: Configure CMake
122+
# Use a bash shell so we can use the same syntax for environment variable
123+
# access regardless of the host operating system
124+
working-directory: ${{runner.workspace}}/libmspack-build
125+
# Note the current convention is to use the -S and -B options here to specify source
126+
# and build directories, but this is only available with CMake 3.13 and higher.
127+
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
128+
run:
129+
cmake ${{runner.workspace}}/libmspack/libmspack -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
130+
131+
- name: Build
132+
shell: bash
133+
working-directory: ${{runner.workspace}}/libmspack-build
134+
# Execute the build. You can specify a specific target with "--target <NAME>"
135+
run: cmake --build . --config ${{ env.BUILD_TYPE }}
136+
137+
- name: Test
138+
shell: bash
139+
working-directory: ${{runner.workspace}}/libmspack-build
140+
# Execute tests defined by the CMake configuration.
141+
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
142+
run: ctest -C ${{ env.BUILD_TYPE }} -V

cabextract/CMakeLists.txt

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,9 @@ set(VERSION ${PROJECT_VERSION})
193193
#
194194
# External library dependencies
195195
#
196-
if(NOT WIN32)
197-
find_package(ICONV)
198-
if(ICONV_FOUND)
199-
set(HAVE_ICONV 1)
200-
endif()
196+
find_package(ICONV)
197+
if(ICONV_FOUND)
198+
set(HAVE_ICONV 1)
201199
endif()
202200

203201
# Generate config.h
@@ -228,10 +226,11 @@ else()
228226
target_include_directories(cabextract PRIVATE ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/win32)
229227
target_sources(cabextract PRIVATE win32/dirent.h)
230228
target_link_libraries(cabextract Shlwapi.lib)
231-
if(HAVE_ICONV)
232-
target_link_libraries( cabextract PRIVATE ICONV::Iconv )
233-
endif()
234229
endif()
230+
if(HAVE_ICONV)
231+
target_link_libraries( cabextract PRIVATE ICONV::Iconv )
232+
endif()
233+
235234
target_include_directories(cabextract PRIVATE ${PROJECT_SOURCE_DIR})
236235
target_link_libraries(cabextract MSPack::mspack)
237236
install(TARGETS cabextract DESTINATION ${CMAKE_INSTALL_BINDIR})

cabextract/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# cabextract 1.9.1
22

3+
<a href="https://github.com/kyz/libmspack/actions"><img src="https://github.com/kyz/libmspack/workflows/CMake%20Build%20Cabextract/badge.svg" height="18"></a>
4+
35
A program to extract Microsoft Cabinet files.
46

57
(C) 2000-2019 Stuart Caie <kyzer@cabextract.org.uk>

libmspack/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# libmspack 0.10.1alpha
22

3+
<a href="https://github.com/kyz/libmspack/actions"><img src="https://github.com/kyz/libmspack/workflows/CMake%20Build%20Libmspack/badge.svg" height="18"></a>
4+
35
The purpose of libmspack is to provide compressors and decompressors,
46
archivers and dearchivers for Microsoft compression formats: CAB, CHM, WIM,
57
LIT, HLP, KWAJ and SZDD. It is also designed to be easily embeddable,

0 commit comments

Comments
 (0)