Skip to content

Commit 500c597

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 500c597

File tree

5 files changed

+293
-8
lines changed

5 files changed

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

.github/workflows/cmake-libmspack.yml

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

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)