Populate #164
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Populate | |
on: | |
schedule: | |
# Use a start time that is unlikely to be popular | |
- cron: '11 0,12 * * *' | |
workflow_dispatch: | |
jobs: | |
get-unpopulated-ports: | |
environment: build-cache | |
runs-on: ubuntu-latest | |
outputs: | |
should-download: ${{ steps.list-ports.outputs.has-ports }} | |
permissions: | |
id-token: write # Log into Azure | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Az CLI login | |
uses: azure/login@v1 | |
with: | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
- name: Get storage token | |
id: get-storage-token | |
shell: pwsh | |
run: | | |
# Output is quoted, so ConvertFrom-Json to get the value without | |
# the quotes | |
$token = az storage container generate-sas ` | |
--account-name ${{ vars.STORAGE_ACCOUNT_NAME }} ` | |
--auth-mode login ` | |
--as-user ` | |
--name vcpkg-assets ` | |
--permissions aclmrw ` | |
--start ((Get-Date -AsUTC).AddHours(-1).ToString("yyyy-MM-dd'T'HH:mm'Z'")) ` | |
--expiry ((Get-Date -AsUTC).AddHours(6).ToString("yyyy-MM-dd'T'HH:mm'Z'")) ` | |
--output json | ConvertFrom-Json | |
Write-Host "::add-mask::$token" | |
Write-Host "Token Length: $($token.Length)" | |
"storage-token=$token" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | |
# TODO: Prepare vcpkg in a separate step and output the current SHA for | |
# use in later jobs | |
- name: List ports that need to be populated | |
id: list-ports | |
shell: pwsh | |
env: | |
AZURE_STORAGE_SAS_TOKEN: ${{ steps.get-storage-token.outputs.storage-token }} | |
run: | | |
./Get-UncachedPorts.ps1 ` | |
-AccountName '${{ vars.STORAGE_ACCOUNT_NAME }}' ` | |
-ContainerName 'vcpkg-assets' ` | |
-IgnoreHashes (Get-Content ./ignore-hashes.txt) ` | |
-IgnorePorts (Get-Content ./ignore-ports.txt) ` | |
| Set-Content artifacts-to-populate.txt | |
if (Test-Path ./artifacts-to-populate.txt) { | |
"has-ports=true" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | |
} else { | |
"has-ports=false" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | |
} | |
- name: Upload artifacts-to-populate.txt | |
if: steps.list-ports.outputs.has-ports == 'true' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: artifacts-to-populate | |
path: artifacts-to-populate.txt | |
download-cache: | |
environment: build-cache | |
needs: get-unpopulated-ports | |
if: needs.get-unpopulated-ports.outputs.should-download == 'true' | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-22.04 | |
triplets: x64-linux | |
- os: ubuntu-22.04 | |
triplets: x64-linux-dynamic | |
- os: ubuntu-22.04 | |
triplets: arm64-linux | |
apt-get-packages: g++-aarch64-linux-gnu | |
- os: ubuntu-22.04 | |
triplets: arm-linux | |
apt-get-packages: g++-arm-linux-gnueabihf | |
- os: windows-2022 | |
triplets: x64-uwp | |
- os: windows-2022 | |
triplets: arm64-uwp | |
- os: windows-2022 | |
triplets: arm64-windows | |
- os: windows-2022 | |
triplets: x64-windows-static | |
- os: windows-2022 | |
triplets: x64-windows | |
- os: windows-2022 | |
triplets: x86-windows | |
- os: macos-12 | |
triplets: x64-osx | |
- os: macos-12 | |
triplets: arm64-osx | |
runs-on: ${{ matrix.os }} | |
permissions: | |
contents: read | |
id-token: write # Log into Azure | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set core.longPaths | |
if: runner.os == 'Windows' | |
shell: pwsh | |
run: git config --system core.longPaths true | |
- name: apt-get install | |
if: matrix.apt-get-packages != '' | |
run: | | |
sudo apt-get update && sudo apt-get install -y ${{ matrix.apt-get-packages }} | |
- name: Az CLI login | |
uses: azure/login@v1 | |
with: | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
# TODO: DRY this up | |
- name: Get storage token | |
id: get-storage-token | |
shell: pwsh | |
run: | | |
# Output is quoted, so ConvertFrom-Json to get the value without | |
# the quotes | |
$token = az storage container generate-sas ` | |
--account-name ${{ vars.STORAGE_ACCOUNT_NAME }} ` | |
--auth-mode login ` | |
--as-user ` | |
--name vcpkg-assets ` | |
--permissions aclmrw ` | |
--start ((Get-Date -AsUTC).AddHours(-1).ToString("yyyy-MM-dd'T'HH:mm'Z'")) ` | |
--expiry ((Get-Date -AsUTC).AddHours(6).ToString("yyyy-MM-dd'T'HH:mm'Z'")) ` | |
--output json | ConvertFrom-Json | |
Write-Host "::add-mask::$token" | |
Write-Host "Token Length: $($token.Length)" | |
"storage-token=$token" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | |
- name: Get storage token for binary cache | |
id: get-storage-token-binary-cache | |
shell: pwsh | |
run: | | |
# Output is quoted, so ConvertFrom-Json to get the value without | |
# the quotes | |
$token = az storage container generate-sas ` | |
--account-name ${{ vars.STORAGE_ACCOUNT_NAME }} ` | |
--auth-mode login ` | |
--as-user ` | |
--name vcpkg-binaries ` | |
--permissions aclmrw ` | |
--start ((Get-Date -AsUTC).AddHours(-1).ToString("yyyy-MM-dd'T'HH:mm'Z'")) ` | |
--expiry ((Get-Date -AsUTC).AddHours(6).ToString("yyyy-MM-dd'T'HH:mm'Z'")) ` | |
--output json | ConvertFrom-Json | |
Write-Host "::add-mask::$token" | |
Write-Host "Token Length: $($token.Length)" | |
"storage-token=$token" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | |
- name: Get storage token | |
id: get-storage-token-logs | |
shell: pwsh | |
run: | | |
# Output is quoted, so ConvertFrom-Json to get the value without | |
# the quotes | |
$token = az storage container generate-sas ` | |
--account-name ${{ vars.STORAGE_ACCOUNT_NAME }} ` | |
--auth-mode login ` | |
--as-user ` | |
--name vcpkg-logs ` | |
--permissions aclmrw ` | |
--start ((Get-Date -AsUTC).AddHours(-1).ToString("yyyy-MM-dd'T'HH:mm'Z'")) ` | |
--expiry ((Get-Date -AsUTC).AddHours(6).ToString("yyyy-MM-dd'T'HH:mm'Z'")) ` | |
--output json | ConvertFrom-Json | |
Write-Host "::add-mask::$token" | |
Write-Host "Token Length: $($token.Length)" | |
"storage-token=$token" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | |
- name: Download artifacts-to-populate.txt | |
uses: actions/download-artifact@v3 | |
with: | |
name: artifacts-to-populate | |
- name: Populate artifacts | |
shell: pwsh | |
env: | |
X_VCPKG_ASSET_SOURCES: x-azurl,https://${{ vars.STORAGE_ACCOUNT_NAME }}.blob.core.windows.net/vcpkg-assets,${{ steps.get-storage-token.outputs.storage-token }},readwrite | |
VCPKG_BINARY_SOURCES: clear;x-azblob,https://${{ vars.STORAGE_ACCOUNT_NAME }}.blob.core.windows.net/vcpkg-binaries,${{ steps.get-storage-token-binary-cache.outputs.storage-token }},readwrite | |
run: >- | |
./go.ps1 | |
-Triplets "${{ matrix.triplets }}" | |
-Ports (Get-Content artifacts-to-populate.txt) | |
-IgnorePorts (Get-Content ignore-ports.txt) | |
- name: Upload logs to storage | |
shell: pwsh | |
run: >- | |
azcopy copy | |
logs/* | |
'https://${{ vars.STORAGE_ACCOUNT_NAME }}.blob.core.windows.net/vcpkg-logs/${{ github.run_number }}/${{ github.run_attempt }}?${{ steps.get-storage-token-logs.outputs.storage-token }}' | |
--recursive | |
download-report: | |
environment: build-cache | |
needs: download-cache | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write # Log into Azure | |
contents: read | |
issues: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Az CLI login | |
uses: azure/login@v1 | |
with: | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
- name: Get storage token | |
id: get-storage-token | |
shell: pwsh | |
run: | | |
# Output is quoted, so ConvertFrom-Json to get the value without | |
# the quotes | |
$token = az storage container generate-sas ` | |
--account-name ${{ vars.STORAGE_ACCOUNT_NAME }} ` | |
--auth-mode login ` | |
--as-user ` | |
--name vcpkg-assets ` | |
--permissions aclmrw ` | |
--start ((Get-Date -AsUTC).AddHours(-1).ToString("yyyy-MM-dd'T'HH:mm'Z'")) ` | |
--expiry ((Get-Date -AsUTC).AddHours(6).ToString("yyyy-MM-dd'T'HH:mm'Z'")) ` | |
--output json | ConvertFrom-Json | |
Write-Host "::add-mask::$token" | |
Write-Host "Token Length: $($token.Length)" | |
"storage-token=$token" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | |
# TODO: Prepare vcpkg in a separate step and output the current SHA for | |
# use in later jobs | |
- name: List artifacts that need to be populated | |
shell: pwsh | |
env: | |
AZURE_STORAGE_SAS_TOKEN: ${{ steps.get-storage-token.outputs.storage-token }} | |
run: | | |
./Get-UncachedPorts.ps1 ` | |
-AccountName '${{ vars.STORAGE_ACCOUNT_NAME }}' ` | |
-ContainerName 'vcpkg-assets' ` | |
-IgnoreHashes (Get-Content ./ignore-hashes.txt) ` | |
-IgnorePorts (Get-Content ./ignore-ports.txt) ` | |
-ReportFile download-report.json | |
- name: Update issues | |
shell: pwsh | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
./Set-Issues.ps1 ` | |
-ReportFile ./download-report.json ` | |
-Repo "${{ github.repository }}" ` | |
-BuildUrl "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
- name: Upload download-report.json | |
uses: actions/upload-artifact@v3 | |
with: | |
name: download-report | |
path: download-report.json |