CI updates

This commit is contained in:
Markus F.X.J. Oberhumer 2023-10-13 00:01:00 +02:00
parent 65b06f6046
commit 96dd9eeb44
6 changed files with 94 additions and 27 deletions

View File

@ -12,8 +12,8 @@ env:
CMAKE_REQUIRED_QUIET: OFF
DEBIAN_FRONTEND: noninteractive
UPX_CMAKE_BUILD_FLAGS: --verbose
# 2023-10-02
ZIG_DIST_VERSION: 0.12.0-dev.706+62a0fbdae
# 2023-10-12
ZIG_DIST_VERSION: 0.12.0-dev.890+8c6b0271c
jobs:
job-rebuild-and-verify-stubs:
@ -316,7 +316,7 @@ jobs:
where cl & where link
set RUN_CL=cl ${{ matrix.cl_machine_flags }} -MT
set RUN_LIB=link -lib ${{ matrix.link_machine_flags }}
set DEFS=-D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS
set DEFS=-D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -DWIN32_LEAN_AND_MEAN
set BDIR=%H%\build\%C%\%B%
git rev-parse --short=12 HEAD > %BDIR%\upx\.GITREV.txt
@REM ===== build bzip2 =====

View File

@ -11,12 +11,12 @@ env:
VERBOSE: 1
jobs:
job-alpine-by-hand: # uses a POSIX-compliant shell
job-by-hand-alpine-linux-gcc: # uses a POSIX-compliant shell
# ...and also uses a subdirectory "upx with space" in order to detect possible quoting issues
# ...and also uses ccache as we are running the same build-script again and again
if: github.repository_owner == 'upx'
strategy: { matrix: { container: ['alpine:3.9','alpine:3.18','alpine:edge','i386/alpine:edge'] } }
name: ${{ format('gcc by-hand {0}', matrix.container) }}
name: ${{ format('by-hand gcc {0}', matrix.container) }}
runs-on: ubuntu-latest
container: ${{ matrix.container }}
steps:
@ -40,6 +40,8 @@ jobs:
run: |
git clone --branch "$GITHUB_REF_NAME" --depth 1 https://github.com/upx/upx "upx with space"
git -C "upx with space" submodule update --init
- name: 'Build by-hand with /bin/sh'
run: '/bin/sh "./upx with space/misc/scripts/build_upx_by_hand.sh"'
- name: 'Build by-hand with bash'
run: 'bash "./upx with space/misc/scripts/build_upx_by_hand.sh"'
- name: 'Build by-hand with bash --posix'
@ -98,3 +100,54 @@ jobs:
cd "upx with space"/build/by-hand
# IMPORTANT: do NOT run as user root!
chmod a+w . && sudo -u upx bash "$testsuite"
job-by-hand-macos: # uses a POSIX-compliant shell
# ...and also uses a subdirectory "upx with space" in order to detect possible quoting issues
if: github.repository_owner == 'upx'
strategy:
fail-fast: false
matrix:
include:
- { os: macos-11, run_fs_test: false } # macos-11 does not have "readlink -f"
- { os: macos-12, run_fs_test: true }
- { os: macos-13, run_fs_test: true }
name: ${{ format('by-hand cc {0}', matrix.os) }}
runs-on: ${{ matrix.os }}
steps:
- name: ${{ format('Check out UPX {0} source code', github.ref_name) }}
run: |
git clone --branch "$GITHUB_REF_NAME" --depth 1 https://github.com/upx/upx "upx with space"
git -C "upx with space" submodule update --init
- name: 'Build by-hand with /bin/sh'
run: 'top_srcdir="$PWD/upx with space" /bin/sh "./upx with space/misc/scripts/build_upx_by_hand.sh"'
- name: 'Build by-hand with bash'
run: 'top_srcdir="$PWD/upx with space" bash "./upx with space/misc/scripts/build_upx_by_hand.sh"'
- name: 'Run file system test suite'
if: ${{ matrix.run_fs_test }}
run: |
testsuite="$(readlink -fn "upx with space"/misc/testsuite/test_symlinks.sh)"
cd "upx with space"/build/by-hand
bash "$testsuite"
job-by-hand-windows-gcc: # uses a POSIX-compliant shell
# ...and also uses a subdirectory "upx with space" in order to detect possible quoting issues
if: github.repository_owner == 'upx'
strategy:
fail-fast: false
matrix:
include:
- { os: windows-2019 }
- { os: windows-2022 }
name: ${{ format('by-hand gcc {0}', matrix.os) }}
runs-on: ${{ matrix.os }}
steps:
- name: ${{ format('Check out UPX {0} source code', github.ref_name) }}
shell: bash
run: |
git clone --branch "$GITHUB_REF_NAME" --depth 1 https://github.com/upx/upx "upx with space"
git -C "upx with space" submodule update --init
- name: 'Build by-hand with bash'
shell: bash
run: |
xflags="-static -Wall -Wextra -Werror"
CC="gcc $xflags" CXX="g++ -std=gnu++17 $xflags" bash "./upx with space/misc/scripts/build_upx_by_hand.sh"

