# Copyright (C) Markus Franz Xaver Johannes Oberhumer # BS BuildSystem: build "by hand" using a POSIX-compliant shell name: 'Weekly CI BS - By Hand' on: schedule: [cron: '00 1 * * 3'] # run weekly Wednesday 01:00 UTC workflow_dispatch: env: CMAKE_REQUIRED_QUIET: 'OFF' CMAKE_VERBOSE_MAKEFILE: 'ON' CTEST_OUTPUT_ON_FAILURE: 'ON' DEBIAN_FRONTEND: noninteractive VERBOSE: 1 jobs: job-by-hand-alpinelinux-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' # Alpine 3.9 + latest Alpine release + edge strategy: { matrix: { container: ['alpine:3.9','alpine:3.19','alpine:edge','i386/alpine:edge'] } } name: ${{ format('by-hand gcc {0}', matrix.container) }} runs-on: ubuntu-latest container: ${{ matrix.container }} steps: - name: ${{ format('Install packages {0}', matrix.container) }} run: | # install ccache, g++, git and various POSIX shells shells="bash dash loksh mksh zsh" case ${{ matrix.container }} in *:3.19 | *:edge) shells="$shells oksh yash" ;; esac echo "installing shells: $shells" apk update && apk upgrade && apk add ccache g++ git $shells # enable ccache and some warnings xflags="-static -Wall -Wextra -Werror" echo -e "CC=ccache gcc $xflags\nCXX=ccache g++ -std=gnu++17 $xflags" >> $GITHUB_ENV # this seems to be needed when running in a container (beause of UID mismatch??) git config --global --add safe.directory '*' # create user upx:upx 2000:2000 for file system tests below ("sudo") adduser upx -u 2000 -D && cd /home/upx && chmod 00700 . && chown -R upx:upx . - name: ${{ format('Check out UPX {0} source code', github.ref_name) }} run: | git clone --branch "$GITHUB_REF_NAME" --depth 1 "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" "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' run: 'bash --posix "./upx with space/misc/scripts/build_upx_by_hand.sh"' - name: 'Build by-hand with busybox ash' run: 'busybox ash "./upx with space/misc/scripts/build_upx_by_hand.sh"' - name: 'Build by-hand with busybox sh' run: 'busybox sh "./upx with space/misc/scripts/build_upx_by_hand.sh"' - name: 'Build by-hand with dash' run: 'dash "./upx with space/misc/scripts/build_upx_by_hand.sh"' - name: 'Build by-hand with loksh' run: 'ksh "./upx with space/misc/scripts/build_upx_by_hand.sh"' - name: 'Build by-hand with loksh -o posix' run: 'ksh -o posix "./upx with space/misc/scripts/build_upx_by_hand.sh"' - name: 'Build by-hand with loksh -o sh' run: 'ksh -o sh "./upx with space/misc/scripts/build_upx_by_hand.sh"' - name: 'Build by-hand with mksh' run: 'mksh "./upx with space/misc/scripts/build_upx_by_hand.sh"' - name: 'Build by-hand with mksh -o posix' run: 'mksh -o posix "./upx with space/misc/scripts/build_upx_by_hand.sh"' - name: 'Build by-hand with mksh -o sh' run: 'mksh -o sh "./upx with space/misc/scripts/build_upx_by_hand.sh"' - name: 'Build by-hand with oksh' if: endsWith(matrix.container, ':3.19') || endsWith(matrix.container, ':edge') run: 'oksh "./upx with space/misc/scripts/build_upx_by_hand.sh"' - name: 'Build by-hand with oksh -o posix' if: endsWith(matrix.container, ':3.19') || endsWith(matrix.container, ':edge') run: 'oksh -o posix "./upx with space/misc/scripts/build_upx_by_hand.sh"' - name: 'Build by-hand with oksh -o sh' if: endsWith(matrix.container, ':3.19') || endsWith(matrix.container, ':edge') run: 'oksh -o sh "./upx with space/misc/scripts/build_upx_by_hand.sh"' - name: 'Build by-hand with yash' if: endsWith(matrix.container, ':3.19') || endsWith(matrix.container, ':edge') run: 'yash "./upx with space/misc/scripts/build_upx_by_hand.sh"' - name: 'Build by-hand with zsh' run: 'zsh "./upx with space/misc/scripts/build_upx_by_hand.sh"' - name: 'Build by-hand with zsh --emulate ksh' run: 'zsh --emulate ksh "./upx with space/misc/scripts/build_upx_by_hand.sh"' - name: 'Build by-hand with zsh --emulate sh' run: 'zsh --emulate sh "./upx with space/misc/scripts/build_upx_by_hand.sh"' - name: 'Show ccache stats' run: | ccache -s ccache -p - name: 'Run file system test suite (busybox)' run: | apk add bash sudo testsuite="$(readlink -fn "upx with space"/misc/testsuite/test_symlinks.sh)" cd "upx with space"/build/by-hand # IMPORTANT: do NOT run as user root! chmod a+w . && sudo -u upx bash "$testsuite" - name: 'Run file system test suite (coreutils)' run: | apk add bash coreutils sudo testsuite="$(readlink -fn "upx with space"/misc/testsuite/test_symlinks.sh)" 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-clang: # 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: 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 clang {0}', matrix.os) }} runs-on: ${{ matrix.os }} steps: - name: 'Install brew packages' run: | # install ccache if ! command -v ccache > /dev/null; then # only run "brew update" if needed if ! brew install ccache; then brew update && brew install ccache; fi fi xflags="-Wall -Wextra -Werror" echo -e "CC=ccache clang $xflags\nCXX=ccache clang++ -std=gnu++17 $xflags" >> $GITHUB_ENV - name: ${{ format('Check out UPX {0} source code', github.ref_name) }} run: | git clone --branch "$GITHUB_REF_NAME" --depth 1 "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" "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: 'Build by-hand with zsh' run: 'top_srcdir="$PWD/upx with space" zsh "./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-clang: # 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 clang {0}', matrix.os) }} runs-on: ${{ matrix.os }} steps: - run: git config --global core.autocrlf false - name: ${{ format('Check out UPX {0} source code', github.ref_name) }} shell: bash run: | git clone --branch "$GITHUB_REF_NAME" --depth 1 "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" "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" # clang uses the MSVC headers and libraries, so adjust settings xflags="$xflags -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS" export zlib_extra_flags="-DHAVE_VSNPRINTF" export AR_LIBFILE=upx_submodules.lib CC="clang $xflags" CXX="clang++ -std=gnu++17 $xflags" bash "./upx with space/misc/scripts/build_upx_by_hand.sh" 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: - run: git config --global core.autocrlf false - name: ${{ format('Check out UPX {0} source code', github.ref_name) }} shell: bash run: | git clone --branch "$GITHUB_REF_NAME" --depth 1 "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" "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" job-by-hand-windows-msvc: # 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: # clang-cl - { os: windows-2019, vsversion: 2019, arch: amd64, clang_cl: true } - { 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 } - { os: windows-2019, vsversion: 2019, arch: amd64_x86 } - { os: windows-2022, vsversion: 2022, arch: amd64 } - { os: windows-2022, vsversion: 2022, arch: amd64_arm64 } - { os: windows-2022, vsversion: 2022, arch: amd64_x86 } name: ${{ format('by-hand vs{0} {1} {2}', matrix.vsversion, matrix.arch, matrix.clang_cl && 'clang-cl' || '') }} runs-on: ${{ matrix.os }} steps: - run: git config --global core.autocrlf false - name: ${{ format('Check out UPX {0} source code', github.ref_name) }} shell: bash run: | git clone --branch "$GITHUB_REF_NAME" --depth 1 "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" "upx with space" git -C "upx with space" submodule update --init - name: 'Set up Developer Command Prompt' uses: ilammy/msvc-dev-cmd@cec98b9d092141f74527d0afa6feb2af698cfe89 # v1.12.1 with: vsversion: ${{ matrix.vsversion }} arch: ${{ matrix.arch }} - name: 'Build by-hand with bash' shell: bash run: | X="${{ matrix.clang_cl && 'clang-cl' || 'cl' }}" command -v cl clang-cl lib link # using MSVC headers and libraries, so adjust settings xflags="-MT -J -W3 -DWIN32_LEAN_AND_MEAN -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS" export mandatory_flags= export sensible_flags= export zlib_extra_flags="-DHAVE_VSNPRINTF" export AR=false export obj_suffix=.obj CC="$X $xflags" CXX="$X -std:c++17 -Zc:__cplusplus -EHsc $xflags" bash "./upx with space/misc/scripts/build_upx_by_hand.sh"