@@ -150,33 +150,25 @@ jobs:
150
150
python --version
151
151
python -c "import cryptography; print(f'Python3 cryptography version {cryptography.__version__}')"
152
152
153
+ - name : Set up Python virtual environment (Windows)
154
+ if : runner.os == 'Windows'
155
+ run : |
156
+ python.exe -m venv --system-site-packages --copies venv
157
+ echo "VIRTUAL_ENV=${{github.workspace}}\venv" >> $GITHUB_ENV
158
+ echo "${{github.workspace}}\venv\Scripts" >> $GITHUB_PATH
159
+
160
+
153
161
- name : Install python3 cryptography module (Windows)
154
162
if : runner.os == 'Windows'
155
163
run : |
164
+ .\venv\Scripts\Activate.ps1
156
165
python.exe -m ensurepip
157
166
python.exe -m pip install --upgrade pip
158
167
python.exe -m pip install cryptography
159
168
python.exe -c "import sys; print(sys.executable)"
160
169
python.exe --version
161
170
python.exe -c "import cryptography; print(f'Python3 cryptography version {cryptography.__version__}')"
162
171
163
- - name : Find the latest version of Python (Windows)
164
- if : runner.os == 'Windows'
165
- run : |
166
- $pythonVersions = Get-ChildItem -Path "C:/hostedtoolcache/windows/Python/" -Directory | Where-Object { $_.Name -match '\d+\.\d+\.\d+' } | Sort-Object { [Version]($_.Name) } -Descending
167
- if ($pythonVersions.Count -gt 0) {
168
- $latestPythonVersion = $pythonVersions[0].Name
169
- $pythonPath = "C:/hostedtoolcache/windows/Python/$latestPythonVersion/x64"
170
- Write-Output "Latest Python version found: $latestPythonVersion"
171
- Write-Output "Python directory path: $pythonPath"
172
- $env:Path = "$pythonPath;" + $env:Path
173
- Write-Output "Updated PATH environment variable:"
174
- Write-Output $env:Path
175
- } else {
176
- Write-Error "No Python versions found in C:/hostedtoolcache/windows/Python/"
177
- exit 1
178
- }
179
-
180
172
- name : Configure CMake (macOS)
181
173
if : runner.os == 'macOS'
182
174
run : |
@@ -190,8 +182,21 @@ jobs:
190
182
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/dist" \
191
183
-DPython3_EXECUTABLE="${{ github.workspace }}/venv/bin/python"
192
184
193
- - name : Configure CMake (non-macOS)
194
- if : runner.os != 'macOS'
185
+ - name : Configure CMake (Windows)
186
+ if : runner.os == 'Windows'
187
+ run : |
188
+ .\venv\Scripts\Activate.ps1
189
+ cmake `
190
+ -G "${{ matrix.generator }}" `
191
+ -S "${{ github.workspace }}" `
192
+ -B "${{ github.workspace }}/build" `
193
+ -DCMAKE_OSX_ARCHITECTURES=arm64 `
194
+ -DCMAKE_BUILD_TYPE="${{ env.BUILD_TYPE }}" `
195
+ -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/dist" `
196
+ -DPython3_EXECUTABLE="${{ github.workspace }}\venv\Scripts\python.exe"
197
+
198
+ - name : Configure CMake (Linux)
199
+ if : runner.os == 'Linux'
195
200
run : cmake
196
201
-G "${{matrix.generator}}"
197
202
-S ${{github.workspace}}
@@ -220,8 +225,15 @@ jobs:
220
225
source ../venv/bin/activate
221
226
ctest -C ${{env.BUILD_TYPE}}
222
227
223
- - name : Test (non-macOS)
224
- if : runner.os != 'macOS'
228
+ - name : Test (Windows)
229
+ if : runner.os == 'Windows'
230
+ working-directory : ${{github.workspace}}/build
231
+ run : |
232
+ ..\venv\Scripts\Activate.ps1
233
+ ctest -C ${{env.BUILD_TYPE}}
234
+
235
+ - name : Test (Linux)
236
+ if : runner.os == 'Linux'
225
237
working-directory : ${{github.workspace}}/build
226
238
run : ctest -C ${{env.BUILD_TYPE}}
227
239
0 commit comments