Skip to content

Commit 66b20ea

Browse files
committed
find iis
1 parent df8e7e4 commit 66b20ea

1 file changed

Lines changed: 167 additions & 146 deletions

File tree

.github/workflows/test-ci-windows.yml

Lines changed: 167 additions & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -9,157 +9,178 @@ on:
99
- v2/test-ci-windows
1010

1111
jobs:
12-
build:
13-
strategy:
14-
matrix:
15-
arch: [x86, x64]
16-
runs-on: windows-latest
12+
# build:
13+
# strategy:
14+
# matrix:
15+
# arch: [x86, x64]
16+
# runs-on: windows-latest
1717

18-
# For Caching
19-
permissions:
20-
actions: read
21-
contents: read
22-
23-
steps:
24-
- name: Checkout code
25-
uses: actions/checkout@v5
26-
27-
- name: Install Apache for x86
28-
if: matrix.arch == 'x86'
29-
shell: pwsh
30-
run: |
31-
$apachePath = "${{ github.workspace }}\apache-x86"
32-
New-Item -ItemType Directory -Path $apachePath -Force
33-
choco install apache-httpd -y --force --forcex86 --no-progress -r --params="`"/installLocation:$apachePath /noService`""
34-
echo "APACHE_ROOT=$apachePath\Apache24" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
35-
36-
- name: Set Apache path for x64
37-
if: matrix.arch == 'x64'
38-
shell: pwsh
39-
run: |
40-
echo "APACHE_ROOT=C:\tools\Apache24" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
41-
42-
- name: Setup MSYS2
43-
uses: msys2/setup-msys2@v2
44-
with:
45-
msystem: ${{ matrix.arch == 'x86' && 'MINGW32' || 'UCRT64' }}
46-
update: true
47-
install: >
48-
git
49-
make
50-
autoconf
51-
automake
52-
libtool
53-
${{ matrix.arch == 'x86' && 'mingw-w64-i686-gcc' || 'mingw-w64-ucrt-x86_64-gcc' }}
54-
${{ matrix.arch == 'x86' && 'mingw-w64-i686-pkg-config' || 'mingw-w64-ucrt-x86_64-pkg-config' }}
55-
56-
- name: Clone and build ssdeep
57-
shell: msys2 {0}
58-
run: |
59-
MSYS2_WORKSPACE=$(cygpath -u '${{ github.workspace }}')
60-
echo "Converted workspace path: $MSYS2_WORKSPACE"
61-
62-
git clone https://github.com/ssdeep-project/ssdeep.git --depth 1
63-
cd ssdeep
64-
autoreconf -i
18+
# # For Caching
19+
# permissions:
20+
# actions: read
21+
# contents: read
22+
23+
# steps:
24+
# - name: Checkout code
25+
# uses: actions/checkout@v5
26+
27+
# - name: Install Apache for x86
28+
# if: matrix.arch == 'x86'
29+
# shell: pwsh
30+
# run: |
31+
# $apachePath = "${{ github.workspace }}\apache-x86"
32+
# New-Item -ItemType Directory -Path $apachePath -Force
33+
# choco install apache-httpd -y --force --forcex86 --no-progress -r --params="`"/installLocation:$apachePath /noService`""
34+
# echo "APACHE_ROOT=$apachePath\Apache24" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
35+
36+
# - name: Set Apache path for x64
37+
# if: matrix.arch == 'x64'
38+
# shell: pwsh
39+
# run: |
40+
# echo "APACHE_ROOT=C:\tools\Apache24" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
41+
42+
# - name: Setup MSYS2
43+
# uses: msys2/setup-msys2@v2
44+
# with:
45+
# msystem: ${{ matrix.arch == 'x86' && 'MINGW32' || 'UCRT64' }}
46+
# update: true
47+
# install: >
48+
# git
49+
# make
50+
# autoconf
51+
# automake
52+
# libtool
53+
# ${{ matrix.arch == 'x86' && 'mingw-w64-i686-gcc' || 'mingw-w64-ucrt-x86_64-gcc' }}
54+
# ${{ matrix.arch == 'x86' && 'mingw-w64-i686-pkg-config' || 'mingw-w64-ucrt-x86_64-pkg-config' }}
55+
56+
# - name: Clone and build ssdeep
57+
# shell: msys2 {0}
58+
# run: |
59+
# MSYS2_WORKSPACE=$(cygpath -u '${{ github.workspace }}')
60+
# echo "Converted workspace path: $MSYS2_WORKSPACE"
61+
62+
# git clone https://github.com/ssdeep-project/ssdeep.git --depth 1
63+
# cd ssdeep
64+
# autoreconf -i
6565

