Skip to content

Commit ac670d7

Browse files
committed
Use GitHub Actions rather than Azure DevOps except macOS.
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. macOS isn't moved over yet because there's value in having all the Azure resources on their own and that's going to be its own can of worms. Also adds arm64-windows-static-md testing as requested by Azure Storage internal customers.
1 parent 813a241 commit ac670d7

34 files changed

+198
-402
lines changed

scripts/azure-pipelines/android/create-docker-image.ps1 renamed to .github/workflows/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/azure-pipelines/patch-tuesday-checklist.md renamed to .github/workflows/patch-tuesday-checklist.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"C++ VCPKG Validation" about vulnerable software we are installing in the VMs and update that.
1010
(Most often PowerShell needs to be updated)
1111
* [ ] Check for any other software for the Windows images we wish to update and make the edits to do
12-
so in `scripts/azure-pipelines/windows`
12+
so in `.github/windows`
1313
* [ ] Check for any updates possible to `vcpkgTools.xml`. Note that PowerShell currently uses the
1414
7.2.x series due to customer reported problems on older Windows with 7.3.x and later.
1515
* [ ] Update the first line of android/Dockerfile with the current 'focal' image according to
@@ -22,4 +22,4 @@
2222
* [ ] In the Azure portal, mark the newly created image as the 'latest' one.
2323
* [ ] Mint a new macOS base box. (See instructions in `scripts/azure-pipelines/osx/README.md`)
2424
* [ ] Deploy the new base box to all hosts.
25-
* [ ] Update the software on the CTI's machine #12 to match.
25+
* [ ] Update the software on the CTI's machine #1 to match.

.github/workflows/test_modified_ports.yml

