Skip to content

Commit 4a1c340

Browse files
committed
Onboard GitHub Actions as a replacement for Azure DevOps.
This reduces the vcpkg team's compliance burden as we won't be maintaining a separate Azure DevOps instance, and results in a better user experience for contributors as they need not go through so many clicks in order to get build logs.
1 parent 7fd612e commit 4a1c340

File tree

4 files changed

+165
-9
lines changed

4 files changed

+165
-9
lines changed

.github/workflows/test_modified_ports.yml

+164-8
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,177 @@ on:
33
push:
44
branches:
55
- onboard-actions
6+
permissions:
7+
id-token: write
8+
contents: read
69
jobs:
7-
Windows:
10+
test:
11+
strategy:
12+
matrix:
13+
conf:
14+
- triplet: 'x86-windows'
15+
pool: windows
16+
extra-checks: true
17+
- triplet: 'x64-windows'
18+
pool: windows
19+
- triplet: 'x64-windows-static'
20+
pool: windows
21+
- triplet: 'x64-windows-static-md'
22+
pool: windows
23+
- triplet: 'x64-uwp'
24+
pool: windows
25+
- triplet: 'arm64-windows'
26+
pool: windows
27+
- triplet: 'arm64-uwp'
28+
pool: windows
29+
- triplet: 'x64-linux'
30+
pool: linux
31+
- triplet: 'arm-neon-android'
32+
pool: android
33+
- triplet: 'x64-android'
34+
pool: android
35+
- triplet: 'arm64-android'
36+
pool: android
837
runs-on:
938
- self-hosted
10-
- "1ES.Pool=vcpkg-windows-wus"
39+
- "1ES.Pool=${{ matrix.conf.pool == 'windows' && 'vcpkg-windows-wus' || matrix.conf.pool == 'linux' && 'vcpkg-linux-wus' || matrix.conf.pool == 'android' && 'vcpkg-android-wus' }}"
40+
continue-on-error: true
41+
timeout-minutes: 2880 # 2 days
42+
env:
43+
VCPKG_DOWNLOADS: ${{ matrix.conf.pool == 'windows' && 'D:\downloads' || '/mnt/vcpkg-ci/downloads' }}
44+
WORKING_ROOT: ${{ matrix.conf.pool == 'windows' && 'D:\' || '/mnt/vcpkg-ci' }}
45+
ARTIFACT_STAGING: ${{ matrix.conf.pool == 'windows' && 'D:\artifactstaging' || '/mnt/vcpkg-ci/artifactstaging' }}
1146
steps:
12-
- name: Checkout
47+
- name: Make Working directories
48+
if: ${{ success() && matrix.conf.pool != 'windows' }}
49+
run: |
50+
sudo mkdir -p ${{ env.WORKING_ROOT }}/failure-logs
51+
sudo mkdir -p ${{ env.VCPKG_DOWNLOADS }}
52+
sudo mkdir -p ${{ env.ARTIFACT_STAGING }}
53+
- name: Checkout (Windows)
1354
uses: actions/checkout@v4
55+
if: ${{ success() && matrix.conf.pool == 'windows' }}
56+
env:
57+
PATH: c:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\cmd;$PATH
1458
with:
1559
# fetch-depth 50 tries to ensure we capture the whole history of the branch
1660
fetch-depth: 50
61+
- name: Checkout (Non-Windows)
62+
uses: actions/checkout@v4
63+
if: ${{ success() && matrix.conf.pool != 'windows' }}
64+
with:
65+
# fetch-depth 50 tries to ensure we capture the whole history of the branch
66+
fetch-depth: 50
67+
- name: Azure Login
68+
uses: azure/login@v2
69+
with:
70+
client-id: a81b4cd3-9d8d-4cb9-9a74-f2038f24f224
71+
subscription-id: 7fcb00fa-a761-49de-8a2f-d67190e62882
72+
tenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47
73+
- name: Bootstrap (Windows)
74+
if: ${{ success() && matrix.conf.pool == 'windows' }}
75+
run: ./scripts/bootstrap.ps1
76+
- name: Bootstrap (Non-Windows)
77+
if: ${{ success() && matrix.conf.pool != 'windows' && matrix.conf.pool != 'android' }}
78+
run: ./scripts/bootstrap.sh
79+
- name: Format Manifests
80+
if: ${{ success() && matrix.conf.extra-checks }}
81+
run: ./vcpkg.exe format-manifest --all
82+
- name: Create Artifact Staging Directory
83+
run: mkdir ${{ env.ARTIFACT_STAGING }}
84+
- name: Create Format Manifest Diff
85+
if: ${{ success() && matrix.conf.extra-checks }}
86+
env:
87+
PATH: c:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\cmd;$PATH
88+
run: ./scripts/azure-pipelines/Create-PRDiff.ps1 -DiffFile "${{ env.ARTIFACT_STAGING }}/format.diff"
89+
- name: 'Publish Artifact: Format Diff'
90+
uses: actions/upload-artifact@v4
91+
if: ${{ failure() && !cancelled() && matrix.conf.extra-checks }}
92+
with:
93+
name: 'format.diff'
94+
path: "${{ env.ARTIFACT_STAGING }}/format.diff"
95+
retention-days: 7
96+
if-no-files-found: error
97+
- name: "*** Test Modified Ports (non-Android)"
98+
if: ${{ success() && matrix.conf.pool != 'android' }}
99+
shell: pwsh
100+
run: |
101+
$current = Get-Date -AsUtc
102+
$endDate = $current.AddDays(2)
103+
$end = Get-Date -Date $endDate -UFormat '+%Y-%m-%dT%H:%MZ'
104+
Write-Host "Getting Asset Cache SAS"
105+
$assetSas = az storage container generate-sas --name cache --account-name vcpkgassetcachewus3 --as-user --auth-mode login --https-only --permissions rcl --expiry $end -o tsv | Out-String
106+
if ($LastExitCode -ne 0) {
107+
Write-Error "Failed to get Asset Cache SAS"
108+
return 1
109+
}
110+
111+
$assetSas = $assetSas.Trim()
112+
Write-Host "Getting Binary Cache SAS"
113+
$binarySas = az storage container generate-sas --name cache --account-name vcpkgbinarycachewus --as-user --auth-mode login --https-only --permissions rclw --expiry $end -o tsv | Out-String
114+
if ($LastExitCode -ne 0) {
115+
Write-Error "Failed to get Binary Cache SAS"
116+
return 1
117+
}
118+
119+
$binarySas = $binarySas.Trim()
120+
$env:X_VCPKG_ASSET_SOURCES = "x-azurl,https://vcpkgassetcachewus3.blob.core.windows.net/cache,$assetSas,readwrite"
121+
if ($IsWindows) { # FIXME: Git in the images
122+
$env:PATH += ";c:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\cmd"
123+
}
17124
18-
- name: Bootstrap
19-
run: ./bootstrap-vcpkg.sh
20-
21-
- name: Example
125+
& scripts/azure-pipelines/test-modified-ports.ps1 -Triplet ${{ matrix.conf.triplet }} -BinarySourceStub "x-azblob,https://vcpkgbinarycachewus.blob.core.windows.net/cache,$binarySas" -WorkingRoot $env:WORKING_ROOT -ArtifactStagingDirectory $env:ARTIFACT_STAGING
126+
- name: "*** Test Modified Ports (Android)"
127+
if: ${{ success() && matrix.conf.pool == 'android' }}
128+
run: |
129+
az acr login --name vcpkgandroidwus
130+
docker pull vcpkgandroidwus.azurecr.io/vcpkg-android:2024-10-21
131+
docker run --rm \
132+
--mount type=bind,source=${{ github.workspace }},target=/vcpkg \
133+
vcpkgandroidwus.azurecr.io/vcpkg-android:2024-10-21 \
134+
./bootstrap-vcpkg.sh
135+
end=`date -u -d "2 days" '+%Y-%m-%dT%H:%MZ'`
136+
assetSas=`az storage container generate-sas --name cache --account-name vcpkgassetcachewus3 --as-user --auth-mode login --https-only --permissions rcl --expiry $end -o tsv`
137+
binarySas=`az storage container generate-sas --name cache --account-name vcpkgbinarycachewus --as-user --auth-mode login --https-only --permissions rclw --expiry $end -o tsv`
138+
echo Minting SAS tokens valid through $end
139+
USER=$(id --user)
140+
docker run --init -i \
141+
-a stderr \
142+
-a stdout \
143+
--user $USER \
144+
--mount type=bind,source=${{ github.workspace }},target=/vcpkg \
145+
--mount type=bind,source=/mnt/vcpkg-ci/failure-logs,target=/vcpkg/failure-logs \
146+
--mount type=bind,source=/mnt/vcpkg-ci,target=/mnt/vcpkg-ci \
147+
--env X_VCPKG_ASSET_SOURCES="x-azurl,https://vcpkgassetcachewus3.blob.core.windows.net/cache,$assetSas,readwrite" \
148+
vcpkgandroidwus.azurecr.io/vcpkg-android:2024-10-21 \
149+
pwsh \
150+
-File /vcpkg/scripts/azure-pipelines/test-modified-ports.ps1 \
151+
-Triplet ${{ matrix.conf.triplet }} \
152+
-BinarySourceStub "x-azblob,https://vcpkgbinarycachewus.blob.core.windows.net/cache,$binarySas" \
153+
-WorkingRoot /mnt/vcpkg-ci
154+
- name: 'Validate version files'
155+
if: ${{ success() && matrix.conf.extra-checks }}
156+
env:
157+
PATH: c:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\cmd;$PATH
158+
run: 'scripts/azure-pipelines/windows/validate-version-files.ps1'
159+
- name: 'Publish Artifact: failure logs for ${{ matrix.conf.triplet }}'
160+
uses: actions/upload-artifact@v4
161+
with:
162+
name: 'failure logs for ${{ matrix.conf.triplet }}'
163+
path: '${{ env.ARTIFACT_STAGING }}/failure-logs'
164+
retention-days: 7
165+
if-no-files-found: ignore
166+
- name: 'Build a file list for all packages'
167+
if: ${{ !cancelled() }}
22168
shell: pwsh
23-
run: Write-Host 'Running on 1ES Hosted GitHub Runners'
169+
run: |
170+
./vcpkg fetch python3
171+
& $(./vcpkg fetch python3) ./scripts/file_script.py "$env:WORKING_ROOT/installed/vcpkg/info/"
172+
- name: 'Publish Artifact: file lists for ${{ matrix.conf.triplet }}'
173+
uses: actions/upload-artifact@v4
174+
if: ${{ !cancelled() }}
175+
with:
176+
name: 'file lists for ${{ matrix.conf.triplet }}'
177+
path: scripts/list_files
178+
retention-days: 7
179+
if-no-files-found: ignore

scripts/azure-pipelines/android/create-docker-image.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
$Date = (Get-Date -Format 'yyyy-MM-dd')
44
$ResourceGroupName = "PrAnd-1ES"
5-
$ContainerRegistryName = "vcpkgandroidwus3"
5+
$ContainerRegistryName = "vcpkgandroidwus"
66
$ErrorActionPreference = 'Stop'
77

88
$registry = Get-AzContainerRegistry -ResourceGroupName $ResourceGroupName -Name $ContainerRegistryName

scripts/bootstrap.ps1

100644100755
File mode changed.

scripts/bootstrap.sh

100644100755
File mode changed.

0 commit comments

Comments
 (0)