Test winget availability

This commit is contained in:
A13501350
2025-09-20 19:27:22 +08:00
parent 4662e7581d
commit 9165787ae6

View File

@@ -9,76 +9,102 @@ on:
- v2/test-ci-windows - v2/test-ci-windows
jobs: jobs:
build: test-winget:
runs-on: windows-latest name: Test winget availability
runs-on: windows-latest # 使用最新的 Windows Server 运行器
# For Caching
permissions:
actions: read
contents: read
steps: steps:
- name: Checkout code - name: Check if winget is installed
uses: actions/checkout@v5
- name: Setup MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
update: true
install: >
git
make
autoconf
automake
libtool
mingw-w64-ucrt-x86_64-gcc
mingw-w64-ucrt-x86_64-pkg-config
- name: Clone and build ssdeep
shell: msys2 {0}
run: | run: |
MSYS2_WORKSPACE=$(cygpath -u '${{ github.workspace }}') # 检查 winget 是否可用
echo "Converted workspace path: $MSYS2_WORKSPACE" winget --version
if ($LASTEXITCODE -eq 0) {
git clone https://github.com/ssdeep-project/ssdeep.git --depth 1 Write-Host "✅ winget is installed and working correctly"
cd ssdeep } else {
autoreconf -i Write-Error "❌ winget is not available or not functioning properly"
./configure --enable-shared --disable-static CFLAGS="-O3" CXXFLAGS="-O3" exit 1
make dll }
shell: pwsh # 使用 PowerShell 作为 shell
mkdir -p "${MSYS2_WORKSPACE}/ssdeep-install/bin"
mkdir -p "${MSYS2_WORKSPACE}/ssdeep-install/include" - name: Optional - List installed packages (if winget is available)
cp -v fuzzy.dll "${MSYS2_WORKSPACE}/ssdeep-install/bin/" if: success()
cp -v fuzzy.h "${MSYS2_WORKSPACE}/ssdeep-install/include/"
cp -v fuzzy.def "${MSYS2_WORKSPACE}/ssdeep-install/"
- name: Restore vcpkg cache
id: vcpkg-cache
uses: TAServers/vcpkg-cache@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
prefix: vcpkg-iis-module/
- name: Configure CMake for IIS Module
env:
VCPKG_FEATURE_FLAGS: "binarycaching"
VCPKG_BINARY_SOURCES: "clear;files,${{ steps.vcpkg-cache.outputs.path }},readwrite"
run: | run: |
cmake ` # 列出已安装的包以验证 winget 功能
-DAPACHE_ROOT="C:\tools\Apache24" ` winget list --name "Microsoft Visual C++"
-DSSDEEP_ROOT="${{ github.workspace }}\ssdeep-install" ` Write-Host "winget functionality verified successfully"
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}\install" `
-DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT\scripts\buildsystems\vcpkg.cmake" `
-DWITH_SSDEEP=ON `
-DWITH_LUA=ON `
-DWITH_YAJL=ON `
-S IIS -B iis\build
- name: Build IIS Module
shell: pwsh shell: pwsh
run: |
cmake --build iis\build --config Release # jobs:
# build:
# runs-on: windows-latest
# # For Caching
# permissions:
# actions: read
# contents: read
# steps:
# - name: Checkout code
# uses: actions/checkout@v5
# - name: Setup MSYS2
# uses: msys2/setup-msys2@v2
# with:
# msystem: UCRT64
# update: true
# install: >
# git
# make
# autoconf
# automake
# libtool
# mingw-w64-ucrt-x86_64-gcc
# mingw-w64-ucrt-x86_64-pkg-config
# - name: Clone and build ssdeep
# shell: msys2 {0}
# run: |
# MSYS2_WORKSPACE=$(cygpath -u '${{ github.workspace }}')
# echo "Converted workspace path: $MSYS2_WORKSPACE"
# git clone https://github.com/ssdeep-project/ssdeep.git --depth 1
# cd ssdeep
# autoreconf -i
# ./configure --enable-shared --disable-static CFLAGS="-O3" CXXFLAGS="-O3"
# make dll
# mkdir -p "${MSYS2_WORKSPACE}/ssdeep-install/bin"
# mkdir -p "${MSYS2_WORKSPACE}/ssdeep-install/include"
# cp -v fuzzy.dll "${MSYS2_WORKSPACE}/ssdeep-install/bin/"
# cp -v fuzzy.h "${MSYS2_WORKSPACE}/ssdeep-install/include/"
# cp -v fuzzy.def "${MSYS2_WORKSPACE}/ssdeep-install/"
# - name: Restore vcpkg cache
# id: vcpkg-cache
# uses: TAServers/vcpkg-cache@v3
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
# prefix: vcpkg-iis-module/
# - name: Configure CMake for IIS Module
# env:
# VCPKG_FEATURE_FLAGS: "binarycaching"
# VCPKG_BINARY_SOURCES: "clear;files,${{ steps.vcpkg-cache.outputs.path }},readwrite"
# run: |
# cmake `
# -DAPACHE_ROOT="C:\tools\Apache24" `
# -DSSDEEP_ROOT="${{ github.workspace }}\ssdeep-install" `
# -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}\install" `
# -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT\scripts\buildsystems\vcpkg.cmake" `
# -DWITH_SSDEEP=ON `
# -DWITH_LUA=ON `
# -DWITH_YAJL=ON `
# -S IIS -B iis\build
# - name: Build IIS Module
# shell: pwsh
# run: |
# cmake --build iis\build --config Release
# - name: Package IIS Module with WiX # - name: Package IIS Module with WiX
# shell: pwsh # shell: pwsh