mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-11-15 17:12:14 +03:00
here we go again
This commit is contained in:
117
.github/workflows/test-ci-windows.yml
vendored
117
.github/workflows/test-ci-windows.yml
vendored
@@ -1,4 +1,4 @@
|
|||||||
name: File Generation and Reading Test
|
name: CI/CD for IIS Module
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -8,67 +8,62 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- v2/test-ci-windows
|
- v2/test-ci-windows
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
file-test:
|
build:
|
||||||
runs-on: windows-latest # 使用 Windows 运行器
|
runs-on: windows-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
- name: Generate test files (Step 1)
|
- name: Setup MSYS2
|
||||||
shell: powershell
|
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: |
|
||||||
# 创建工作目录
|
git clone https://github.com/ssdeep-project/ssdeep.git --depth 1
|
||||||
$testDir = "${{ github.workspace }}\test-files"
|
cd ssdeep
|
||||||
New-Item -ItemType Directory -Path $testDir -Force
|
autoreconf -i
|
||||||
|
./configure --enable-shared --disable-static CFLAGS="-O3" CXXFLAGS="-O3"
|
||||||
# 创建几个测试文件
|
make dll
|
||||||
"This is a test content for file1.txt" | Out-File -FilePath "$testDir\file1.txt"
|
mkdir -p ${{ github.workspace }}/ssdeep-install/bin
|
||||||
"fuzzy.def test content" | Out-File -FilePath "$testDir\fuzzy.def"
|
mkdir -p ${{ github.workspace }}/ssdeep-install/include
|
||||||
|
cp fuzzy.dll ${{ github.workspace }}/ssdeep-install/bin/
|
||||||
# 创建一个包含文件列表的 JSON 文件
|
cp fuzzy.h ${{ github.workspace }}/ssdeep-install/include/
|
||||||
$files = Get-ChildItem -Path $testDir
|
cp fuzzy.def ${{ github.workspace }}/ssdeep-install/
|
||||||
$fileInfo = @()
|
|
||||||
foreach ($file in $files) {
|
- name: Configure CMake for IIS Module
|
||||||
$fileInfo += @{
|
|
||||||
Name = $file.Name
|
|
||||||
Path = $file.FullName
|
|
||||||
Size = $file.Length
|
|
||||||
LastWriteTime = $file.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$fileInfo | ConvertTo-Json | Out-File -FilePath "$testDir\files.json"
|
|
||||||
|
|
||||||
# 输出生成的文件信息
|
|
||||||
Write-Host "Generated files:"
|
|
||||||
Get-ChildItem -Path $testDir | Format-Table Name, Length
|
|
||||||
|
|
||||||
- name: Read test files (Step 2)
|
|
||||||
shell: powershell
|
|
||||||
run: |
|
run: |
|
||||||
$testDir = "${{ github.workspace }}\test-files"
|
cmake `
|
||||||
|
-DAPACHE_ROOT="C:\tools\Apache24" `
|
||||||
# 检查目录是否存在
|
-DSSDEEP_ROOT="${{ github.workspace }}\ssdeep-install" `
|
||||||
if (-not (Test-Path -Path $testDir)) {
|
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}\install" `
|
||||||
Write-Error "Test directory does not exist!"
|
-DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}\vcpkg\scripts\buildsystems\vcpkg.cmake" `
|
||||||
exit 1
|
-DWITH_SSDEEP=ON `
|
||||||
}
|
-DWITH_LUA=ON `
|
||||||
|
-DWITH_YAJL=ON `
|
||||||
# 读取文件列表
|
-S IIS -B iis\build
|
||||||
$filesJson = Get-Content -Path "$testDir\files.json" -Raw | ConvertFrom-Json
|
|
||||||
Write-Host "Files found:"
|
- name: Build IIS Module
|
||||||
$filesJson | Format-Table Name, Size
|
shell: pwsh
|
||||||
|
run: |
|
||||||
# 读取特定文件内容
|
cmake --build iis\build --config Release
|
||||||
Write-Host "Content of fuzzy.def:"
|
|
||||||
Get-Content -Path "$testDir\fuzzy.def"
|
# - name: Package IIS Module with WiX
|
||||||
|
# shell: pwsh
|
||||||
# 验证文件存在
|
# run: |
|
||||||
if (Test-Path -Path "$testDir\fuzzy.def") {
|
# $CURRENT_DIR = "${{ github.workspace }}/iis/wix"
|
||||||
Write-Host "SUCCESS: fuzzy.def file exists and is accessible!"
|
# candle.exe -ext WixUtilExtension -ext WixUIExtension "$CURRENT_DIR\installer.wxs" -out "$CURRENT_DIR\installer.wixobj" -arch x64
|
||||||
} else {
|
# light.exe -ext WixUtilExtension -ext WixUIExtension "$CURRENT_DIR\installer.wixobj" -out "$CURRENT_DIR\installer-64.msi"
|
||||||
Write-Error "ERROR: fuzzy.def file not found!"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user