+193-8
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,206 @@ on:
33
push:
44
branches:
55
- onboard-actions
6+
pull_request_target:
7+
branches:
8+
- onboard-actions
9+
schedule:
10+
- cron: "0 4 * * 1,3,5"
11+
permissions:
12+
# IMPORTANT
13+
# https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/
14+
# This workflow is configured to run on `pull_request_target`, which is necessary to have access
15+
# to id-token: write, which we need to authenticate to the Azure Storage account needed for
16+
# vcpkg's binary caching practical.
17+
# However, this means that build scripts of ports, which consist of 3rd party build scripts,
18+
# effectively have permssions granted here.
19+
# contents: read *must* be kept to prevent those untrusted build scripts writing to
20+
# github.com/microsoft/vcpkg.
21+
# On the Azure side, we assume that untrusted code has control of the 'VcpkgPrFleet' identity
22+
# we use to authenticate with Storage, firewall the accounts to be accessible only to the
23+
# hardware and VMs that run our PRs, and forbid interacting with any of those components using
24+
# corporate credentials. (For instance, the VMs where PRs are built cannot be logged into at all)
25+
id-token: write
26+
contents: read # Do *NOT* change to write
627
jobs:
7-
Windows:
28+
test:
29+
strategy:
30+
matrix:
31+
conf:
32+
- triplet: 'arm64-windows'
33+
pool: windows
34+
- triplet: 'arm64-windows-static-md'
35+
pool: windows
36+
- triplet: 'arm64-uwp'
37+
pool: windows
38+
- triplet: 'x86-windows'
39+
pool: windows
40+
extra-checks: true
41+
- triplet: 'x64-windows'
42+
pool: windows
43+
- triplet: 'x64-windows-static'
44+
pool: windows
45+
- triplet: 'x64-windows-static-md'
46+
pool: windows
47+
- triplet: 'x64-uwp'
48+
pool: windows
49+
- triplet: 'x64-linux'
50+
pool: linux
51+
- triplet: 'arm-neon-android'
52+
pool: android
53+
- triplet: 'x64-android'
54+
pool: android
55+
- triplet: 'arm64-android'
56+
pool: android
857
runs-on:
958
- self-hosted
10-
- "1ES.Pool=vcpkg-windows-wus"
59+
- "1ES.Pool=${{ matrix.conf.pool == 'windows' && 'vcpkg-windows-ephemeral-wus' || matrix.conf.pool == 'linux' && 'vcpkg-linux-ephemeral-wus' || matrix.conf.pool == 'android' && 'vcpkg-android-ephemeral-wus' }}"
60+
continue-on-error: true
61+
timeout-minutes: 2880 # 2 days
62+
env:
63+
VCPKG_DOWNLOADS: ${{ matrix.conf.pool == 'windows' && 'D:\downloads' || '/mnt/vcpkg-ci/downloads' }}
64+
WORKING_ROOT: ${{ matrix.conf.pool == 'windows' && 'D:\' || '/mnt/vcpkg-ci' }}
65+
ARTIFACT_STAGING: ${{ matrix.conf.pool == 'windows' && 'D:\artifactstaging' || '/mnt/vcpkg-ci/artifactstaging' }}
1166
steps:
12-
- name: Checkout
67+
- name: Make Working Directories (Windows)
68+
if: ${{ success() && matrix.conf.pool == 'windows' }}
69+
run: |
70+
mkdir D:\downloads
71+
mkdir D:\artifactstaging
72+
- name: Make Working Directories (non-Windows)
73+
if: ${{ success() && matrix.conf.pool != 'windows' }}
74+
run: |
75+
sudo mkdir ${{ env.WORKING_ROOT }} -m=777
76+
sudo mkdir ${{ env.WORKING_ROOT }}/failure-logs -m=777
77+
sudo mkdir ${{ env.VCPKG_DOWNLOADS }} -m=777
78+
sudo mkdir ${{ env.ARTIFACT_STAGING }} -m=777
79+
- name: Checkout (Windows)
1380
uses: actions/checkout@v4
81+
if: ${{ success() && matrix.conf.pool == 'windows' }}
82+
env:
83+
PATH: c:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\cmd;$PATH
1484
with:
1585
# fetch-depth 50 tries to ensure we capture the whole history of the branch
1686
fetch-depth: 50
87+
ref: ${{ github.event.pull_request.head.sha }}
88+
- name: Checkout (Non-Windows)
89+
uses: actions/checkout@v4
90+
if: ${{ success() && matrix.conf.pool != 'windows' }}
91+
with:
92+
# fetch-depth 50 tries to ensure we capture the whole history of the branch
93+
fetch-depth: 50
94+
ref: ${{ github.event.pull_request.head.sha }}
95+
- name: Azure Login
96+
uses: azure/login@v2
97+
with:
98+
client-id: a81b4cd3-9d8d-4cb9-9a74-f2038f24f224
99+
subscription-id: 7fcb00fa-a761-49de-8a2f-d67190e62882
100+
tenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47
101+
- name: Bootstrap (Windows)
102+
if: ${{ success() && matrix.conf.pool == 'windows' }}
103+
run: ./scripts/bootstrap.ps1
104+
- name: Bootstrap (Non-Windows)
105+
if: ${{ success() && matrix.conf.pool != 'windows' && matrix.conf.pool != 'android' }}
106+
run: ./scripts/bootstrap.sh
107+
- name: Format Manifests
108+
if: ${{ success() && matrix.conf.extra-checks }}
109+
run: ./vcpkg.exe format-manifest --all
110+
- name: Create Format Manifest Diff
111+
if: ${{ success() && matrix.conf.extra-checks }}
112+
env:
113+
PATH: c:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\cmd;$PATH
114+
run: ./scripts/azure-pipelines/Create-PRDiff.ps1 -DiffFile "${{ env.ARTIFACT_STAGING }}/format.diff"
115+
- name: 'Publish Artifact: Format Diff'
116+
uses: actions/upload-artifact@v4
117+
if: ${{ failure() && !cancelled() && matrix.conf.extra-checks }}
118+
with:
119+
name: 'format.diff'
120+
path: "${{ env.ARTIFACT_STAGING }}/format.diff"
121+
retention-days: 7
122+
if-no-files-found: error
123+
- name: "*** Test Modified Ports (non-Android)"
124+
if: ${{ success() && matrix.conf.pool != 'android' }}
125+
shell: pwsh
126+
run: |
127+
$current = Get-Date -AsUtc
128+
$endDate = $current.AddDays(2)
129+
$end = Get-Date -Date $endDate -UFormat '+%Y-%m-%dT%H:%MZ'
130+
Write-Host "Getting Asset Cache SAS"
131+
$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
132+
if ($LastExitCode -ne 0) {
133+
Write-Error "Failed to get Asset Cache SAS"
134+
return 1
135+
}
136+
137+
$assetSas = $assetSas.Trim()
138+
Write-Host "Getting Binary Cache SAS"
139+
$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
140+
if ($LastExitCode -ne 0) {
141+
Write-Error "Failed to get Binary Cache SAS"
142+
return 1
143+
}
17144
18-
- name: Bootstrap
19-
run: ./bootstrap-vcpkg.sh
20-
21-
- name: Example
145+
$binarySas = $binarySas.Trim()
146+
$env:X_VCPKG_ASSET_SOURCES = "x-azurl,https://vcpkgassetcachewus3.blob.core.windows.net/cache,$assetSas,readwrite"
147+
if ($IsWindows) { # FIXME: Git in the images
148+
$env:PATH += ";c:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\cmd"
149+
}
150+
151+
& scripts/azure-pipelines/test-modified-ports.ps1 -Triplet ${{ matrix.conf.triplet }} -BuildReason ${{ github.event_name }} -BinarySourceStub "x-azblob,https://vcpkgbinarycachewus.blob.core.windows.net/cache,$binarySas" -WorkingRoot $env:WORKING_ROOT -ArtifactStagingDirectory $env:ARTIFACT_STAGING
152+
- name: "*** Test Modified Ports (Android)"
153+
if: ${{ success() && matrix.conf.pool == 'android' }}
154+
run: |
155+
az acr login --name vcpkgandroidwus
156+
docker pull vcpkgandroidwus.azurecr.io/vcpkg-android:2024-10-21
157+
docker run --rm \
158+
--mount type=bind,source=${{ github.workspace }},target=/vcpkg \
159+
vcpkgandroidwus.azurecr.io/vcpkg-android:2024-10-21 \
160+
./bootstrap-vcpkg.sh
161+
end=`date -u -d "2 days" '+%Y-%m-%dT%H:%MZ'`
162+
assetSas=`az storage container generate-sas --name cache --account-name vcpkgassetcachewus3 --as-user --auth-mode login --https-only --permissions rcl --expiry $end -o tsv`
163+
binarySas=`az storage container generate-sas --name cache --account-name vcpkgbinarycachewus --as-user --auth-mode login --https-only --permissions rclw --expiry $end -o tsv`
164+
echo Minting SAS tokens valid through $end
165+
USER=$(id --user)
166+
docker run --init -i \
167+
-a stderr \
168+
-a stdout \
169+
--user $USER \
170+
--mount type=bind,source=${{ github.workspace }},target=/vcpkg \
171+
--mount type=bind,source=/mnt/vcpkg-ci/failure-logs,target=/vcpkg/failure-logs \
172+
--mount type=bind,source=/mnt/vcpkg-ci,target=/mnt/vcpkg-ci \
173+
--env X_VCPKG_ASSET_SOURCES="x-azurl,https://vcpkgassetcachewus3.blob.core.windows.net/cache,$assetSas,readwrite" \
174+
vcpkgandroidwus.azurecr.io/vcpkg-android:2024-10-21 \
175+
pwsh \
176+
-File /vcpkg/scripts/azure-pipelines/test-modified-ports.ps1 \
177+
-Triplet ${{ matrix.conf.triplet }} \
178+
-BuildReason ${{ github.event_name }} \
179+
-BinarySourceStub "x-azblob,https://vcpkgbinarycachewus.blob.core.windows.net/cache,$binarySas" \
180+
-WorkingRoot /mnt/vcpkg-ci \
181+
-ArtifactStagingDirectory /mnt/vcpkg-ci/artifactstaging
182+
- name: 'Validate version files'
183+
if: ${{ success() && matrix.conf.extra-checks }}
184+
env:
185+
PATH: c:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\cmd;$PATH
186+
run: 'scripts/azure-pipelines/windows/validate-version-files.ps1'
187+
- name: 'Publish Artifact: failure logs for ${{ matrix.conf.triplet }}'
188+
if: ${{ !cancelled() }}
189+
uses: actions/upload-artifact@v4
190+
with:
191+
name: 'failure logs for ${{ matrix.conf.triplet }}'
192+
path: '${{ env.ARTIFACT_STAGING }}/failure-logs'
193+
retention-days: 7
194+
if-no-files-found: ignore
195+
- name: 'Build a file list for all packages'
196+
if: ${{ !cancelled() }}
22197
shell: pwsh
23-
run: Write-Host 'Running on 1ES Hosted GitHub Runners'
198+
run: |
199+
./vcpkg fetch python3
200+
& $(./vcpkg fetch python3) ./scripts/file_script.py "$env:WORKING_ROOT/installed/vcpkg/info/"
201+
- name: 'Publish Artifact: file lists for ${{ matrix.conf.triplet }}'
202+
uses: actions/upload-artifact@v4
203+
if: ${{ !cancelled() }}
204+
with:
205+
name: 'file lists for ${{ matrix.conf.triplet }}'
206+
path: scripts/list_files
207+
retention-days: 7
208+
if-no-files-found: ignore

scripts/azure-pipelines/android/azure-pipelines.yml

-112
This file was deleted.

0 commit comments

Comments
 (0)