Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: don't install homebrew vcpkg in Azure Pipelines #301

Merged
merged 3 commits into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ stages:
vcpkg.default.triplet: "arm64-ios-simulator"
vcpkg.overlay.triplets: "$(Build.SourcesDirectory)/triplets"
steps:
- powershell: brew install vcpkg $(Get-Content test/packages-homebrew.txt)
- script: brew install $(cat test/packages-homebrew.txt)
continueOnError: true
displayName: "Install HomeBrew packages"
- task: PowerShell@2
displayName: "Setup vcpkg"
Expand All @@ -168,6 +169,7 @@ stages:
New-Item -Type Directory -Force "$env:VCPKG_DEFAULT_BINARY_CACHE"
Push-Location /usr/local/share/
git clone --branch "$env:VCPKG_VERSION" --depth 1 https://github.com/microsoft/vcpkg
./bootstrap-vcpkg.sh -disableMetrics
Pop-Location
targetType: 'inline'
- task: Cache@2
Expand All @@ -180,6 +182,7 @@ stages:
displayName: "Test: $(vcpkg.default.triplet)"
inputs:
script: |
$env:PATH="/usr/local/share/vcpkg:$env:PATH"
$Ports=$(Get-Content "test/azure-port-ios.txt")
vcpkg install --keep-going $Ports --clean-buildtrees-after-build --clean-packages-after-build
targetType: 'inline'
Expand Down
File renamed without changes.
59 changes: 59 additions & 0 deletions scripts/gh-cleanup-runs.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<#
.SYNOPSIS
PowerShell script to remove Workflow run in the GitHub Actions

.PARAMETER Repository
The name of the repository.
.PARAMETER Workflow
The name of the workflow in the repository.
.PARAMETER Branch
Branch of the workflow runs. Used to select the matching runs.
.PARAMETER Conclusion
Final status of the workflow run. ex) cancelled
.PARAMETER GitHubHost
Hostname for GitHub CLI, API request. github.com, git.company.com

.LINK
https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/using-workflow-run-logs

#>
param
(
[String]$Repository = "",
[Parameter(Mandatory = $true)][String]$Workflow,
[String]$Branch = "main",
[String]$Conclusion = "cancelled",
[String]$GitHubHost = "github.com"
)

# If the Repository is empty, we will parse it from the origin URL
if ($Repository -eq "") {
[String]$OriginURL = $(git remote get-url origin)
# Parse the organization and repository name from OriginURL
# For example, if the URL is https://github.com/luncliff/vcpkg-registry, the value will be "luncliff/vcpkg-registry"
$Repository = $OriginURL -replace "https://$GitHubHost/", "" -replace ".git", ""
Write-Output "Repository: $Repository"
}

# ex) '.workflow_runs[] | select(.conclusion != "") | .id'
[String]$Query = ".workflow_runs[] | select(.head_branch == ""$Branch"") | select(.conclusion == ""$Conclusion"") | .id"
Write-Output "Query: $Query"

gh api `
-H "Accept: application/vnd.github+json" `
-H "X-GitHub-Api-Version: 2022-11-28" `
"/repos/$Repository/actions/workflows/$Workflow/runs" `
--paginate `
--jq $Query > "runs.txt"

foreach ($RunID in Get-Content "runs.txt") {
gh api `
--method DELETE `
-H "Accept: application/vnd.github+json" `
-H "X-GitHub-Api-Version: 2022-11-28" `
"/repos/$Repository/actions/runs/$RunID"
Write-Output "Deleted: $RunID"
Start-Sleep -Milliseconds 100
}

Remove-Item -Force "runs.txt"
Loading