chore(e2e): Add steps to download opencv from workflow (#6177)
* chore(e2e): Add steps to download opencv from github * CR: comment * CR
This commit is contained in:
1 parent
e4e724bbc5
commit
1023a7c53d
3 files changed
+43
-4
No files matched your search
@@ -35,6 +35,7 @@ refreshenv
|
||||
# install mremoteng
|
||||
choco install mremoteng -y
|
||||
|
||||
# install dependencies for rdp automated tests
|
||||
choco install golang -y --version ${go_version}
|
||||
refreshenv
|
||||
choco install git -y
|
||||
@@ -47,5 +48,43 @@ refreshenv
|
||||
|
||||
# Set the github token if provided
|
||||
if ("${github_token}" -ne "") {
|
||||
# configure git to be able to download from private repos
|
||||
git config --system url."https://oauth2:${github_token}@github.com".insteadOf "https://github.com"
|
||||
}
|
||||
|
||||
# download opencv artifact if available
|
||||
[Environment]::SetEnvironmentVariable("GITHUB_TOKEN", "${github_token}", [EnvironmentVariableTarget]::Machine)
|
||||
choco install gh -y
|
||||
refreshenv
|
||||
|
||||
$repo = "hashicorp/boundary-enterprise"
|
||||
$workflow = "build-opencv-ent.yml"
|
||||
$branch = "main"
|
||||
$artifactName = "opencv"
|
||||
|
||||
$run = gh run list --repo $repo --workflow=$workflow --branch=$branch --status success --limit 1 --json databaseId | ConvertFrom-Json
|
||||
if (-not $run -or -not $run[0].databaseId) {
|
||||
Write-Error "Could not find a workflow run for $workflow in $repo."
|
||||
exit 1
|
||||
}
|
||||
Write-Host "Found workflow run: $($run[0])"
|
||||
$run_id = $run[0].databaseId
|
||||
|
||||
New-Item -ItemType Directory -Path "C:/opencv/build" -Force
|
||||
$downloadResult = gh run download $run_id --repo $repo -n $artifactName --dir C:/opencv/build
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Error "Failed to download artifact $artifactName from workflow run $run_id."
|
||||
exit 1
|
||||
}
|
||||
|
||||
# add opencv to path
|
||||
$existingPath = [Environment]::GetEnvironmentVariable(
|
||||
"Path",
|
||||
[EnvironmentVariableTarget]::Machine
|
||||
)
|
||||
$newPath = $existingPath + ";C:\opencv\build\install\x64\mingw\bin;"
|
||||
[Environment]::SetEnvironmentVariable(
|
||||
"Path",
|
||||
$newPath,
|
||||
[EnvironmentVariableTarget]::Machine
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user