View File

@ -17,15 +17,16 @@ jobs:
fail-fast: false
matrix:
include:
- { container: 'alpine:3.11', wine: false, i686_mingw: false } # skip testsuite; TODO: internal error: doctest check failed
- { container: 'alpine:3.12', wine: false, i686_mingw: false } # skip testsuite; TODO: internal error: doctest check failed
- { container: 'alpine:3.13', wine: true, i686_mingw: false }
- { container: 'alpine:3.14', wine: true, i686_mingw: false }
- { container: 'alpine:3.15', wine: true, i686_mingw: false }
- { container: 'alpine:3.16', wine: true, i686_mingw: false }
- { container: 'alpine:3.17', wine: true, i686_mingw: false }
- { container: 'alpine:3.18', wine: true, i686_mingw: true }
- { container: 'alpine:edge', wine: true, i686_mingw: true }
- { container: 'alpine:3.11', wine: false, i686_mingw: false } # skip Wine testsuite; TODO: internal error: doctest check failed
- { container: 'alpine:3.12', wine: false, i686_mingw: false } # skip Wine testsuite; TODO: internal error: doctest check failed
- { container: 'alpine:3.13', wine: true, i686_mingw: false } # wine-4.0.3
- { container: 'alpine:3.14', wine: true, i686_mingw: false } # wine-6.18
- { container: 'alpine:3.15', wine: true, i686_mingw: false } # wine-6.23
- { container: 'alpine:3.16', wine: true, i686_mingw: false } # wine-7.8
- { container: 'alpine:3.17', wine: true, i686_mingw: false } # wine-7.21
# Wine >= 8.0 can run i686 32-bit programs in WOW64 mode on pure 64-bit systems
- { container: 'alpine:3.18', wine: true, i686_mingw: true } # wine-8.13
- { container: 'alpine:edge', wine: true, i686_mingw: true } # wine-8.17
name: ${{ format('container {0}', matrix.container) }}
runs-on: ubuntu-latest
container: ${{ matrix.container }}
@ -52,13 +53,21 @@ jobs:
if: ${{ matrix.i686_mingw }}
run: 'make build/extra/cross-windows-mingw32/release'
- name: 'Build cmake extra/cross-windows-mingw64/debug'
# on Alpine 3.11 and 3.12 CMake does not find AR; Alpine >= 3.13 (with CMake 3.18) works
########run: 'make build/extra/cross-windows-mingw64/debug'
run: 'make build/extra/cross-windows-mingw64/debug -DCMAKE_AR=/usr/bin/x86_64-w64-mingw32-ar'
run: |
# on Alpine 3.11 and 3.12 CMake does not find AR; Alpine >= 3.13 (with CMake 3.18.4) works
X=
case ${{ matrix.container }} in
*:3.1[12]) X="CMAKE_AR=/usr/bin/x86_64-w64-mingw32-ar" ;;
esac
make build/extra/cross-windows-mingw64/debug $X
- name: 'Build cmake extra/cross-windows-mingw64/release'
# on Alpine 3.11 and 3.12 CMake does not find AR
########run: 'make build/extra/cross-windows-mingw64/release'
run: 'make build/extra/cross-windows-mingw64/release -DCMAKE_AR=/usr/bin/x86_64-w64-mingw32-ar'
run: |
# on Alpine 3.11 and 3.12 CMake does not find AR; Alpine >= 3.13 (with CMake 3.18.4) works
X=
case ${{ matrix.container }} in
*:3.1[12]) X="CMAKE_AR=/usr/bin/x86_64-w64-mingw32-ar" ;;
esac
make build/extra/cross-windows-mingw64/release $X
- name: 'Make artifact'
shell: bash
run: |

