@@ -20,76 +20,6 @@ concurrency:
20
20
cancel-in-progress : true
21
21
22
22
jobs :
23
- cpptests :
24
- if : ${{ !contains(fromJSON('["schedule", "workflow_dispatch"]'), github.event_name) }}
25
- timeout-minutes : 45
26
- name : C++ tests (Windows)
27
- runs-on : ${{ matrix.os }}
28
- strategy :
29
- matrix :
30
- os : [windows-latest]
31
- pl_backend : ["lightning_qubit"]
32
- steps :
33
- - name : Checkout PennyLane-Lightning
34
- uses : actions/checkout@v3
35
-
36
- - name : Configure MSVC for amd64 # Use cl.exe as a default compiler
37
- uses : ilammy/msvc-dev-cmd@v1
38
- with :
39
- arch : amd64
40
-
41
- - name : Install lapack with vcpkg
42
- run : |
43
- git clone --quiet --recursive https://github.com/microsoft/vcpkg.git
44
- cd vcpkg
45
- .\bootstrap-vcpkg.bat
46
- vcpkg install lapack
47
-
48
- - name : Setup OpenCppCoverage and add to PATH
49
- run : |
50
- choco install OpenCppCoverage -y
51
- echo "C:\Program Files\OpenCppCoverage" >> $env:GITHUB_PATH
52
-
53
- - name : Build and run unit tests for code coverage
54
- run : |
55
- cmake -BBuild `
56
- -DBUILD_TESTS=ON `
57
- -DENABLE_OPENMP=OFF `
58
- -DENABLE_PYTHON=OFF `
59
- -DENABLE_GATE_DISPATCHER=OFF `
60
- -DPL_BACKEND=${{ matrix.pl_backend }} `
61
- -DENABLE_LAPACK=ON `
62
- -DCMAKE_TOOLCHAIN_FILE=D:/a/pennylane-lightning/pennylane-lightning/vcpkg/scripts/buildsystems/vcpkg.cmake `
63
- -DENABLE_WARNINGS=OFF
64
- cmake --build .\Build --config Debug
65
- mkdir -p .\Build\tests\results
66
- $test_bins = Get-ChildItem -Include *.exe -Recurse -Path ./Build/Debug
67
- foreach ($file in $test_bins)
68
- {
69
- $filename = $file.ToString() -replace '.{4}$'
70
- $filename = $filename.Substring($filename.LastIndexOf("\")+1)
71
- $test_call = $file.ToString() + " --order lex --reporter junit --out .\Build\tests\results\report_" + $filename + ".xml"
72
- Invoke-Expression $test_call
73
- $cov_call = "OpenCppCoverage --sources pennylane_lightning\core\src --export_type cobertura:coverage.xml " + $file.ToString()
74
- Invoke-Expression $cov_call
75
- }
76
- Move-Item -Path .\coverage.xml -Destination .\coverage-${{ github.job }}-${{ matrix.pl_backend }}.xml
77
-
78
- - name : Upload test results
79
- uses : actions/upload-artifact@v3
80
- if : always()
81
- with :
82
- name : windows-test-report-${{ github.job }}-${{ matrix.pl_backend }}
83
- path : .\Build\tests\results\
84
- if-no-files-found : error
85
-
86
- - name : Upload coverage results
87
- uses : actions/upload-artifact@v3
88
- with :
89
- name : windows-coverage-report
90
- path : .\coverage-${{ github.job }}-${{ matrix.pl_backend }}.xml
91
- if-no-files-found : error
92
-
93
23
win-set-matrix-x86 :
94
24
name : Set builder matrix
95
25
runs-on : ubuntu-latest
110
40
exec_model : ${{ steps.exec_model.outputs.exec_model }}
111
41
kokkos_version : ${{ steps.kokkos_version.outputs.kokkos_version }}
112
42
113
- build_dependencies :
43
+ build_dependencies_kokkos :
114
44
needs : [win-set-matrix-x86]
115
45
strategy :
116
46
fail-fast : false
125
55
steps :
126
56
- name : Cache installation directories
127
57
id : kokkos-cache
128
- uses : actions/cache@v3
58
+ uses : actions/cache@v4
129
59
with :
130
60
path : D:\a\install_dir\${{ matrix.exec_model }}
131
61
key : ${{ matrix.os }}-kokkos${{ matrix.kokkos_version }}-${{ matrix.exec_model }}-Debug
@@ -163,9 +93,111 @@ jobs:
163
93
cmake --build ./Build --config Debug --verbose
164
94
cmake --install ./Build --config Debug --verbose
165
95
96
+ build_dependencies_vcpkg :
97
+ strategy :
98
+ fail-fast : false
99
+ matrix :
100
+ os : [windows-latest]
101
+ timeout-minutes : 30
102
+ name : vcpkg dependencies
103
+ runs-on : ${{ matrix.os }}
104
+
105
+ steps :
106
+ - name : Cache installation directories
107
+ id : vcpkg-cache
108
+ uses : actions/cache@v4
109
+ with :
110
+ path : D:\a\install_dir\vcpkg
111
+ key : ${{ matrix.os }}-vcpkg
112
+
113
+ - name : Clone vcpkg
114
+ if : steps.vcpkg-cache.outputs.cache-hit != 'true'
115
+ run : |
116
+ mkdir -p D:\a\install_dir
117
+ cd D:\a\install_dir\
118
+ git clone --quiet --recursive https://github.com/microsoft/vcpkg.git
119
+
120
+ - name : Install dependencies
121
+ if : steps.vcpkg-cache.outputs.cache-hit != 'true'
122
+ run : |
123
+ python -m pip install cmake build ninja
124
+
125
+ - name : Build Lapack library
126
+ if : steps.vcpkg-cache.outputs.cache-hit != 'true'
127
+ run : |
128
+ cd D:\a\install_dir\vcpkg
129
+ .\bootstrap-vcpkg.bat
130
+ vcpkg install lapack
131
+
132
+ cpptests :
133
+ needs : [build_dependencies_vcpkg]
134
+ if : ${{ !contains(fromJSON('["schedule", "workflow_dispatch"]'), github.event_name) }}
135
+ timeout-minutes : 30
136
+ name : C++ tests (Windows)
137
+ runs-on : ${{ matrix.os }}
138
+ strategy :
139
+ matrix :
140
+ os : [windows-latest]
141
+ pl_backend : ["lightning_qubit"]
142
+ steps :
143
+ - name : Checkout PennyLane-Lightning
144
+ uses : actions/checkout@v3
145
+
146
+ - name : Restoring cached vcpkg
147
+ id : vcpkg-cache
148
+ uses : actions/cache@v4
149
+ with :
150
+ path : D:\a\install_dir\vcpkg
151
+ key : ${{ matrix.os }}-vcpkg
152
+
153
+ - name : Setup OpenCppCoverage and add to PATH
154
+ run : |
155
+ choco install OpenCppCoverage -y
156
+ echo "C:\Program Files\OpenCppCoverage" >> $env:GITHUB_PATH
157
+
158
+ - name : Build and run unit tests for code coverage
159
+ run : |
160
+ cmake -BBuild `
161
+ -DBUILD_TESTS=ON `
162
+ -DENABLE_OPENMP=OFF `
163
+ -DENABLE_PYTHON=OFF `
164
+ -DENABLE_GATE_DISPATCHER=OFF `
165
+ -DPL_BACKEND=${{ matrix.pl_backend }} `
166
+ -DENABLE_LAPACK=ON `
167
+ -DCMAKE_TOOLCHAIN_FILE=D:\a\install_dir\vcpkg\scripts\buildsystems\vcpkg.cmake `
168
+ -DENABLE_WARNINGS=OFF
169
+ cmake --build .\Build --config RelWithDebInfo
170
+ mkdir -p .\Build\tests\results
171
+ $test_bins = Get-ChildItem -Include *.exe -Recurse -Path ./Build/RelWithDebInfo
172
+ foreach ($file in $test_bins)
173
+ {
174
+ $filename = $file.ToString() -replace '.{4}$'
175
+ $filename = $filename.Substring($filename.LastIndexOf("\")+1)
176
+ $test_call = $file.ToString() + " --order lex --reporter junit --out .\Build\tests\results\report_" + $filename + ".xml"
177
+ Invoke-Expression $test_call
178
+ $cov_call = "OpenCppCoverage --sources pennylane_lightning\core\src --excluded_modules D:\a\install_dir\* --excluded_modules C:\Windows\System32\* --export_type cobertura:coverage.xml " + $file.ToString()
179
+ Invoke-Expression $cov_call
180
+ }
181
+ Move-Item -Path .\coverage.xml -Destination .\coverage-${{ github.job }}-${{ matrix.pl_backend }}.xml
182
+
183
+ - name : Upload test results
184
+ uses : actions/upload-artifact@v3
185
+ if : always()
186
+ with :
187
+ name : windows-test-report-${{ github.job }}-${{ matrix.pl_backend }}
188
+ path : .\Build\tests\results\
189
+ if-no-files-found : error
190
+
191
+ - name : Upload coverage results
192
+ uses : actions/upload-artifact@v3
193
+ with :
194
+ name : windows-coverage-report
195
+ path : .\coverage-${{ github.job }}-${{ matrix.pl_backend }}.xml
196
+ if-no-files-found : error
197
+
166
198
cpptestswithkokkos :
167
199
if : ${{ !contains(fromJSON('["schedule", "workflow_dispatch"]'), github.event_name) }}
168
- needs : [build_dependencies , win-set-matrix-x86]
200
+ needs : [build_dependencies_kokkos, build_dependencies_vcpkg , win-set-matrix-x86]
169
201
strategy :
170
202
matrix :
171
203
os : [windows-latest]
@@ -180,32 +212,27 @@ jobs:
180
212
steps :
181
213
- name : Restoring cached Kokkos
182
214
id : kokkos-cache
183
- uses : actions/cache@v3
215
+ uses : actions/cache@v4
184
216
with :
185
217
path : D:\a\install_dir\${{ matrix.exec_model }}
186
218
key : ${{ matrix.os }}-kokkos${{ matrix.kokkos_version }}-${{ matrix.exec_model }}-Debug
219
+
220
+ - name : Restoring cached vcpkg
221
+ id : vcpkg-cache
222
+ uses : actions/cache@v4
223
+ with :
224
+ path : D:\a\install_dir\vcpkg
225
+ key : ${{ matrix.os }}-vcpkg
187
226
188
227
- name : Checkout PennyLane-Lightning
189
228
uses : actions/checkout@v3
190
229
191
- - name : Copy cached libraries
230
+ - name : Copy cached Kokkos libraries
192
231
if : steps.kokkos-cache.outputs.cache-hit == 'true'
193
232
run : |
194
233
Copy-Item -Path "D:\a\install_dir\${{ matrix.exec_model }}\" `
195
234
-Destination "D:\a\pennylane-lightning\pennylane-lightning\Kokkos" -Recurse -Force
196
235
197
- - name : Configure MSVC for amd64 # Use cl.exe as a default compiler
198
- uses : ilammy/msvc-dev-cmd@v1
199
- with :
200
- arch : amd64
201
-
202
- - name : Install lapack with vcpkg
203
- run : |
204
- git clone --quiet --recursive https://github.com/microsoft/vcpkg.git
205
- cd vcpkg
206
- .\bootstrap-vcpkg.bat
207
- vcpkg install lapack
208
-
209
236
- name : Enable long paths
210
237
run : |
211
238
powershell.exe New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
@@ -224,7 +251,7 @@ jobs:
224
251
-DENABLE_PYTHON=OFF `
225
252
-DENABLE_GATE_DISPATCHER=OFF `
226
253
-DCMAKE_PREFIX_PATH=D:\a\pennylane-lightning\pennylane-lightning\Kokkos `
227
- -DCMAKE_TOOLCHAIN_FILE=D:/a/pennylane-lightning/pennylane-lightning/ vcpkg/ scripts/ buildsystems/ vcpkg.cmake `
254
+ -DCMAKE_TOOLCHAIN_FILE=D:\a\install_dir\ vcpkg\ scripts\ buildsystems\ vcpkg.cmake `
228
255
-DENABLE_OPENMP=OFF `
229
256
-DPL_BACKEND=${{ matrix.pl_backend }} `
230
257
-DENABLE_LAPACK=ON `
@@ -238,7 +265,7 @@ jobs:
238
265
$filename = $filename.Substring($filename.LastIndexOf("\")+1)
239
266
$test_call = $file.ToString() + " --order lex --reporter junit --out .\Build\tests\results\report_" + $filename + ".xml"
240
267
Invoke-Expression $test_call
241
- $cov_call = "OpenCppCoverage --sources pennylane_lightning\core\src --export_type cobertura:coverage.xml " + $file.ToString()
268
+ $cov_call = "OpenCppCoverage --sources pennylane_lightning\core\src --excluded_modules D:\a\install_dir\* --excluded_modules C:\Windows\System32\* -- export_type cobertura:coverage.xml " + $file.ToString()
242
269
Invoke-Expression $cov_call
243
270
}
244
271
Move-Item -Path .\coverage.xml -Destination .\coverage-${{ github.job }}-${{ matrix.pl_backend }}.xml
0 commit comments