CI updates

This commit is contained in:
Markus F.X.J. Oberhumer 2023-09-19 11:47:15 +02:00
parent 06675acc67
commit f1703fa322
5 changed files with 191 additions and 30 deletions

View File

@ -0,0 +1,85 @@
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
# BS BuildSystem: build on Windows with 'cmake -G "Unix Makefiles"'
name: 'Weekly CI BS - cmake Windows make'
on:
schedule: [cron: '20 1 * * 3'] # run weekly Wednesday 01:20 UTC
workflow_dispatch:
env:
CMAKE_REQUIRED_QUIET: OFF
DEBIAN_FRONTEND: noninteractive
UPX_CMAKE_BUILD_FLAGS: --verbose
UPX_CMAKE_CONFIG_FLAGS: -G "Unix Makefiles"
jobs:
job-cmake-windows-nmake: # uses cmake + nmake
if: github.repository_owner == 'upx'
strategy:
fail-fast: false
matrix:
include:
# mingw-gcc
- { os: windows-2022, cc: gcc, cxx: 'g++', arch: amd64 }
# # NOTE: the following don't work => use Ninja instead
# # clang-cl
# - { os: windows-2022, cc: clang-cl, cxx: clang-cl, vsversion: 2022, arch: amd64 }
# # msvc
# - { os: windows-2019, cc: cl, cxx: cl, vsversion: 2019, arch: amd64 }
# - { os: windows-2019, cc: cl, cxx: cl, vsversion: 2019, arch: amd64_arm64 }
# - { os: windows-2019, cc: cl, cxx: cl, vsversion: 2019, arch: amd64_x86 }
# - { os: windows-2022, cc: cl, cxx: cl, vsversion: 2022, arch: amd64 }
# - { os: windows-2022, cc: cl, cxx: cl, vsversion: 2022, arch: amd64_arm64 }
# - { os: windows-2022, cc: cl, cxx: cl, vsversion: 2022, arch: amd64_x86 }
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
name: ${{ format('{0} {1} {2}', matrix.cc, matrix.vsversion, matrix.arch) }}
runs-on: ${{ matrix.os }}
steps:
- name: 'Check out code'
uses: actions/checkout@v4
with: { submodules: true }
- name: 'Set up Developer Command Prompt'
if: matrix.vsversion
uses: ilammy/msvc-dev-cmd@v1
with:
vsversion: ${{ matrix.vsversion }}
arch: ${{ matrix.arch }}
- name: 'Build cmake Make Debug'
shell: bash
run: |
xtarget="windows-make-${{ matrix.cc }}-${{ matrix.vsversion }}-${{ matrix.arch}}"
echo "xtarget=$xtarget" >> $GITHUB_ENV
make UPX_XTARGET=$xtarget xtarget/debug
ls -l build/xtarget/$xtarget/*/upx.exe
file build/xtarget/$xtarget/*/upx.exe || true
- name: 'Build cmake Make Release'
shell: bash
run: |
make UPX_XTARGET=$xtarget xtarget/release
ls -l build/xtarget/$xtarget/*/upx.exe
file build/xtarget/$xtarget/*/upx.exe || true
- name: 'Make artifact'
shell: bash
run: |
N=$(echo "upx-${GITHUB_REF_NAME}-${GITHUB_SHA:0:7}-weekly-ci-make-${xtarget}" | sed 's/[^0-9a-zA-Z_.-]/-/g')
mkdir -p "tmp/artifact/$N"
(cd build && cp -ai --parents xtarget/*/*/upx.exe "../tmp/artifact/$N")
# GitHub Actions magic: set "artifact_name" environment value for use in next step
echo "artifact_name=$N" >> $GITHUB_ENV
- name: ${{ format('Upload artifact {0}', env.artifact_name) }}
uses: actions/upload-artifact@v3
with:
name: ${{ env.artifact_name }}
path: tmp/artifact
- name: 'Run basic tests'
if: ${{ matrix.arch != 'amd64_arm64' }}
shell: bash
run: |
ctest --test-dir build/xtarget/$xtarget/debug
ctest --test-dir build/xtarget/$xtarget/release
- name: 'Run install tests'
shell: bash
run: |
env DESTDIR=./Install-debug cmake --install build/xtarget/$xtarget/debug
env DESTDIR=./Install-release cmake --install build/xtarget/$xtarget/release

View File