View File

@ -10,8 +10,8 @@ on:
env:
CMAKE_REQUIRED_QUIET: OFF
DEBIAN_FRONTEND: noninteractive
# 2023-10-02
ZIG_DIST_VERSION: 0.12.0-dev.706+62a0fbdae
# 2023-10-12
ZIG_DIST_VERSION: 0.12.0-dev.890+8c6b0271c
jobs:
job-linux-zigcc: # uses cmake + make

View File

@ -155,11 +155,13 @@ if(is_multi_config)
set(CMAKE_CONFIGURATION_TYPES "${c}" CACHE STRING "List of supported configuration types." FORCE)
endif()
# set MSVC_FRONTEND
set(MSVC_FRONTEND 0)
if(MSVC OR CMAKE_C_COMPILER_FRONTEND_VARIANT MATCHES "^MSVC")
# set MSVC_FRONTEND and MINGW
if(NOT DEFINED MSVC_FRONTEND AND (MSVC OR CMAKE_C_COMPILER_FRONTEND_VARIANT MATCHES "^MSVC"))
set(MSVC_FRONTEND 1)
endif()
if(NOT DEFINED MINGW AND CMAKE_C_PLATFORM_ID MATCHES "^MinGW")
set(MINGW 1)
endif()
#***********************************************************************
# common compilation flags
@ -230,12 +232,13 @@ if(NOT CMAKE_C_COMPILER_ID MATCHES "^MSVC")
set(CMAKE_C_FLAGS_RELEASE "${a}" CACHE STRING "Flags used by the C compiler during RELEASE builds." FORCE)
set(CMAKE_CXX_FLAGS_RELEASE "${b}" CACHE STRING "Flags used by the CXX compiler during RELEASE builds." FORCE)
endif()
if(MSVC_FRONTEND OR WIN32)
if(MSVC_FRONTEND OR WIN32 OR MINGW OR CYGWIN)
# disable silly warnings about using "deprecated" POSIX functions like fopen()
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
add_definitions(-D_CRT_NONSTDC_NO_WARNINGS)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-DWIN32_LEAN_AND_MEAN)
endif()
if(MSVC_FRONTEND)
# use -funsigned-char; set __cplusplus according to selected C++ standard
@ -274,7 +277,7 @@ function(upx_sanitize_target)
# no-op
elseif(MSVC_FRONTEND)
# MSVC uses -GS (similar to -fstack-protector) by default
elseif(CMAKE_C_PLATFORM_ID MATCHES "^MinGW" OR MINGW OR CYGWIN)
elseif(MINGW OR CYGWIN)
# avoid link errors with current MinGW-w64 versions
# see https://www.mingw-w64.org/contribute/#sanitizers-asan-tsan-usan
else()

View File

@ -26,6 +26,8 @@ if test "x$AR" = "x0" || test "x$AR" = "xfalse" || test "x$AR" = "x/bin/false";
fi
# protect against security threats caused by misguided compiler "optimizations"
mandatory_flags="-fno-strict-aliasing -fno-strict-overflow -funsigned-char"
# not mandatory but good practice when using <windows.h>:
mandatory_flags="$mandatory_flags -DWIN32_LEAN_AND_MEAN"
if test "x$OPTIMIZE" != "x" && test "x$OPTIMIZE" != "x0"; then
# not mandatory and not minimal, but usually a good idea:
mandatory_flags="-Wall -O2 $mandatory_flags"