Skip to content

Commit

Permalink
CMake: Add GitHub Actions
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
micahsnyder committed May 2, 2021
1 parent 67db401 commit 500c597
Show file tree
Hide file tree
Showing 5 changed files with 293 additions and 8 deletions.
141 changes: 141 additions & 0 deletions .github/workflows/cmake-cabextract.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
name: CMake Build Cabextract

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches:
- master
pull_request:
branches:
- master

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
VCPKG_GIT_REF: 8a9a97315aefb3f8bc5d81bf66ca0025938b9c91

jobs:
build-windows:
runs-on: windows-latest

steps:
- uses: actions/checkout@v1

- uses: lukka/get-cmake@latest

# Restore from cache the previously built ports. If cache-miss, download, build vcpkg ports.
- name: Restore vcpkg ports from cache or install vcpkg
# Download and build vcpkg, without installing any port. If content is cached already, it is a no-op.
uses: lukka/run-vcpkg@v5
id: runvcpkg
with:
vcpkgArguments: "libiconv"
vcpkgGitCommitId: "${{ env.VCPKG_GIT_REF }}"
vcpkgTriplet: "x64-windows"

- name: Print the VCPKG_ROOT & VCPKG_TRIPLET (for debugging)
shell: bash
run: echo "'${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}' '${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_TRIPLET_OUT }}' "

- name: dir the VCPKG_ROOT
run: dir ${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}

- name: Create Build Directory
shell: bash
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory ${{runner.workspace}}/cabextract-build

- name: Run CMake+Ninja with triplet (cmd)
uses: lukka/run-cmake@main
id: runcmake_cmd
with:
cmakeGenerator: "Ninja" # Visual Studio 15 2017
cmakeListsOrSettingsJson: "CMakeListsTxtBasic"
cmakeListsTxtPath: "${{runner.workspace}}/libmspack/cabextract/CMakeLists.txt"
useVcpkgToolchainFile: true
cmakeAppendedArgs: '-A x64 -DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" -- -v'
cmakeBuildType: "${{ env.BUILD_TYPE }}"
vcpkgTriplet: ${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_TRIPLET_OUT }}
buildDirectory: "${{runner.workspace}}/cabextract-build"

- name: Test
working-directory: ${{runner.workspace}}/cabextract-build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{ env.BUILD_TYPE }} -V

build-macos:
runs-on: macos-latest

steps:
- uses: actions/checkout@v1

- uses: lukka/get-cmake@latest

- name: Create Build Directory
shell: bash
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory ${{runner.workspace}}/cabextract-build

- name: Configure CMake
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
working-directory: ${{runner.workspace}}/cabextract-build
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run:
cmake ${{runner.workspace}}/libmspack/libmspack -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}

- name: Build
shell: bash
working-directory: ${{runner.workspace}}/cabextract-build
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build . --config ${{ env.BUILD_TYPE }}

- name: Test
shell: bash
working-directory: ${{runner.workspace}}/cabextract-build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{ env.BUILD_TYPE }} -V

build-ubuntu:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1

- uses: lukka/get-cmake@latest

- name: Create Build Directory
shell: bash
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory ${{runner.workspace}}/cabextract-build

- name: Configure CMake
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
working-directory: ${{runner.workspace}}/cabextract-build
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run:
cmake ${{runner.workspace}}/libmspack/libmspack -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}

- name: Build
shell: bash
working-directory: ${{runner.workspace}}/cabextract-build
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build . --config ${{ env.BUILD_TYPE }}

- name: Test
shell: bash
working-directory: ${{runner.workspace}}/cabextract-build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{ env.BUILD_TYPE }} -V
141 changes: 141 additions & 0 deletions .github/workflows/cmake-libmspack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
name: CMake Build Libmspack

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches:
- master
pull_request:
branches:
- master

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
VCPKG_GIT_REF: 8a9a97315aefb3f8bc5d81bf66ca0025938b9c91

jobs:
build-windows:
runs-on: windows-latest

steps:
- uses: actions/checkout@v1

- uses: lukka/get-cmake@latest

# Restore from cache the previously built ports. If cache-miss, download, build vcpkg ports.
- name: Restore vcpkg ports from cache or install vcpkg
# Download and build vcpkg, without installing any port. If content is cached already, it is a no-op.
uses: lukka/run-vcpkg@v5
id: runvcpkg
with:
vcpkgArguments: "libiconv"
vcpkgGitCommitId: "${{ env.VCPKG_GIT_REF }}"
vcpkgTriplet: "x64-windows"

