Skip to content

Commit 6d15204

Browse files
committed
new test
1 parent 62843ef commit 6d15204

2 files changed

Lines changed: 26 additions & 17 deletions

File tree

.github/workflows/windows-standard.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,17 @@ jobs:
3535
working-directory: ${{ steps.strings.outputs.build-output-dir }}
3636
shell: pwsh
3737
run: |
38-
${{ github.workspace }}\scripts\windows_download_boost.ps1 ${{ matrix.boost_version }} 14.3 64
38+
${{ github.workspace }}\scripts\windows_download_boost.ps1 ${{ matrix.boost_version }} 14.3 64 "${{ steps.strings.outputs.build-output-dir }}"
3939
- name: install boost
4040
working-directory: ${{ steps.strings.outputs.build-output-dir }}
41+
shell: bash
4142
run: |
42-
${{ steps.strings.outputs.build-output-dir }}\boost.exe /DIR=${{ steps.strings.outputs.build-output-dir }}\boost
43+
${{ steps.strings.outputs.build-output-dir }}/boost.exe /SILENT /DIR=${{ steps.strings.outputs.build-output-dir }}/boost
4344
echo "BOOST_ROOT=${{ steps.strings.outputs.build-output-dir }}\boost" >> $GITHUB_ENV
4445
- name: Configure
4546
working-directory: ${{ steps.strings.outputs.build-output-dir }}
4647
run: >
47-
cmake -A x64 -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
48+
cmake -A x64 -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DBOOST_ROOT=${{ env.BOOST_ROOT }}
4849
-DSTATIC_RUNTIME:BOOL=${{matrix.static}} -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install
4950
-S ${{ github.workspace }} -B ${{ steps.strings.outputs.build-output-dir }}
5051
- name: Compile

scripts/windows_download_boost.ps1

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#!/usr/bin/env pwsh
22

3-
# This script downloads boost. It must be invoked with 3 arguments
4-
# windows_download_boost.ps1 <boost_version> <msvc version> <architecture>
5-
# eg. windows_download_boost.ps1 1.91.0 14.3 64
3+
# This script downloads boost. It must be invoked with 4 arguments
4+
# windows_download_boost.ps1 <boost_version> <msvc version> <architecture> <output_dir>
5+
# eg. windows_download_boost.ps1 1.91.0 14.3 64 C:\local\boost
66

7-
if ($args.Count -ne 3) {
8-
Write-Host "Error: This script requires 3 parameters.\n windows_download_boost.ps1 <boost_version> <msvc version> <architecture>"
7+
if ($args.Count -ne 4) {
8+
Write-Host "Error: This script requires 4 parameters.\n windows_download_boost.ps1 <boost_version> <msvc version> <architecture> <output_dir>"
99
exit
1010
}
1111
#set Invoke-WebRequest to not show progress bar, as it can cause issues in some CI environments
@@ -14,6 +14,9 @@ $ProgressPreference = 'SilentlyContinue'
1414
[string] $version = $args[0]
1515
[string] $msvc_version = $args[1]
1616
[string] $architecture = $args[2]
17+
[string] $output_dir = $args[3]
18+
19+
[string] $outputfile = Join-Path -Path $output_dir -ChildPath "boost.exe"
1720
[int]$maxRetries = 3
1821
[int]$retryCount = 0
1922
[int]$StatusCode = 200
@@ -23,28 +26,33 @@ $response = $null
2326
$version_und = $version.Replace('.', '_')
2427
$uri = "https://github.com/userdocs/boost/releases/download/boost-"+$version+"/boost_" + $version_und + "-msvc-" + $msvc_version + "-" + $architecture + ".exe"
2528

26-
if (-not (Test-Path 'C:/local/boost/libs')) {
27-
echo "Boost not cached, downloading it: $uri"
29+
if (-not (Test-Path $output_dir)) {
30+
New-Item -ItemType Directory -Path $output_dir
31+
}
32+
33+
if (-not (Test-Path $outputfile)) {
34+
Write-Host "Boost not cached, downloading it: from $uri to $outputfile"
2835
do {
2936
try {
30-
$response = Invoke-WebRequest -Verbose -Debug -Uri "$uri" -OutFile ".\boost.exe"
37+
$response = Invoke-WebRequest -Uri "$uri" -OutFile "$outputfile"
3138
break
3239
} catch {
3340
$StatusCode = $_.Exception.Response.StatusCode
3441
$errorMessage = $_.Exception.Message
42+
$response = $null
3543
$retryCount++
36-
echo "Attempt $retryCount failed: $StatusCode $errorMessage. Retrying $uri ..."
44+
Write-Host "Attempt $retryCount failed: $StatusCode $errorMessage. Retrying $uri ..."
3745
Start-Sleep -Seconds 2 # Wait before retrying
3846
}
3947
} until ($retryCount -ge $maxRetries)
4048

41-
if ($response) {
42-
echo "Boost downloaded"
49+
if ($response -eq $null) {
50+
Write-Host "Request failed after $retryCount attempts."
51+
exit 1
4352
} else {
44-
echo "Request failed after $retryCount attempts."
45-
#exit 1
53+
Write-Host "Boost downloaded"
4654
}
47-
} else { echo "Boost already installed" }
55+
} else { Write-Host "Boost already installed" }
4856

4957
if (Test-Path './boost.exe') {
5058
echo "Boost executable found."

0 commit comments

Comments
 (0)