@ -0,0 +1,84 @@
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
# BS BuildSystem: build on Windows with 'cmake -G Ninja'
name: 'Weekly CI BS - cmake Windows Ninja'
on:
schedule: [cron: '25 1 * * 3'] # run weekly Wednesday 01:25 UTC
workflow_dispatch:
env:
CMAKE_REQUIRED_QUIET: OFF
DEBIAN_FRONTEND: noninteractive
UPX_CMAKE_BUILD_FLAGS: --verbose
UPX_CMAKE_CONFIG_FLAGS: -G Ninja
jobs:
job-cmake-windows-nmake: # uses cmake + nmake
if: github.repository_owner == 'upx'
strategy:
fail-fast: false
matrix:
include:
# mingw-gcc
- { os: windows-2022, cc: gcc, cxx: 'g++', arch: amd64 }
# clang-cl
- { os: windows-2022, cc: clang-cl, cxx: clang-cl, vsversion: 2022, arch: amd64 }
# msvc
- { os: windows-2019, cc: cl, cxx: cl, vsversion: 2019, arch: amd64 }
- { os: windows-2019, cc: cl, cxx: cl, vsversion: 2019, arch: amd64_arm64 }
- { os: windows-2019, cc: cl, cxx: cl, vsversion: 2019, arch: amd64_x86 }
- { os: windows-2022, cc: cl, cxx: cl, vsversion: 2022, arch: amd64 }
- { os: windows-2022, cc: cl, cxx: cl, vsversion: 2022, arch: amd64_arm64 }
- { os: windows-2022, cc: cl, cxx: cl, vsversion: 2022, arch: amd64_x86 }
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
name: ${{ format('{0} {1} {2}', matrix.cc, matrix.vsversion, matrix.arch) }}
runs-on: ${{ matrix.os }}
steps:
- name: 'Check out code'
uses: actions/checkout@v4
with: { submodules: true }
- name: 'Set up Developer Command Prompt'
if: matrix.vsversion
uses: ilammy/msvc-dev-cmd@v1
with:
vsversion: ${{ matrix.vsversion }}
arch: ${{ matrix.arch }}
- name: 'Build cmake Ninja Debug'
shell: bash
run: |
xtarget="windows-ninja-${{ matrix.cc }}-${{ matrix.vsversion }}-${{ matrix.arch}}"
echo "xtarget=$xtarget" >> $GITHUB_ENV
make UPX_XTARGET=$xtarget xtarget/debug
ls -l build/xtarget/$xtarget/*/upx.exe
file build/xtarget/$xtarget/*/upx.exe || true
- name: 'Build cmake Ninja Release'
shell: bash
run: |
make UPX_XTARGET=$xtarget xtarget/release
ls -l build/xtarget/$xtarget/*/upx.exe
file build/xtarget/$xtarget/*/upx.exe || true
- name: 'Make artifact'
shell: bash
run: |
N=$(echo "upx-${GITHUB_REF_NAME}-${GITHUB_SHA:0:7}-weekly-ci-ninja-${xtarget}" | sed 's/[^0-9a-zA-Z_.-]/-/g')
mkdir -p "tmp/artifact/$N"
(cd build && cp -ai --parents xtarget/*/*/upx.exe "../tmp/artifact/$N")
# GitHub Actions magic: set "artifact_name" environment value for use in next step
echo "artifact_name=$N" >> $GITHUB_ENV
- name: ${{ format('Upload artifact {0}', env.artifact_name) }}
uses: actions/upload-artifact@v3
with:
name: ${{ env.artifact_name }}
path: tmp/artifact
- name: 'Run basic tests'
if: ${{ matrix.arch != 'amd64_arm64' }}
shell: bash
run: |
ctest --test-dir build/xtarget/$xtarget/debug
ctest --test-dir build/xtarget/$xtarget/release
- name: 'Run install tests'
shell: bash
run: |
env DESTDIR=./Install-debug cmake --install build/xtarget/$xtarget/debug
env DESTDIR=./Install-release cmake --install build/xtarget/$xtarget/release

View File