- name: Print the VCPKG_ROOT & VCPKG_TRIPLET (for debugging)
shell: bash
run: echo "'${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}' '${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_TRIPLET_OUT }}' "

- name: dir the VCPKG_ROOT
run: dir ${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}

- name: Create Build Directory
shell: bash
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory ${{runner.workspace}}/libmspack-build

- name: Run CMake+Ninja with triplet (cmd)
uses: lukka/run-cmake@main
id: runcmake_cmd
with:
cmakeGenerator: "Ninja" # Visual Studio 15 2017
cmakeListsOrSettingsJson: "CMakeListsTxtBasic"
cmakeListsTxtPath: "${{runner.workspace}}/libmspack/libmspack/CMakeLists.txt"
useVcpkgToolchainFile: true
cmakeAppendedArgs: '-A x64 -DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" -- -v'
cmakeBuildType: "${{ env.BUILD_TYPE }}"
vcpkgTriplet: ${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_TRIPLET_OUT }}
buildDirectory: "${{runner.workspace}}/libmspack-build"

- name: Test
working-directory: ${{runner.workspace}}/libmspack-build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{ env.BUILD_TYPE }} -V

build-macos:
runs-on: macos-latest

steps:
- uses: actions/checkout@v1

- uses: lukka/get-cmake@latest

- name: Create Build Directory
shell: bash
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory ${{runner.workspace}}/libmspack-build

- name: Configure CMake
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
working-directory: ${{runner.workspace}}/libmspack-build
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run:
cmake ${{runner.workspace}}/libmspack/libmspack -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}

- name: Build
shell: bash
working-directory: ${{runner.workspace}}/libmspack-build
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build . --config ${{ env.BUILD_TYPE }}

- name: Test
shell: bash
working-directory: ${{runner.workspace}}/libmspack-build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{ env.BUILD_TYPE }} -V

build-ubuntu:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1

- uses: lukka/get-cmake@latest

- name: Create Build Directory
shell: bash
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory ${{runner.workspace}}/libmspack-build

- name: Configure CMake
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
working-directory: ${{runner.workspace}}/libmspack-build
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run:
cmake ${{runner.workspace}}/libmspack/libmspack -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}

- name: Build
shell: bash
working-directory: ${{runner.workspace}}/libmspack-build
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build . --config ${{ env.BUILD_TYPE }}

- name: Test
shell: bash
working-directory: ${{runner.workspace}}/libmspack-build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{ env.BUILD_TYPE }} -V
15 changes: 7 additions & 8 deletions cabextract/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,9 @@ set(VERSION ${PROJECT_VERSION})
#
# External library dependencies
#
if(NOT WIN32)
find_package(ICONV)
if(ICONV_FOUND)
set(HAVE_ICONV 1)
endif()
find_package(ICONV)
if(ICONV_FOUND)
set(HAVE_ICONV 1)
endif()

# Generate config.h
Expand Down Expand Up @@ -228,10 +226,11 @@ else()
target_include_directories(cabextract PRIVATE ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/win32)
target_sources(cabextract PRIVATE win32/dirent.h)
target_link_libraries(cabextract Shlwapi.lib)
if(HAVE_ICONV)
target_link_libraries( cabextract PRIVATE ICONV::Iconv )
endif()
endif()
if(HAVE_ICONV)
target_link_libraries( cabextract ICONV::Iconv )
endif()

target_include_directories(cabextract PRIVATE ${PROJECT_SOURCE_DIR})
target_link_libraries(cabextract MSPack::mspack)
install(TARGETS cabextract DESTINATION ${CMAKE_INSTALL_BINDIR})
Expand Down
2 changes: 2 additions & 0 deletions cabextract/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# cabextract 1.9.1

<a href="https://github.com/kyz/libmspack/actions"><img src="https://github.com/kyz/libmspack/workflows/CMake%20Build%20Cabextract/badge.svg" height="18"></a>

A program to extract Microsoft Cabinet files.

(C) 2000-2019 Stuart Caie <kyzer@cabextract.org.uk>
Expand Down
2 changes: 2 additions & 0 deletions libmspack/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# libmspack 0.10.1alpha

<a href="https://github.com/kyz/libmspack/actions"><img src="https://github.com/kyz/libmspack/workflows/CMake%20Build%20Libmspack/badge.svg" height="18"></a>

The purpose of libmspack is to provide compressors and decompressors,
archivers and dearchivers for Microsoft compression formats: CAB, CHM, WIM,
LIT, HLP, KWAJ and SZDD. It is also designed to be easily embeddable,
Expand Down

0 comments on commit 500c597

Please sign in to comment.