66-
if [ "${{ matrix.arch }}" = "x86" ]; then
67-
./configure --enable-shared --disable-static CFLAGS="-O3" CXXFLAGS="-O3" --build=i686-pc-mingw32
68-
else
69-
./configure --enable-shared --disable-static CFLAGS="-O3" CXXFLAGS="-O3"
70-
fi
66+
# if [ "${{ matrix.arch }}" = "x86" ]; then
67+
# ./configure --enable-shared --disable-static CFLAGS="-O3" CXXFLAGS="-O3" --build=i686-pc-mingw32
68+
# else
69+
# ./configure --enable-shared --disable-static CFLAGS="-O3" CXXFLAGS="-O3"
70+
# fi
7171

72-
make dll
73-
74-
mkdir -p "${MSYS2_WORKSPACE}/ssdeep-install-${{ matrix.arch }}/bin"
75-
mkdir -p "${MSYS2_WORKSPACE}/ssdeep-install-${{ matrix.arch }}/include"
76-
cp -v fuzzy.dll "${MSYS2_WORKSPACE}/ssdeep-install-${{ matrix.arch }}/bin/"
77-
cp -v fuzzy.h "${MSYS2_WORKSPACE}/ssdeep-install-${{ matrix.arch }}/include/"
78-
cp -v fuzzy.def "${MSYS2_WORKSPACE}/ssdeep-install-${{ matrix.arch }}/"
79-
80-
- name: Restore vcpkg cache
81-
id: vcpkg-cache
82-
uses: TAServers/vcpkg-cache@v3
83-
with:
84-
token: ${{ secrets.GITHUB_TOKEN }}
85-
prefix: vcpkg-iis-module-${{ matrix.arch }}/
86-
87-
- name: Configure CMake for IIS Module
88-
env:
89-
VCPKG_FEATURE_FLAGS: "binarycaching"
90-
VCPKG_BINARY_SOURCES: "clear;files,${{ steps.vcpkg-cache.outputs.path }},readwrite"
91-
VCPKG_DEFAULT_TRIPLET: ${{ matrix.arch }}-windows
92-
run: |
93-
$archFlag = "${{ matrix.arch }}"
94-
$cmakeArch = if ($archFlag -eq "x86") { "Win32" } else { "x64" }
95-
$installDir = if ($archFlag -eq "x86") { "x86" } else { "amd64" }
96-
97-
cmake `
98-
-DAPACHE_ROOT="$env:APACHE_ROOT" `
99-
-DSSDEEP_ROOT="${{ github.workspace }}\ssdeep-install-${{ matrix.arch }}" `
100-
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}\iis\release\$installDir" `
101-
-DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT\scripts\buildsystems\vcpkg.cmake" `
102-
-A $cmakeArch `
103-
-DWITH_SSDEEP=ON `
104-
-DWITH_LUA=ON `
105-
-DWITH_YAJL=ON `
106-
-S IIS -B "iis\build-${{ matrix.arch }}"
107-
108-
- name: Build IIS Module
109-
shell: pwsh
110-
run: |
111-
cmake --build "iis\build-${{ matrix.arch }}" --config Release
112-
113-
- name: Upload artifacts
114-
uses: actions/upload-artifact@v4
115-
with:
116-
name: iis-module-${{ matrix.arch }}
117-
path: iis/build-${{ matrix.arch }}/Release/
72+
# make dll
73+
74+
# mkdir -p "${MSYS2_WORKSPACE}/ssdeep-install-${{ matrix.arch }}/bin"
75+
# mkdir -p "${MSYS2_WORKSPACE}/ssdeep-install-${{ matrix.arch }}/include"
76+
# cp -v fuzzy.dll "${MSYS2_WORKSPACE}/ssdeep-install-${{ matrix.arch }}/bin/"
77+
# cp -v fuzzy.h "${MSYS2_WORKSPACE}/ssdeep-install-${{ matrix.arch }}/include/"
78+
# cp -v fuzzy.def "${MSYS2_WORKSPACE}/ssdeep-install-${{ matrix.arch }}/"
79+
80+
# - name: Restore vcpkg cache
81+
# id: vcpkg-cache
82+
# uses: TAServers/vcpkg-cache@v3
83+
# with:
84+
# token: ${{ secrets.GITHUB_TOKEN }}
85+
# prefix: vcpkg-iis-module-${{ matrix.arch }}/
86+
87+
# - name: Configure CMake for IIS Module
88+
# env:
89+
# VCPKG_FEATURE_FLAGS: "binarycaching"
90+
# VCPKG_BINARY_SOURCES: "clear;files,${{ steps.vcpkg-cache.outputs.path }},readwrite"
91+
# VCPKG_DEFAULT_TRIPLET: ${{ matrix.arch }}-windows
92+
# run: |
93+
# $archFlag = "${{ matrix.arch }}"
94+
# $cmakeArch = if ($archFlag -eq "x86") { "Win32" } else { "x64" }
95+
# $installDir = if ($archFlag -eq "x86") { "x86" } else { "amd64" }
96+
97+
# cmake `
98+
# -DAPACHE_ROOT="$env:APACHE_ROOT" `
99+
# -DSSDEEP_ROOT="${{ github.workspace }}\ssdeep-install-${{ matrix.arch }}" `
100+
# -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}\iis\release\$installDir" `
101+
# -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT\scripts\buildsystems\vcpkg.cmake" `
102+
# -A $cmakeArch `
103+
# -DWITH_SSDEEP=ON `
104+
# -DWITH_LUA=ON `
105+
# -DWITH_YAJL=ON `
106+
# -S IIS -B "iis\build-${{ matrix.arch }}"
107+
108+
# - name: Build IIS Module
109+
# shell: pwsh
110+
# run: |
111+
# cmake --build "iis\build-${{ matrix.arch }}" --config Release
112+
113+
# - name: Upload artifacts
114+
# uses: actions/upload-artifact@v4
115+
# with:
116+
# name: iis-module-${{ matrix.arch }}
117+
# path: iis/build-${{ matrix.arch }}/Release/
118118

