From 8ba87a6d33c4852e9bef2f4bb2dc390e5cdb4150 Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Wed, 23 Jul 2025 11:00:41 +0200 Subject: [PATCH] CI updates --- .github/workflows/ci.yml | 32 +++----------------------- CMakeLists.txt | 2 +- Makefile | 21 +++++++++++++++-- misc/cmake/self_pack_test.cmake | 6 +++-- misc/make/Makefile-extra.mk | 1 + misc/podman/rebuild-stubs/Dockerfile | 4 ++-- misc/podman/rebuild-stubs/packages.txt | 6 ++--- misc/testsuite/mimic_ctest.sh | 5 ++-- 8 files changed, 35 insertions(+), 42 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8205b7d7..4cbdf94f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,6 +8,8 @@ name: CI on: [push, workflow_dispatch] +defaults: { run: { shell: bash } } + env: CMAKE_REQUIRED_QUIET: 'OFF' CMAKE_VERBOSE_MAKEFILE: 'ON' @@ -75,7 +77,6 @@ jobs: make -C doc clean all if ! git diff --quiet; then git diff || true; fi # ignore diff error - name: Clean up - shell: bash run: | git ls-files -z --others --ignored --exclude-standard ./src/stub | xargs -0r rm -v -- find ./src/stub/src -type d -name tmp -print0 | xargs -0r rmdir -v -- @@ -105,7 +106,6 @@ jobs: - run: ls -l build/*/*/*/upx* || true - run: file build/*/*/*/upx* || true - name: Make artifact - shell: bash run: | N=$(echo "upx-${GITHUB_REF_NAME}-${GITHUB_SHA:0:7}-${{ matrix.os }}-0" | sed 's/[^0-9a-zA-Z_.-]/-/g') mkdir -p "tmp/artifact/$N" @@ -117,7 +117,6 @@ jobs: uses: actions/upload-artifact@v4 with: { name: '${{ env.artifact_name }}', path: tmp/artifact } - name: Mimic ctest tests SIGSEGV - shell: bash run: | jobs="gcc/debug gcc/release clang/debug clang/release" echo "===== parallel jobs: $jobs" @@ -331,7 +330,6 @@ jobs: - run: ls -l build/*/*/*/upx* || true - run: file build/*/*/*/upx* || true - name: Make artifact - shell: bash run: | X="${{ matrix.xcode_version }}"; test -n "$X" && X="-xcode-$X" N=$(echo "upx-${GITHUB_REF_NAME}-${GITHUB_SHA:0:7}-${{ matrix.os }}$X" | sed 's/[^0-9a-zA-Z_.-]/-/g') @@ -414,7 +412,6 @@ jobs: - uses: ilammy/msvc-dev-cmd@v1 with: { vsversion: '${{ matrix.vsversion }}', arch: '${{ matrix.vsarch }}' } - name: Set platform - shell: bash run: | if [[ "${{ matrix.vsarch }}" == amd64 ]]; then true; echo "UPX_CMAKE_CONFIG_FLAGS_PLATFORM=-A x64" >> $GITHUB_ENV @@ -430,7 +427,6 @@ jobs: - run: make build/debug - run: make build/release - name: Make artifact - shell: bash run: | N=$(echo "upx-${GITHUB_REF_NAME}-${GITHUB_SHA:0:7}-${{ matrix.name }}" | sed 's/[^0-9a-zA-Z_.-]/-/g') mkdir -p "tmp/artifact/$N" @@ -455,13 +451,11 @@ jobs: ctest --test-dir build/release --parallel 8 -C Release - name: Mimic ctest tests if: ${{ matrix.vsarch != 'amd64_arm64' }} - shell: bash run: | env -C build/debug/Debug upx_exe=./upx.exe bash "$PWD"/misc/testsuite/mimic_ctest.sh env -C build/release/Release upx_exe=./upx.exe bash "$PWD"/misc/testsuite/mimic_ctest.sh - name: Run test suite build/release if: ${{ matrix.vsarch != 'amd64_arm64' }} - shell: bash run: | export upx_testsuite_SRCDIR="$(readlink -en ../deps/upx-testsuite)" env -C build/release/Release upx_exe=./upx.exe bash "$PWD"/misc/testsuite/upx_testsuite_1.sh @@ -491,7 +485,6 @@ jobs: - uses: actions/checkout@v4 with: { submodules: true } - name: Prepare sources and Check out test suite - shell: bash run: | git clone --depth=1 https://github.com/upx/upx-testsuite ../deps/upx-testsuite mkdir -p -v build/$C/$B/{bzip2,ucl,upx,zlib,zstd} @@ -540,7 +533,6 @@ jobs: set sources=%s%\*.cpp %s%\check\*.cpp %s%\compress\*.cpp %s%\console\*.cpp %s%\filter\*.cpp %s%\util\*.cpp %RUN_CL% -J -O2 -W4 -WX -std:c++17 -Zc:__cplusplus -EHsc -DUPX_VERSION_GITREV="""%GITREV%""" %DEFS% %UPX_DEFS% -I%H%\vendor -Feupx.exe %sources% %UPX_LIBS% /link ${{ matrix.link_machine_flags }} setargv.obj - name: Make artifact - shell: bash run: | N=$(echo "upx-${GITHUB_REF_NAME}-${GITHUB_SHA:0:7}-windows-${{ matrix.name }}" | sed 's/[^0-9a-zA-Z_.-]/-/g') mkdir -p "tmp/artifact/$N/$B" @@ -550,28 +542,12 @@ jobs: - name: ${{ format('Upload artifact {0}', env.artifact_name) }} uses: actions/upload-artifact@v4 with: { name: '${{ env.artifact_name }}', path: tmp/artifact } - - name: Run basic tests - if: ${{ matrix.vsarch != 'amd64_arm64' }} - run: | - $ErrorActionPreference = 'stop' - $ErrorView = 'NormalView' - cd $Env:H\build\$Env:C\$Env:B\upx - $Env:UPX = "--no-color --no-progress" - .\upx.exe --version - .\upx.exe --sysinfo -v - .\upx.exe upx.exe -o upx_packed.exe - dir *.exe - .\upx.exe -l upx_packed.exe - .\upx.exe -t upx_packed.exe - .\upx_packed.exe --version - name: Mimic ctest tests if: ${{ matrix.vsarch != 'amd64_arm64' }} - shell: bash run: | env -C build/$C/$B/upx upx_exe=./upx.exe bash "$PWD"/misc/testsuite/mimic_ctest.sh - name: Run test suite if: ${{ matrix.vsarch != 'amd64_arm64' }} - shell: bash run: | export upx_testsuite_SRCDIR="$(readlink -en ../deps/upx-testsuite)" env -C build/$C/$B/upx upx_exe=./upx.exe bash "$PWD"/misc/testsuite/upx_testsuite_1.sh @@ -627,8 +603,8 @@ jobs: ZIG_TARGET: ${{ matrix.zig_target }} steps: - run: uname -a; pwd; id; umask + shell: sh - name: Install Alpine Linux container packages - if: ${{ job.container }} shell: sh run: | apk update && apk upgrade && apk add bash cmake curl file gdb git make parallel patch strace tar util-linux xz zstd @@ -639,7 +615,6 @@ jobs: - uses: actions/checkout@v4 with: { submodules: true } - name: ${{ format('Install Zig {0}', env.ZIG_DIST_VERSION) }} - shell: bash run: | rev=$(git rev-parse --short=7 HEAD) echo "UPX_GITREV_SHORT=$rev" >> $GITHUB_ENV @@ -712,7 +687,6 @@ jobs: - run: ls -l build/*/*/*/upx* || true - run: file build/*/*/*/upx* || true - name: ${{ format('Make artifact from upx-{0}-{1}', github.ref_name, env.UPX_GITREV_SHORT) }} - shell: bash run: | N=$(echo "upx-${GITHUB_REF_NAME}-${GITHUB_SHA:0:7}-zigcc-${{ matrix.zig_target }}${ZIG_PIC}" | sed 's/[^0-9a-zA-Z_.-]/-/g') mkdir -p "tmp/artifact/$N" diff --git a/CMakeLists.txt b/CMakeLists.txt index 563642e3..5b90936c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,6 +31,7 @@ endif() include("${CMAKE_CURRENT_SOURCE_DIR}/misc/cmake/functions.cmake") upx_print_var(CMAKE_VERSION UPX_CONFIG_CMAKE_MINIMUM_REQUIRED_VERSION CMAKE_GENERATOR) upx_print_var(CMAKE_GENERATOR_TOOLSET CMAKE_GENERATOR_PLATFORM) +upx_print_env_var(CC CXX) #*********************************************************************** # options @@ -92,7 +93,6 @@ upx_cache_bool_vars(OFF UPX_CONFIG_DISABLE_SAVE_TEMPS UPX_CONFIG_DISABLE_SHARED_LIBS UPX_CONFIG_REQUIRE_THREADS ) upx_cache_bool_vars(ON UPX_CONFIG_EXPECT_THREADS) -upx_print_env_var(CC CXX) # determine Git revision set(GITREV_SHORT "") diff --git a/Makefile b/Makefile index 29e36bf2..929c271d 100644 --- a/Makefile +++ b/Makefile @@ -72,9 +72,26 @@ all+test build/all+test: build/debug+test build/release+test PHONY test: $$(patsubst %+test,%,$$(.DEFAULT_GOAL))+test PHONY -# +#*********************************************************************** +# install +#*********************************************************************** + +build/debug+install: $$(dir $$@)debug PHONY; cd "$(dir $@)debug" && $(CMAKE) --install . --config Debug +build/%/debug+install: $$(dir $$@)debug PHONY; cd "$(dir $@)debug" && $(CMAKE) --install . --config Debug +build/release+install: $$(dir $$@)release PHONY; cd "$(dir $@)release" && $(CMAKE) --install . --config Release +build/%/release+install: $$(dir $$@)release PHONY; cd "$(dir $@)release" && $(CMAKE) --install . --config Release +build/%/all+install: $$(dir $$@)debug+install $$(dir $$@)release+install PHONY ; + +# shortcuts +debug+install: build/debug+install PHONY +release+install: build/release+install PHONY +all+install build/all+install: build/debug+install build/release+install PHONY + +install: $$(patsubst %+install,%,$$(.DEFAULT_GOAL))+install PHONY + +#*********************************************************************** # END of Makefile -# +#*********************************************************************** # extra pre-defined build configurations and some utility; optional -include ./Makevars-local.mk diff --git a/misc/cmake/self_pack_test.cmake b/misc/cmake/self_pack_test.cmake index acc28e58..0d7e45e9 100644 --- a/misc/cmake/self_pack_test.cmake +++ b/misc/cmake/self_pack_test.cmake @@ -138,8 +138,10 @@ if(NOT UPX_CONFIG_DISABLE_EXHAUSTIVE_TESTS) set_tests_properties(upx-self-pack-${s} PROPERTIES COST "2${level}") endif() if(NOT UPX_CONFIG_DISABLE_RUN_PACKED_TEST) - upx_add_test(upx-run-packed-${s} ${emu} ./upx-packed-${s}${exe} --version-short) - upx_test_depends(upx-run-packed-${s} upx-self-pack-${s}) + foreach(i IN ITEMS 1 2 3 4 5 6 7 8 9) + upx_add_test(upx-run-packed-${s}-${i} ${emu} ./upx-packed-${s}${exe} --version-short) + upx_test_depends(upx-run-packed-${s}-${i} upx-self-pack-${s}) + endforeach() endif() endforeach() endforeach() diff --git a/misc/make/Makefile-extra.mk b/misc/make/Makefile-extra.mk index 814391b9..115bc9fc 100644 --- a/misc/make/Makefile-extra.mk +++ b/misc/make/Makefile-extra.mk @@ -333,6 +333,7 @@ $(call check_undefined,__add_cmake_config) __add_cmake_config = $(and $($1),-D$1="$($1)") # pass common CMake settings +UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_INSTALL_PREFIX) UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_VERBOSE_MAKEFILE) # pass common CMake toolchain settings UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_ADDR2LINE) diff --git a/misc/podman/rebuild-stubs/Dockerfile b/misc/podman/rebuild-stubs/Dockerfile index 5f8d6cf3..19e04444 100644 --- a/misc/podman/rebuild-stubs/Dockerfile +++ b/misc/podman/rebuild-stubs/Dockerfile @@ -8,8 +8,8 @@ ENV LANG=C.UTF-8 RUN dpkg --add-architecture i386 \ && apt-get update && apt-get upgrade -y \ && apt-get install -y --no-install-recommends \ - aria2 bash bash-completion ca-certificates curl git less libmpc3 \ - make ncurses-term perl-base tar time wget xz-utils \ + aria2 bash bash-completion ca-certificates coreutils curl diffutils findutils git grep gzip \ + less libmpc3 make ncurses-term perl-base sed tar time util-linux wget xz-utils \ libc6:i386 zlib1g:i386 \ # the following packages are not required for rebuilding the stubs, but # they do make the image *much* more convenient and also allow building diff --git a/misc/podman/rebuild-stubs/packages.txt b/misc/podman/rebuild-stubs/packages.txt index ed61cc66..8f2c92ad 100644 --- a/misc/podman/rebuild-stubs/packages.txt +++ b/misc/podman/rebuild-stubs/packages.txt @@ -67,7 +67,7 @@ ii gcc-14-base:i386 14.2.0-4ubuntu2~24.04 i386 ii gcc-multilib 4:13.2.0-7ubuntu1 amd64 GNU C compiler (multilib files) ii gcc-x86-64-linux-gnu 4:13.2.0-7ubuntu1 amd64 GNU C compiler for the amd64 architecture ii gdb 15.0.50.20240403-0ubuntu1 amd64 GNU Debugger -ii gh 2.45.0-1ubuntu0.2 amd64 GitHub CLI, GitHub’s official command line tool +ii gh 2.45.0-1ubuntu0.3 amd64 GitHub CLI, GitHub’s official command line tool ii git 1:2.43.0-1ubuntu7.3 amd64 fast, scalable, distributed revision control system ii git-man 1:2.43.0-1ubuntu7.3 all fast, scalable, distributed revision control system (manual pages) ii gojq 0.12.13-1ubuntu0.24.04.3 amd64 pure Go implementation of jq (program) @@ -80,7 +80,7 @@ ii ht 2.1.0+repack1-5 amd64 ii htop 3.3.0-4build1 amd64 interactive processes viewer ii hyperfine 1.18.0-2build1 amd64 Command-line benchmarking tool ii init-system-helpers 1.66ubuntu1 all helper tools for all init systems -ii jq 1.7.1-3build1 amd64 lightweight and flexible command-line JSON processor +ii jq 1.7.1-3ubuntu0.24.04.1 amd64 lightweight and flexible command-line JSON processor ii just 1.21.0-1 amd64 Save and run project-specific commands ii ksh 20240113 all transitional package ii ksh93u+m 1.0.8-1 amd64 AT&T KornShell @@ -171,7 +171,7 @@ ii libipt2 2.0.6-1build1 amd64 ii libisl23:amd64 0.26-3build1.1 amd64 manipulating sets and relations of integer points bounded by linear constraints ii libitm1:amd64 14.2.0-4ubuntu2~24.04 amd64 GNU Transactional Memory Library ii libjansson4:amd64 2.14-2build2 amd64 C library for encoding, decoding and manipulating JSON data -ii libjq1:amd64 1.7.1-3build1 amd64 lightweight and flexible command-line JSON processor - shared library +ii libjq1:amd64 1.7.1-3ubuntu0.24.04.1 amd64 lightweight and flexible command-line JSON processor - shared library ii libjsoncpp25:amd64 1.9.5-6build1 amd64 library for reading and writing JSON for C++ ii libk5crypto3:amd64 1.20.1-6ubuntu2.6 amd64 MIT Kerberos runtime libraries - Crypto Library ii libkeyutils1:amd64 1.6.3-3build1 amd64 Linux Key Management Utilities (library) diff --git a/misc/testsuite/mimic_ctest.sh b/misc/testsuite/mimic_ctest.sh index c7e89021..64d0f296 100755 --- a/misc/testsuite/mimic_ctest.sh +++ b/misc/testsuite/mimic_ctest.sh @@ -205,9 +205,8 @@ if [[ $UPX_CONFIG_DISABLE_EXHAUSTIVE_TESTS != ON ]]; then "${run_upx[@]}" -qq -d upx-packed-${s}${exe} ${fo} -o upx-unpacked-${s}${exe} cmp -s upx-unpacked${exe} upx-unpacked-${s}${exe} if [[ $UPX_CONFIG_DISABLE_RUN_PACKED_TEST != ON ]]; then - "${emu[@]}" ./upx-packed-${s}${exe} --version-short - for ((i = 0; i < 10; i++)); do - "${emu[@]}" ./upx-packed-${s}${exe} --version-short >/dev/null + for ((i = 0; i < 9; i++)); do + "${emu[@]}" ./upx-packed-${s}${exe} --version-short done fi done