Weekly CI BS - cmake Windows Ninja #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: '30 1 * * 3'] # run weekly Wednesday 01:30 UTC | |
workflow_dispatch: | |
env: | |
CMAKE_REQUIRED_QUIET: "OFF" | |
CTEST_OUTPUT_ON_FAILURE: "ON" | |
DEBIAN_FRONTEND: noninteractive | |
UPX_CMAKE_BUILD_FLAGS: --verbose | |
UPX_CMAKE_CONFIG_FLAGS: -G Ninja | |
jobs: | |
job-cmake-windows-ninja: # uses cmake + ninja | |
if: github.repository_owner == 'upx' | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# 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}', 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@cec98b9d092141f74527d0afa6feb2af698cfe89 # v1.12.1 | |
with: | |
vsversion: ${{ matrix.vsversion }} | |
arch: ${{ matrix.arch }} | |
- name: 'Init environment' | |
shell: bash | |
run: | | |
command -v ninja >/dev/null || choco install -y --no-progress ninja | |
xtarget="${{ matrix.os }}-ninja-${{ matrix.cc }}-${{ matrix.vsversion }}-${{ matrix.arch}}" | |
echo "xtarget=$xtarget" >> $GITHUB_ENV | |
- name: 'Build cmake Ninja 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 Ninja Release' | |
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-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 |