1111jobs :
1212 build :
1313 runs-on : windows-latest
14+ strategy :
15+ matrix :
16+ configuration : [Release, Debug]
1417
1518 steps :
1619 # Step 1: Checkout the repository
1720 - uses : actions/checkout@v4
1821 name : Checkout the repository
1922
20- # Step 2: Setup Visual Studio Environment
21- - name : Setup Visual Studio Environment
22- run : |
23- # Find Visual Studio installation
24- $vsPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
25- if ($vsPath) {
26- Write-Host "Found Visual Studio at: $vsPath"
27- # Set up environment variables
28- & "$vsPath\VC\Auxiliary\Build\vcvars64.bat" | Out-String
29- $env:PATH = "$vsPath\VC\Tools\MSVC\14.37.32822\bin\Hostx64\x64;$env:PATH"
30- } else {
31- Write-Host "Visual Studio not found, trying to install build tools..."
32- # Download and install Visual Studio Build Tools
33- $vsInstaller = "vs_buildtools.exe"
34- Invoke-WebRequest -Uri "https://aka.ms/vs/17/release/vs_buildtools.exe" -OutFile $vsInstaller
35- Start-Process -FilePath $vsInstaller -ArgumentList "--quiet", "--wait", "--norestart", "--nocache", "--installPath", "C:\BuildTools", "--add", "Microsoft.VisualStudio.Workload.VCTools" -Wait
36- Remove-Item $vsInstaller
37- $env:PATH = "C:\BuildTools\VC\Tools\MSVC\14.37.32822\bin\Hostx64\x64;$env:PATH"
38- }
39-
40- # Step 3: Setup CMake
23+ # Step 2: Setup CMake (same as AppVeyor)
4124 - name : Setup CMake
42254326 with :
4427 cmake-version : 3.28.0
4528
46- # Step 4: Setup Ninja
47- - name : Setup Ninja
48- uses : actions/setup-python@v5
49- with :
50- python-version : " 3.11"
51-
52- - name : Install Ninja
53- run : |
54- python -m pip install ninja
55- echo "$env:LOCALAPPDATA\Python\Python311\Scripts" >> $env:GITHUB_PATH
56-
57- # Step 5: Verify tools availability
58- - name : Verify tools
59- shell : cmd
60- run : |
61- call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
62- cmake --version
63- ninja --version
64- cl
65- echo Using Visual Studio compiler:
66- cl
29+ # Step 3: Verify CMake (same as AppVeyor)
30+ - name : Verify CMake
31+ run : cmake --version
6732
68- # Step 6 : Configure CMake with Visual Studio
33+ # Step 4 : Configure with CMake presets (same as AppVeyor)
6934 - name : Configure CMake
70- shell : cmd
71- run : |
72- call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
73- cmake -S . -G "Ninja Multi-Config" -B build -DCMAKE_CXX_FLAGS="/W3" -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl
35+ run : cmake --preset ninja-multi
7436
75- # Step 7 : Build with CMake
37+ # Step 5 : Build with CMake presets (same as AppVeyor)
7638 - name : Build with CMake
77- shell : cmd
7839 run : |
79- call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
80- cmake --build build --config Release
40+ if "${{ matrix.configuration }}"=="Debug" cmake --build --preset ninja-multi-debug
41+ if "${{ matrix.configuration }}"=="Release" cmake --build --preset ninja-multi-release
8142
82- # Step 8: Verify if build files are generated
83- - name : List build directory contents
84- run : Get-ChildItem -Path build -Recurse | Select-Object Name, FullName
85-
86- # Step 9: Generate Doxygen documentation
43+ # Step 6: Generate Doxygen documentation
8744 - name : Generate Doxygen documentation
8845 run : |
8946 # Install Doxygen if not available
@@ -92,22 +49,18 @@ jobs:
9249 }
9350 doxygen Doxyfile
9451
95- # Step 10: Verify if documentation files are generated
96- - name : List documentation directory contents
97- run : Get-ChildItem -Path docs -Recurse | Select-Object Name, FullName
98-
99- # Step 11: Upload documentation as an artifact (if files exist)
52+ # Step 7: Upload documentation as an artifact
10053 - name : Upload documentation
10154 uses : actions/upload-artifact@v4
10255 with :
103- name : cpp_documentation_windows
56+ name : cpp_documentation_windows_${{ matrix.configuration }}
10457 path : docs
10558
106- # Step 12 : Upload build artifacts as an artifact (if files exist)
59+ # Step 8 : Upload build artifacts as an artifact
10760 - name : Upload build artifacts
10861 uses : actions/upload-artifact@v4
10962 with :
110- name : cpp_build_output_windows
63+ name : cpp_build_output_windows_${{ matrix.configuration }}
11164 path : build
11265
11366 release :
@@ -120,27 +73,7 @@ jobs:
12073 - uses : actions/checkout@v4
12174 name : Checkout the repository
12275
123- # Step 2: Setup Visual Studio Environment
124- - name : Setup Visual Studio Environment
125- run : |
126- # Find Visual Studio installation
127- $vsPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
128- if ($vsPath) {
129- Write-Host "Found Visual Studio at: $vsPath"
130- # Set up environment variables
131- & "$vsPath\VC\Auxiliary\Build\vcvars64.bat" | Out-String
132- $env:PATH = "$vsPath\VC\Tools\MSVC\14.37.32822\bin\Hostx64\x64;$env:PATH"
133- } else {
134- Write-Host "Visual Studio not found, trying to install build tools..."
135- # Download and install Visual Studio Build Tools
136- $vsInstaller = "vs_buildtools.exe"
137- Invoke-WebRequest -Uri "https://aka.ms/vs/17/release/vs_buildtools.exe" -OutFile $vsInstaller
138- Start-Process -FilePath $vsInstaller -ArgumentList "--quiet", "--wait", "--norestart", "--nocache", "--installPath", "C:\BuildTools", "--add", "Microsoft.VisualStudio.Workload.VCTools" -Wait
139- Remove-Item $vsInstaller
140- $env:PATH = "C:\BuildTools\VC\Tools\MSVC\14.37.32822\bin\Hostx64\x64;$env:PATH"
141- }
142-
143- # Step 3: Create a GitHub release using the version tag (e.g., v1.0.0, v1.0.1)
76+ # Step 2: Create a GitHub release using the version tag (e.g., v1.0.0, v1.0.1)
14477 - name : Create Release
14578 id : create_release
14679 uses : actions/create-release@v1
15487 draft : false
15588 prerelease : false
15689
157- # Step 4 : Upload build artifacts to release
90+ # Step 3 : Upload build artifacts to release
15891 - name : Upload build artifacts to release
15992 uses : actions/upload-release-asset@v1
16093 with :
16396 asset_name : main_windows.exe # Adjust this to name the artifact file
16497 asset_content_type : application/octet-stream
16598
166- # Step 5 : Upload documentation to release
99+ # Step 4 : Upload documentation to release
167100 - name : Upload documentation to release
168101 uses : actions/upload-release-asset@v1
169102 with :
0 commit comments