CI: add minimal-ci

This commit is contained in:
Markus F.X.J. Oberhumer 2023-01-17 23:43:24 +01:00
parent aa050e0001
commit 334be287fc
3 changed files with 43 additions and 32 deletions

28
.github/workflows/minimal-ci.yml vendored Normal file
View File

@ -0,0 +1,28 @@
# minimal GitHub CI building UPX with clang and gcc in an Alpine Linux container
name: 'Minimal CI with Alpine Linux'
on: { workflow_dispatch: }
jobs:
job-alpine-cmake:
strategy: {matrix: {container: ['alpine:3.12','alpine:3.17','alpine:edge']}}
name: ${{ format('container {0}', matrix.container) }}
runs-on: ubuntu-latest
container: ${{ matrix.container }}
steps:
- name: ${{ format('Install packages {0}', matrix.container) }}
run: 'apk update && apk upgrade && apk add bash clang cmake g++ git make'
- name: 'Check out code'
run: |
git clone --branch devel --depth 1 https://github.com/upx/upx
git -C upx submodule update --init
echo 'artifact_name=upx-minimal-ci-${{ matrix.container }}' | sed 's/:/-/g' >> $GITHUB_ENV
- { name: 'Build clang', run: 'make -C upx build/extra/clang/release' }
- { name: 'Build gcc', run: 'make -C upx build/extra/gcc/release' }
- name: ${{ format('Upload artifact {0}', env.artifact_name) }}
uses: actions/upload-artifact@v3
with:
name: ${{ env.artifact_name }}
path: 'upx*/build/*/*/*/upx'
- { name: 'Run basic tests clang', run: 'make -C upx/build/extra/clang/release test' }
- { name: 'Run basic tests gcc', run: 'make -C upx/build/extra/gcc/release test' }

View File

@ -8,7 +8,7 @@ if(NOT IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/.git")
option(UPX_CONFIG_DISABLE_WERROR "Do not compile with default -Werror option." ON)
else()
# strict config defaults for devel builds
message(STATUS "upx info: strict config defaults enabled")
message(STATUS "===== UPX info: strict config defaults enabled")
option(UPX_CONFIG_DISABLE_GITREV "Do not compile with default Git version info." OFF)
option(UPX_CONFIG_DISABLE_SANITIZE "Do not compile with default sanitize options." OFF)
option(UPX_CONFIG_DISABLE_WERROR "Do not compile with default -Werror option." OFF)
@ -78,6 +78,7 @@ else()
message(STATUS "UPX_VERSION_GITREV: not set")
endif()
# CMake init
project(upx VERSION 4.0.2 LANGUAGES C CXX)
# set default build type to "Release"
@ -159,7 +160,7 @@ else()
add_definitions(-fno-tree-vectorize)
endif()
# compile a target with -O2 in Debug mode
# compile a target with -O2 in Debug build
function(upx_compile_target_debug_with_O2 t)
if(MSVC)
# msvc uses some Debug compile options like -RTC1 that are incompatible with -O2
@ -244,7 +245,9 @@ if(Threads_FOUND AND 0)
endif()
#***********************************************************************
# "ctest"
# "make test"
# "ninja test"
#***********************************************************************
include(CTest)
@ -277,8 +280,9 @@ if(NOT CMAKE_CROSSCOMPILING AND NOT UPX_CONFIG_DISABLE_SELF_PACK_TEST)
endif()
#***********************************************************************
# "make install"
# "cmake --install ."
# "make install"
# "ninja install"
#***********************************************************************
# installation prefix and directories
@ -314,13 +318,10 @@ function(print_var)
endforeach()
endfunction()
print_var(CMAKE_HOST_SYSTEM_NAME CMAKE_HOST_SYSTEM_VERSION)
print_var(CMAKE_SYSTEM_NAME CMAKE_SYSTEM_VERSION)
print_var(CMAKE_CROSSCOMPILING)
print_var(CMAKE_SYSTEM_NAME CMAKE_SYSTEM_VERSION CMAKE_CROSSCOMPILING)
print_var(CMAKE_C_COMPILER_ID CMAKE_C_COMPILER_VERSION CMAKE_C_COMPILER_ARCHITECTURE_ID CMAKE_C_PLATFORM_ID CMAKE_C_COMPILER_ABI)
print_var(CMAKE_CXX_COMPILER_ID CMAKE_CXX_COMPILER_VERSION CMAKE_CXX_COMPILER_ARCHITECTURE_ID CMAKE_CXX_PLATFORM_ID CMAKE_CXX_COMPILER_ABI)
print_var(CMAKE_INSTALL_PREFIX)
print_var(CMAKE_CONFIGURATION_TYPES)
print_var(CMAKE_BUILD_TYPE)
print_var(CMAKE_INSTALL_PREFIX CMAKE_CONFIGURATION_TYPES CMAKE_BUILD_TYPE)
if (CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|Release)$")
message(WARNING "WARNING: unsupported CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}; please use \"Debug\" or \"Release\"")
endif()

View File

@ -15,6 +15,8 @@ UPX_CMAKE_BUILD_FLAGS += --parallel
ifneq ($(VERBOSE),)
UPX_CMAKE_BUILD_FLAGS += --verbose
endif
# enable this if you prefer Ninja for the actual builds:
#UPX_CMAKE_CONFIG_FLAGS += -G Ninja
#***********************************************************************
# default
@ -132,27 +134,7 @@ build/extra/cross-windows-mingw64/%: UPX_CMAKE_CONFIG_FLAGS += -DUPX_CONFIG_DISA
# check git submodules
#***********************************************************************
ifeq ($(wildcard ./vendor/boost-pfr/include/.),)
$(error ERROR: missing git submodule; run 'git submodule update --init')
endif
ifeq ($(wildcard ./vendor/doctest/doctest/.),)
$(error ERROR: missing git submodule; run 'git submodule update --init')
endif
ifeq ($(wildcard ./vendor/lzma-sdk/C/.),)
$(error ERROR: missing git submodule; run 'git submodule update --init')
endif
ifeq ($(wildcard ./vendor/rangeless/include/.),)
$(error ERROR: missing git submodule; run 'git submodule update --init')
endif
ifeq ($(wildcard ./vendor/ucl/include/.),)
$(error ERROR: missing git submodule; run 'git submodule update --init')
endif
ifeq ($(wildcard ./vendor/valgrind/include/.),)
$(error ERROR: missing git submodule; run 'git submodule update --init')
endif
ifeq ($(wildcard ./vendor/zlib/crc32.c),)
$(error ERROR: missing git submodule; run 'git submodule update --init')
endif
ifeq ($(wildcard ./vendor/zstd/lib/.),)
$(error ERROR: missing git submodule; run 'git submodule update --init')
endif
SUBMODULES = boost-pfr doctest lzma-sdk rangeless ucl valgrind zlib zstd
dummy := $(foreach m,$(SUBMODULES),$(if $(wildcard vendor/$(m)/[CL]*),,\
$(error ERROR: missing git submodule $m; run 'git submodule update --init')))