# 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' CMAKE_VERBOSE_MAKEFILE: 'ON' CTEST_OUTPUT_ON_FAILURE: 'ON' DEBIAN_FRONTEND: noninteractive UPX_CONFIG_EXPECT_THREADS: 'ON' UPX_CMAKE_BUILD_FLAGS: --verbose UPX_CMAKE_CONFIG_FLAGS: -G "Unix Makefiles" -Wdev --warn-uninitialized jobs: job-cmake-windows-make: # uses cmake + make if: github.repository_owner == 'upx' strategy: fail-fast: false matrix: include: # INFO: the following don't work with GNU make (probably some quoting problems with spaces or backslashes) # => use Ninja generator instead; see weekly-ci-bs-cmake-windows-ninja.yml # # cl (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 } # # clang-cl # - { os: windows-2019, cc: clang-cl, cxx: clang-cl, vsversion: 2019, arch: amd64 } # - { os: windows-2022, cc: clang-cl, cxx: clang-cl, vsversion: 2022, arch: amd64 } # clang - { os: windows-2019, cc: clang, cxx: 'clang++', arch: amd64, xflags: '-static' } - { os: windows-2022, cc: clang, cxx: 'clang++', arch: amd64, xflags: '-static' } # gcc (mingw-gcc) - { os: windows-2019, cc: gcc, cxx: 'g++', arch: amd64, xflags: '-static' } - { os: windows-2022, cc: gcc, cxx: 'g++', arch: amd64, xflags: '-static' } env: CC: ${{ matrix.cc }} ${{ matrix.xflags }} CXX: ${{ matrix.cxx }} ${{ matrix.xflags }} name: ${{ format('{0} {1} {2} {3}', matrix.cc, matrix.vsversion, matrix.arch, matrix.os) }} runs-on: ${{ matrix.os }} steps: - run: git config --global core.autocrlf false - 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@cec98b9d092141f74527d0afa6feb2af698cfe89 # v1.12.1 with: vsversion: ${{ matrix.vsversion }} arch: ${{ matrix.arch }} - name: 'Init environment' shell: bash run: | xtarget="${{ matrix.os }}-make-${{ matrix.cc }}-${{ matrix.vsversion }}-${{ matrix.arch}}" echo "xtarget=$xtarget" >> $GITHUB_ENV - name: 'Build cmake Make Debug' shell: bash run: | make UPX_XTARGET=$xtarget xtarget/debug ls -l build/xtarget/$xtarget/debug/upx.exe file build/xtarget/$xtarget/debug/upx.exe || true - name: 'Build cmake Make Release' if: success() || failure() # run this step even if the previous step failed shell: bash run: | make UPX_XTARGET=$xtarget xtarget/release ls -l build/xtarget/$xtarget/release/upx.exe file build/xtarget/$xtarget/release/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@v4 with: name: ${{ env.artifact_name }} path: tmp/artifact - name: 'Run ctest tests' if: ${{ matrix.arch != 'amd64_arm64' }} shell: bash run: | ctest --test-dir build/xtarget/$xtarget/debug ctest --test-dir build/xtarget/$xtarget/release ./build/xtarget/$xtarget/debug/upx.exe --sysinfo -v ./build/xtarget/$xtarget/release/upx.exe --sysinfo -v - 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