119-
package:
120-
needs: build
119+
# package:
120+
# needs: build
121+
# runs-on: windows-latest
122+
# steps:
123+
# - name: Checkout code
124+
# uses: actions/checkout@v5
125+
126+
# - name: Download x64 artifacts
127+
# uses: actions/download-artifact@v4
128+
# with:
129+
# name: iis-module-x64
130+
# path: iis/release/amd64/
131+
132+
# - name: Download x86 artifacts
133+
# uses: actions/download-artifact@v4
134+
# with:
135+
# name: iis-module-x86
136+
# path: iis/release/x86/
137+
138+
# - name: Generate wxs files
139+
# shell: pwsh
140+
# run: |
141+
# heat dir "iis\release\amd64" -cg ModSec64Components -dr inetsrv64 -gg -sreg -srd -var var.ModSecurityIISRelease64 -out "iis\ModSec64.wxs"
142+
# heat dir "iis\release\x86" -cg ModSec32Components -dr inetsrv32 -gg -sreg -srd -var var.ModSecurityIISRelease32 -out "iis\ModSec32.wxs"
143+
144+
# - name: Compile wxs files
145+
# shell: pwsh
146+
# run: |
147+
# candle.exe -ext WixUtilExtension -ext WixUIExtension "iis\installer.wxs" "iis\ModSec64.wxs" -arch x64 -dModSecurityIISRelease64="iis\release\amd64\" -out iis\
148+
# candle.exe -ext WixUtilExtension -ext WixUIExtension "iis\ModSec32.wxs" -arch x86 -dModSecurityIISRelease32="iis\release\x86\" -out iis\
149+
150+
# - name: Link wixobj files into MSI
151+
# shell: pwsh
152+
# run: |
153+
# light.exe -ext WixUtilExtension -ext WixUIExtension "iis\installer.wixobj" "iis\ModSec32.wixobj" "iis\ModSec64.wixobj" -out "iis\modsecurityiis.msi"
154+
155+
# - name: Upload artifacts
156+
# uses: actions/upload-artifact@v4
157+
# with:
158+
# name: modsecurityiis-installers
159+
# path: iis/modsecurityiis.msi
160+
161+
test:
162+
needs: package
121163
runs-on: windows-latest
122164
steps:
123-
- name: Checkout code
124-
uses: actions/checkout@v5
125-
126-
- name: Download x64 artifacts
127-
uses: actions/download-artifact@v4
128-
with:
129-
name: iis-module-x64
130-
path: iis/release/amd64/
131-
132-
- name: Download x86 artifacts
133-
uses: actions/download-artifact@v4
134-
with:
135-
name: iis-module-x86
136-
path: iis/release/x86/
137-
138-
- name: Generate wxs files
139-
shell: pwsh
140-
run: |
141-
heat dir "iis\release\amd64" -cg ModSec64Components -dr inetsrv64 -gg -sreg -srd -var var.ModSecurityIISRelease64 -out "iis\ModSec64.wxs"
142-
heat dir "iis\release\x86" -cg ModSec32Components -dr inetsrv32 -gg -sreg -srd -var var.ModSecurityIISRelease32 -out "iis\ModSec32.wxs"
143-
144-
- name: Compile wxs files
145-
shell: pwsh
146-
run: |
147-
candle.exe -ext WixUtilExtension -ext WixUIExtension "iis\installer.wxs" "iis\ModSec64.wxs" -arch x64 -dModSecurityIISRelease64="iis\release\amd64\" -out iis\
148-
candle.exe -ext WixUtilExtension -ext WixUIExtension "iis\ModSec32.wxs" -arch x86 -dModSecurityIISRelease32="iis\release\x86\" -out iis\
149-
150-
- name: Link wixobj files into MSI
165+
- name: Enable IIS Feature
151166
shell: pwsh
152167
run: |
153-
light.exe -ext WixUtilExtension -ext WixUIExtension "iis\installer.wixobj" "iis\ModSec32.wixobj" "iis\ModSec64.wixobj" -out "iis\modsecurityiis.msi"
154-
155-
- name: Upload artifacts
156-
uses: actions/upload-artifact@v4
157-
with:
158-
name: modsecurityiis-installers
159-
path: iis/installer/modsecurityiis.msi
160-
161-
- name: Upload artifacts
162-
uses: actions/upload-artifact@v4
163-
with:
164-
name: modsecurityiis-installers
165-
path: iis/installer/modsecurityiis.msi
168+
$iisStatus = Get-WindowsFeature -Name Web-Server
169+
if ($iisStatus.Installed -eq $false) {
170+
Write-Host "IIS is not installed. Installing now..."
171+
Install-WindowsFeature -Name Web-Server -IncludeManagementTools
172+
} else {
173+
Write-Host "IIS is already installed."
174+
}
175+
Install-WindowsFeature -name Web-Server -IncludeManagementTools
176+
Install-WindowsFeature -name Web-Server, Web-ASP, Web-Mgmt-Tools, Web-WebSockets
177+
178+
# - name: Download MSI
179+
# uses: actions/download-artifact@v4
180+
# with:
181+
# name: modsecurityiis-installers
182+
# path: iis/
183+
184+
# - name: Install MSI
185+
# shell: pwsh
186+
# run: |

0 commit comments

Comments
 (0)