mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-11-15 17:12:14 +03:00
test x86
This commit is contained in:
175
.github/workflows/test-ci-windows.yml
vendored
175
.github/workflows/test-ci-windows.yml
vendored
@@ -9,106 +9,113 @@ on:
|
||||
- v2/test-ci-windows
|
||||
|
||||
jobs:
|
||||
test-winget:
|
||||
name: Test winget availability
|
||||
runs-on: windows-latest # 使用最新的 Windows Server 运行器
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
arch: [x86, x64]
|
||||
runs-on: windows-latest
|
||||
|
||||
# For Caching
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- name: Check if winget is installed
|
||||
run: |
|
||||
# 检查 winget 是否可用
|
||||
winget --version
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host "✅ winget is installed and working correctly"
|
||||
} else {
|
||||
Write-Error "❌ winget is not available or not functioning properly"
|
||||
exit 1
|
||||
}
|
||||
shell: pwsh # 使用 PowerShell 作为 shell
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Optional - List installed packages (if winget is available)
|
||||
if: success()
|
||||
run: |
|
||||
# 列出已安装的包以验证 winget 功能
|
||||
winget list --name "Microsoft Visual C++"
|
||||
Write-Host "winget functionality verified successfully"
|
||||
- name: Install Apache for x86
|
||||
if: matrix.arch == 'x86'
|
||||
shell: pwsh
|
||||
run: |
|
||||
$apachePath = "${{ github.workspace }}\apache-x86"
|
||||
New-Item -ItemType Directory -Path $apachePath -Force
|
||||
choco install apache-httpd -y --force --forcex86 --params="`"/installLocation:$apachePath /noService`""
|
||||
# 设置环境变量供后续步骤使用
|
||||
echo "APACHE_ROOT=$apachePath\Apache24" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||
|
||||
# jobs:
|
||||
# build:
|
||||
# runs-on: windows-latest
|
||||
- name: Set Apache path for x64
|
||||
if: matrix.arch == 'x64'
|
||||
shell: pwsh
|
||||
run: |
|
||||
# 对于 x64,使用预装的 Apache
|
||||
echo "APACHE_ROOT=C:\tools\Apache24" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||
|
||||
# # For Caching
|
||||
# permissions:
|
||||
# actions: read
|
||||
# contents: read
|
||||
- name: Setup MSYS2
|
||||
uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
msystem: ${{ matrix.arch == 'x86' && 'MINGW32' || 'UCRT64' }}
|
||||
update: true
|
||||
install: >
|
||||
git
|
||||
make
|
||||
autoconf
|
||||
automake
|
||||
libtool
|
||||
${{ matrix.arch == 'x86' && 'mingw-w64-ucrt-i686-gcc' || 'mingw-w64-ucrt-x86_64-gcc' }}
|
||||
${{ matrix.arch == 'x86' && 'mingw-w64-ucrt-i686-pkg-config' || 'mingw-w64-ucrt-x86_64-pkg-config' }}
|
||||
|
||||
# steps:
|
||||
# - name: Checkout code
|
||||
# uses: actions/checkout@v5
|
||||
- name: Clone and build ssdeep
|
||||
shell: msys2 {0}
|
||||
run: |
|
||||
MSYS2_WORKSPACE=$(cygpath -u '${{ github.workspace }}')
|
||||
echo "Converted workspace path: $MSYS2_WORKSPACE"
|
||||
|
||||
# - 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
|
||||
git clone https://github.com/ssdeep-project/ssdeep.git --depth 1
|
||||
cd ssdeep
|
||||
autoreconf -i
|
||||
|
||||
# - name: Clone and build ssdeep
|
||||
# shell: msys2 {0}
|
||||
# run: |
|
||||
# MSYS2_WORKSPACE=$(cygpath -u '${{ github.workspace }}')
|
||||
# echo "Converted workspace path: $MSYS2_WORKSPACE"
|
||||
if [ "${{ matrix.arch }}" = "x86" ]; then
|
||||
./configure --enable-shared --disable-static CFLAGS="-O3" CXXFLAGS="-O3" --build=i686-pc-mingw32
|
||||
else
|
||||
./configure --enable-shared --disable-static CFLAGS="-O3" CXXFLAGS="-O3"
|
||||
fi
|
||||
|
||||
# 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
|
||||
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/"
|
||||
mkdir -p "${MSYS2_WORKSPACE}/ssdeep-install-${{ matrix.arch }}/bin"
|
||||
mkdir -p "${MSYS2_WORKSPACE}/ssdeep-install-${{ matrix.arch }}/include"
|
||||
cp -v fuzzy.dll "${MSYS2_WORKSPACE}/ssdeep-install-${{ matrix.arch }}/bin/"
|
||||
cp -v fuzzy.h "${MSYS2_WORKSPACE}/ssdeep-install-${{ matrix.arch }}/include/"
|
||||
cp -v fuzzy.def "${MSYS2_WORKSPACE}/ssdeep-install-${{ matrix.arch }}/"
|
||||
|
||||
# - name: Restore vcpkg cache
|
||||
# id: vcpkg-cache
|
||||
# uses: TAServers/vcpkg-cache@v3
|
||||
# with:
|
||||
# token: ${{ secrets.GITHUB_TOKEN }}
|
||||
# prefix: vcpkg-iis-module/
|
||||
- name: Restore vcpkg cache
|
||||
id: vcpkg-cache
|
||||
uses: TAServers/vcpkg-cache@v3
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
prefix: vcpkg-iis-module-${{ matrix.arch }}/
|
||||
|
||||
# - 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: Configure CMake for IIS Module
|
||||
env:
|
||||
VCPKG_FEATURE_FLAGS: "binarycaching"
|
||||
VCPKG_BINARY_SOURCES: "clear;files,${{ steps.vcpkg-cache.outputs.path }},readwrite"
|
||||
VCPKG_DEFAULT_TRIPLET: ${{ matrix.arch }}-windows
|
||||
run: |
|
||||
$archFlag = "${{ matrix.arch }}"
|
||||
$cmakeArch = if ($archFlag -eq "x86") { "Win32" } else { "x64" }
|
||||
|
||||
# - name: Build IIS Module
|
||||
# shell: pwsh
|
||||
# run: |
|
||||
# cmake --build iis\build --config Release
|
||||
cmake `
|
||||
-DAPACHE_ROOT="$env:APACHE_ROOT" `
|
||||
-DSSDEEP_ROOT="${{ github.workspace }}\ssdeep-install-${{ matrix.arch }}" `
|
||||
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}\install-${{ matrix.arch }}" `
|
||||
-DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT\scripts\buildsystems\vcpkg.cmake" `
|
||||
-A $cmakeArch `
|
||||
-DWITH_SSDEEP=ON `
|
||||
-DWITH_LUA=ON `
|
||||
-DWITH_YAJL=ON `
|
||||
-S IIS -B "iis\build-${{ matrix.arch }}"
|
||||
|
||||
- name: Build IIS Module
|
||||
shell: pwsh
|
||||
run: |
|
||||
cmake --build "iis\build-${{ matrix.arch }}" --config Release
|
||||
|
||||
# - name: Package IIS Module with WiX
|
||||
# shell: pwsh
|
||||
# run: |
|
||||
# $CURRENT_DIR = "${{ github.workspace }}/iis/wix"
|
||||
# candle.exe -ext WixUtilExtension -ext WixUIExtension "$CURRENT_DIR\installer.wxs" -out "$CURRENT_DIR\installer.wixobj" -arch x64
|
||||
# light.exe -ext WixUtilExtension -ext WixUIExtension "$CURRENT_DIR\installer.wixobj" -out "$CURRENT_DIR\installer-64.msi"
|
||||
# $arch = "${{ matrix.arch }}"
|
||||
# $wixArch = if ($arch -eq "x86") { "x86" } else { "x64" }
|
||||
# candle.exe -ext WixUtilExtension -ext WixUIExtension "$CURRENT_DIR\installer.wxs" -out "$CURRENT_DIR\installer.wixobj" -arch $wixArch
|
||||
# light.exe -ext WixUtilExtension -ext WixUIExtension "$CURRENT_DIR\installer.wixobj" -out "$CURRENT_DIR\installer-$arch.msi"
|
||||
Reference in New Issue
Block a user