11
11
jobs :
12
12
build :
13
13
runs-on : windows-latest
14
+ strategy :
15
+ matrix :
16
+ configuration : [Release, Debug]
14
17
15
18
steps :
16
19
# Step 1: Checkout the repository
17
20
- uses : actions/checkout@v4
18
21
name : Checkout the repository
19
22
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)
41
24
- name : Setup CMake
42
25
uses : jwlawson/actions-setup-cmake@v1.14
43
26
with :
44
27
cmake-version : 3.28.0
45
28
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
67
32
68
- # Step 6 : Configure CMake with Visual Studio
33
+ # Step 4 : Configure with CMake presets (same as AppVeyor)
69
34
- 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
74
36
75
- # Step 7 : Build with CMake
37
+ # Step 5 : Build with CMake presets (same as AppVeyor)
76
38
- name : Build with CMake
77
- shell : cmd
78
39
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
81
42
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
87
44
- name : Generate Doxygen documentation
88
45
run : |
89
46
# Install Doxygen if not available
@@ -92,22 +49,18 @@ jobs:
92
49
}
93
50
doxygen Doxyfile
94
51
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
100
53
- name : Upload documentation
101
54
uses : actions/upload-artifact@v4
102
55
with :
103
- name : cpp_documentation_windows
56
+ name : cpp_documentation_windows_${{ matrix.configuration }}
104
57
path : docs
105
58
106
- # Step 12 : Upload build artifacts as an artifact (if files exist)
59
+ # Step 8 : Upload build artifacts as an artifact
107
60
- name : Upload build artifacts
108
61
uses : actions/upload-artifact@v4
109
62
with :
110
- name : cpp_build_output_windows
63
+ name : cpp_build_output_windows_${{ matrix.configuration }}
111
64
path : build
112
65
113
66
release :
@@ -120,27 +73,7 @@ jobs:
120
73
- uses : actions/checkout@v4
121
74
name : Checkout the repository
122
75
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)
144
77
- name : Create Release
145
78
id : create_release
146
79
uses : actions/create-release@v1
154
87
draft : false
155
88
prerelease : false
156
89
157
- # Step 4 : Upload build artifacts to release
90
+ # Step 3 : Upload build artifacts to release
158
91
- name : Upload build artifacts to release
159
92
uses : actions/upload-release-asset@v1
160
93
with :
163
96
asset_name : main_windows.exe # Adjust this to name the artifact file
164
97
asset_content_type : application/octet-stream
165
98
166
- # Step 5 : Upload documentation to release
99
+ # Step 4 : Upload documentation to release
167
100
- name : Upload documentation to release
168
101
uses : actions/upload-release-asset@v1
169
102
with :
0 commit comments