mirror of
				https://github.com/upx/upx
				synced 2025-10-19 23:42:44 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			86 lines
		
	
	
		
			3.6 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
			
		
		
	
	
			86 lines
		
	
	
		
			3.6 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
| # Copyright (C) Markus Franz Xaver Johannes Oberhumer
 | |
| # BS BuildSystem: build on Windows with 'cmake -G "NMake Makefiles"'
 | |
| 
 | |
| name: 'Weekly CI BS - cmake Windows NMake'
 | |
| on:
 | |
|   schedule: [cron: '40 1 * * 3'] # run weekly Wednesday 01:40 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'
 | |
| 
 | |
| jobs:
 | |
|   job-cmake-windows-nmake: # uses cmake + nmake
 | |
|     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('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: 'Check out code'
 | |
|         uses: actions/checkout@v4
 | |
|         with: { submodules: true }
 | |
|       - name: 'Set up Developer Command Prompt'
 | |
|         uses: ilammy/msvc-dev-cmd@cec98b9d092141f74527d0afa6feb2af698cfe89 # v1.12.1
 | |
|         with:
 | |
|           vsversion: ${{ matrix.vsversion }}
 | |
|           arch: ${{ matrix.arch }}
 | |
|       - name: 'Build cmake NMake Debug'
 | |
|         shell: cmd
 | |
|         run: |
 | |
|           set X=${{ matrix.clang_cl && '-DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl' || '' }}
 | |
|           cmake -S . -B build/debug -G "NMake Makefiles" -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=Debug %X%
 | |
|           cd build/debug
 | |
|           nmake
 | |
|           dir *.exe          
 | |
|       - name: 'Build cmake NMake Release'
 | |
|         if: success() || failure() # run this step even if the previous step failed
 | |
|         shell: cmd
 | |
|         run: |
 | |
|           set X=${{ matrix.clang_cl && '-DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl' || '' }}
 | |
|           cmake -S . -B build/release -G "NMake Makefiles" -DCMAKE_VERBOSE_MAKEFILE=ON %X%
 | |
|           cd build/release
 | |
|           nmake
 | |
|           dir *.exe          
 | |
|       - name: 'Make artifact'
 | |
|         shell: bash
 | |
|         run: |
 | |
|           X="${{ matrix.clang_cl && '-clang-cl' || '' }}"
 | |
|           N=$(echo "upx-${GITHUB_REF_NAME}-${GITHUB_SHA:0:7}-weekly-ci-nmake-vs${{ matrix.vsversion }}-${{ matrix.arch }}$X" | sed 's/[^0-9a-zA-Z_.-]/-/g')
 | |
|           mkdir -p "tmp/artifact/$N"
 | |
|           (cd build && cp -ai --parents */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' }}
 | |
|         run: |
 | |
|           ctest --test-dir build/debug
 | |
|           ctest --test-dir build/release
 | |
|           .\build\debug\upx.exe --sysinfo -v
 | |
|           .\build\release\upx.exe --sysinfo -v          
 | |
|       - name: 'Run install tests'
 | |
|         run: |
 | |
|           env DESTDIR=./Install-debug   cmake --install build/debug
 | |
|           env DESTDIR=./Install-release cmake --install build/release          
 | 