@ -1,11 +1,9 @@
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
# BS BuildSystem: build with 'cmake -G "NMake Makefiles"'
# also tests "clang-cl"
# BS BuildSystem: build on Windows with 'cmake -G "NMake Makefiles"'
name: 'Weekly CI BS - cmake Windows NMake'
on:
schedule: [cron: '20 1 * * 3'] # run weekly Wednesday 01:20 UTC
schedule: [cron: '30 1 * * 3'] # run weekly Wednesday 01:30 UTC
workflow_dispatch:
env:
CMAKE_REQUIRED_QUIET: OFF
@ -18,6 +16,8 @@ jobs:
fail-fast: false
matrix:
include:
# clang-cl
- { os: windows-2022, vsversion: 2022, arch: amd64, clang_cl: true }
# msvc
- { os: windows-2019, vsversion: 2019, arch: amd64 }
- { os: windows-2019, vsversion: 2019, arch: amd64_arm64 }
@ -25,8 +25,6 @@ jobs:
- { os: windows-2022, vsversion: 2022, arch: amd64 }
- { os: windows-2022, vsversion: 2022, arch: amd64_arm64 }
- { os: windows-2022, vsversion: 2022, arch: amd64_x86 }
# clang-cl
- { os: windows-2022, vsversion: 2022, arch: amd64, clang_cl: true }
name: ${{ format('vs{0} {1} {2}', matrix.vsversion, matrix.arch, matrix.clang_cl && 'clang-cl' || '') }}
runs-on: ${{ matrix.os }}
steps:

View File

@ -54,11 +54,11 @@ function(upx_cache_bool_vars)
list(REMOVE_AT ARGV 0)
foreach(var ${ARGV})
set(value ${default_value})
if(DEFINED UPX_CACHE_${var})
if(DEFINED UPX_CACHE_${var}) # cached
set(value "${UPX_CACHE_${var}}")
elseif(DEFINED ${var})
elseif(DEFINED ${var}) # defined via "cmake -DXXX=YYY"
set(value "${${var}}")
elseif("$ENV{${var}}" MATCHES "^(0|1|OFF|ON|FALSE|TRUE)$")
elseif("$ENV{${var}}" MATCHES "^(0|1|OFF|ON|FALSE|TRUE)$") # environment
set(value "$ENV{${var}}")
set(UPX_CACHE_ORIGIN_FROM_ENV_${var} TRUE CACHE INTERNAL "" FORCE)
endif()

View File

@ -20,27 +20,21 @@ endif
# enable this if you prefer Ninja for the actual builds:
#UPX_CMAKE_CONFIG_FLAGS += -G Ninja
# CMake honors CC and CXX; explicitly pass optional CMAKE_AR and CMAKE_RANLIB
is_set = $(and $($1),$(or $(findstring command line,$(origin $1)),$(findstring environment,$(origin $1))))
ifneq ($(call is_set,CMAKE_AR),)
UPX_CMAKE_CONFIG_FLAGS += -DCMAKE_AR="$(CMAKE_AR)"
endif
ifneq ($(call is_set,CMAKE_RANLIB),)
UPX_CMAKE_CONFIG_FLAGS += -DCMAKE_RANLIB="$(CMAKE_RANLIB)"
endif
# undocumented: CMAKE_NM, CMAKE_OBJCOPY, CMAKE_OBJDUMP and CMAKE_STRIP
ifneq ($(call is_set,CMAKE_NM),)
UPX_CMAKE_CONFIG_FLAGS += -DCMAKE_NM="$(CMAKE_NM)"
endif
ifneq ($(call is_set,CMAKE_OBJCOPY),)
UPX_CMAKE_CONFIG_FLAGS += -DCMAKE_OBJCOPY="$(CMAKE_OBJCOPY)"
endif
ifneq ($(call is_set,CMAKE_OBJDUMP),)
UPX_CMAKE_CONFIG_FLAGS += -DCMAKE_OBJDUMP="$(CMAKE_OBJDUMP)"
endif
ifneq ($(call is_set,CMAKE_STRIP),)
UPX_CMAKE_CONFIG_FLAGS += -DCMAKE_STRIP="$(CMAKE_STRIP)"
endif
# by default CMake only honors CC and CXX; make it easy to use other
# variables like CMAKE_AR by manually passing them
__add_cmake_config = $(and $($1),-D$1="$($1)")
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_AR)
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_NM)
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_RANLIB)
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_OBJCOPY)
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_OBJDUMP)
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_STRIP)
# pass UPX config options from environment/make to cmake; see CMakeLists.txt
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_DISABLE_GITREV)
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_DISABLE_SANITIZE)
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_DISABLE_WSTRICT)
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_DISABLE_WERROR)
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_DISABLE_SELF_PACK_TEST)
#***********************************************************************
# default