diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/scripts/azure-pipelines/android | |
Diffstat (limited to 'vcpkg/scripts/azure-pipelines/android')
| -rw-r--r-- | vcpkg/scripts/azure-pipelines/android/Dockerfile | 108 | ||||
| -rw-r--r-- | vcpkg/scripts/azure-pipelines/android/azure-pipelines.yml | 147 |
2 files changed, 255 insertions, 0 deletions
diff --git a/vcpkg/scripts/azure-pipelines/android/Dockerfile b/vcpkg/scripts/azure-pipelines/android/Dockerfile new file mode 100644 index 0000000..03144ab --- /dev/null +++ b/vcpkg/scripts/azure-pipelines/android/Dockerfile @@ -0,0 +1,108 @@ +# syntax=docker/dockerfile:1.4 +# DisableDockerDetector "Used to build the container deployed to Azure Container Registry" +FROM ubuntu:noble-20251001 + +ADD https://packages.microsoft.com/config/ubuntu/24.04/packages-microsoft-prod.deb /packages-microsoft-prod.deb +ADD https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.14+7/OpenJDK17U-jdk_x64_linux_hotspot_17.0.14_7.tar.gz /OpenJDK17U-jdk_x64_linux_hotspot_17.0.14_7.tar.gz +ADD https://dl.google.com/android/repository/commandlinetools-linux-10406996_latest.zip /sdk-commandlinetools-linux-10406996_latest.zip +ADD https://dl.google.com/android/repository/build-tools_r34-linux.zip /build-tools_r34-linux.zip +ADD https://dl.google.com/android/repository/platform-34-ext7_r03.zip /platform-34-ext7_r03.zip +ADD https://dl.google.com/android/repository/platform-tools_r35.0.1-linux.zip /platform-tools_r35.0.1-linux.zip +ADD https://dl.google.com/android/repository/android-ndk-r28c-linux.zip /android-ndk-r28c-linux.zip + +# Add apt packages + +## vcpkg prerequisites +ENV APT_PACKAGES="git curl zip unzip tar" + +## Common build prereqs +ENV APT_PACKAGES="$APT_PACKAGES g++ vim pkg-config cmake ca-certificates" + +ENV APT_PACKAGES="$APT_PACKAGES autoconf nasm bison flex build-essential libtool libtool-bin libltdl-dev gettext automake autoconf-archive" + +## Python related +ENV APT_PACKAGES="$APT_PACKAGES python3-setuptools python3-pip python3-venv python3-mako python3-jinja2" + +## at-spi2-atk +ENV APT_PACKAGES="$APT_PACKAGES libxtst-dev" + +## freeglut +ENV APT_PACKAGES="$APT_PACKAGES libxi-dev libgl1-mesa-dev libglu1-mesa-dev mesa-common-dev libxrandr-dev libxxf86vm-dev" + +# glfw3 +ENV APT_PACKAGES="$APT_PACKAGES libxinerama-dev libxcursor-dev" + +# qt5-base +ENV APT_PACKAGES="$APT_PACKAGES libxext-dev libxfixes-dev libxrender-dev \ + libxcb1-dev libx11-xcb-dev libxcb-glx0-dev libxcb-util0-dev \ + libxkbcommon-dev libxcb-keysyms1-dev \ + libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev libxcb-sync-dev \ + libxcb-xfixes0-dev libxcb-shape0-dev libxcb-randr0-dev \ + libxcb-render-util0-dev libxcb-xinerama0-dev libxcb-xkb-dev libxcb-xinput-dev \ + libxcb-cursor-dev libxkbcommon-x11-dev libsm6 libsm-dev" + +## PowerShell +ENV APT_PACKAGES="$APT_PACKAGES powershell azcopy" + +# The BUILD_DATE argument forces cache invalidation so we get updated apt dependencies +ARG BUILD_DATE +RUN echo "Build date: ${BUILD_DATE}" + +RUN <<END_OF_SCRIPT bash +set -e + +export DEBIAN_FRONTEND=noninteractive + +# Apt prereqs itself +apt-get -y update +apt-get -y --no-install-recommends install ca-certificates + +# Add apt repos + +## PowerShell +dpkg -i packages-microsoft-prod.deb +rm -f packages-microsoft-prod.deb + +# Run apt things +apt-get -y update +apt-get -y dist-upgrade + +apt-get -y --no-install-recommends install $APT_PACKAGES + +# OpenJDK +tar xzf OpenJDK17U-jdk_x64_linux_hotspot_17.0.14_7.tar.gz +rm OpenJDK17U-jdk_x64_linux_hotspot_17.0.14_7.tar.gz + +# Android SDK +unzip -q sdk-commandlinetools-linux-10406996_latest.zip -d android-sdk +rm sdk-commandlinetools-linux-10406996_latest.zip + +unzip -q build-tools_r34-linux.zip -d android-sdk/build-tools +mv android-sdk/build-tools/android-14 android-sdk/build-tools/34.0.0 +rm build-tools_r34-linux.zip + +unzip -q platform-34-ext7_r03.zip -d android-sdk/platforms +rm platform-34-ext7_r03.zip +find android-sdk/platforms -type d -exec chmod o+rx '{}' ';' +find android-sdk/platforms -type f -exec chmod o+r '{}' ';' + +unzip -q platform-tools_r35.0.1-linux.zip -d android-sdk +rm platform-tools_r35.0.1-linux.zip + +# JRE for sdk setup +export JAVA_HOME=/jdk-17.0.14+7 +yes | /android-sdk/cmdline-tools/bin/sdkmanager --sdk_root=/android-sdk --licenses + +# Android NDK +unzip -q /android-ndk-r28c-linux.zip +rm -f android-ndk-r28c-linux.zip + +END_OF_SCRIPT + +ENV JAVA_HOME /jdk-17.0.14+7 + +ENV ANDROID_HOME /android-sdk + +ENV ANDROID_NDK_HOME /android-ndk-r28c + +WORKDIR /vcpkg diff --git a/vcpkg/scripts/azure-pipelines/android/azure-pipelines.yml b/vcpkg/scripts/azure-pipelines/android/azure-pipelines.yml new file mode 100644 index 0000000..7cc5656 --- /dev/null +++ b/vcpkg/scripts/azure-pipelines/android/azure-pipelines.yml @@ -0,0 +1,147 @@ +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: MIT +# + +parameters: + - name: vcpkgToolSha + displayName: 'Custom SHA of vcpkg-tool to use rather than bootstrap' + type: string + default: 'use default' + - name: jobName + type: string + - name: tripletPattern + displayName: 'Enable the triplets which contain this substring' + type: string + default: '' + +jobs: +- job: ${{ parameters.jobName }} + condition: and(succeeded(), contains('^${{ replace(parameters.jobName, '_', '-') }}$', '${{ parameters.tripletPattern }}')) + pool: + name: PrAzureLinux3Docker + timeoutInMinutes: 1440 # 1 day + variables: + - name: WORKING_ROOT + value: /mnt/vcpkg-ci + - name: VCPKG_DOWNLOADS + value: /mnt/vcpkg-ci/downloads + - name: ANDROID_NDK_HOME + value: /android-ndk-r28c + - name: ANDROID_DOCKER_IMAGE + value: 'vcpkgandroidwus.azurecr.io/vcpkg-android:2025-10-16' + - name: LINUX_DOCKER_IMAGE + value: 'vcpkgandroidwus.azurecr.io/vcpkg-linux:2025-10-16' + steps: + # Note: /mnt is the Azure machines' temporary disk. + - bash: | + sudo mkdir /home/agent -m=777 + sudo chown `id -u` /home/agent + sudo mkdir ${{ variables.WORKING_ROOT }} -m=777 + sudo rm -rf ${{ variables.WORKING_ROOT }}/failure-logs + sudo mkdir ${{ variables.WORKING_ROOT }}/failure-logs -m=777 + sudo mkdir ${{ variables.VCPKG_DOWNLOADS }} -m=777 + # Move the docker layers to the temp disk. + sudo mkdir -p /etc/docker + echo '{"data-root": "/mnt/docker"}' | sudo tee /etc/docker/daemon.json + sudo systemctl restart docker + exit 0 + displayName: 'Create working directories' + - bash: ./bootstrap-vcpkg.sh -skipDependencyChecks + displayName: 'Bootstrap vcpkg' + condition: eq('use default', '${{ parameters.vcpkgToolSha }}') + - task: AzureCLI@2 + displayName: 'Build vcpkg with CMake' + condition: ne('use default', '${{ parameters.vcpkgToolSha }}') + inputs: + azureSubscription: 'vcpkg-pr-fleet-wus' + scriptType: bash + scriptLocation: 'inlineScript' + inlineScript: | + # This is a second pull but the vcpkgToolSha setting is used rarely. + USER=$(id --user) + az acr login --name vcpkgandroidwus + docker pull ${{ variables.LINUX_DOCKER_IMAGE }} + docker run --init -i --rm \ + -a stderr \ + -a stdout \ + --user $USER \ + --mount type=bind,source=$(Build.Repository.LocalPath),target=/vcpkg \ + --workdir /vcpkg \ + ${{ variables.LINUX_DOCKER_IMAGE }} \ + /vcpkg/scripts/azure-pipelines/bootstrap-from-source.sh ${{ parameters.vcpkgToolSha }} + - task: AzureCLI@2 + displayName: '*** Test Modified Ports' + inputs: + azureSubscription: 'vcpkg-pr-fleet-wus' + scriptType: bash + scriptLocation: 'inlineScript' # Be very very careful that the exit code from the last pwsh is reported correctly + inlineScript: | + end=`date -u -d "2 days" '+%Y-%m-%dT%H:%MZ'` + assetSas=`az storage container generate-sas --name cache --account-name vcpkgassetcachewus --as-user --auth-mode login --https-only --permissions rcl --expiry $end -o tsv` + binarySas=`az storage container generate-sas --name cache --account-name vcpkgbinarycachewus --as-user --auth-mode login --https-only --permissions rclw --expiry $end -o tsv` + echo Minting SAS tokens valid through $end + echo "##vso[task.setvariable variable=BCACHE_SAS_TOKEN;issecret=true]$binarySas" + USER=$(id --user) + az acr login --name vcpkgandroidwus + docker pull ${{ variables.ANDROID_DOCKER_IMAGE }} + docker run --init -i --rm \ + -a stderr \ + -a stdout \ + --user $USER \ + --mount type=bind,source=$(Build.Repository.LocalPath),target=/vcpkg \ + --mount type=bind,source=$(WORKING_ROOT)/failure-logs,target=/vcpkg/failure-logs \ + --mount type=bind,source=/mnt/vcpkg-ci,target=/mnt/vcpkg-ci \ + --env X_VCPKG_ASSET_SOURCES="x-azurl,https://vcpkgassetcachewus.blob.core.windows.net/cache,$assetSas,readwrite" \ + --env ANDROID_NDK_HOME="${{ variables.ANDROID_NDK_HOME }}" \ + --workdir /vcpkg \ + ${{ variables.ANDROID_DOCKER_IMAGE }} \ + pwsh \ + -File scripts/azure-pipelines/test-modified-ports.ps1 \ + -Triplet ${{ replace(parameters.jobName, '_', '-') }} \ + -BuildReason $(Build.Reason) \ + -BinarySourceStub "x-azcopy-sas,https://vcpkgbinarycachewus.blob.core.windows.net/cache,$binarySas" \ + -WorkingRoot ${{ variables.WORKING_ROOT }} + - task: PublishPipelineArtifact@1 + displayName: "Publish Artifact: failure logs for ${{ replace(parameters.jobName, '_', '-') }}" + inputs: + targetPath: '$(WORKING_ROOT)/failure-logs' + artifact: "failure logs for ${{ replace(parameters.jobName, '_', '-') }}" + condition: ne(variables['FAILURE_LOGS_EMPTY'], 'True') + - task: PublishPipelineArtifact@1 + displayName: "Publish Artifact: azcopy logs for ${{ replace(parameters.jobName, '_', '-') }}" + inputs: + targetPath: '$(WORKING_ROOT)/azcopy-logs' + artifactName: "z azcopy logs for ${{ replace(parameters.jobName, '_', '-') }}" + condition: ne(variables['AZCOPY_LOGS_EMPTY'], 'True') + - task: UseNode@1 + displayName: 'Ensure Node.js is available' + condition: always() + inputs: + version: '22.x' + - bash: | + cd scripts/azure-pipelines/owners-db && npm ci || true + if [ "$(Build.Reason)" = "PullRequest" ]; then + echo "Running file_script_from_cache for PR" + npx --yes ts-node ./file_script_from_cache.ts --pr-hashes "$(Build.Repository.LocalPath)/pr-hashes.json" --blob-base-url "https://vcpkgbinarycachewus.blob.core.windows.net/cache?${BCACHE_SAS_TOKEN}" --target-branch "origin/master" --out-dir ../../list_files + else + echo "Running file_script for CI" + npx --yes ts-node ./file_script.ts --info-dir /mnt/vcpkg-ci/installed/vcpkg/info/ --out-dir ../../list_files + fi + displayName: 'Build a file list for all packages' + condition: always() + env: + BCACHE_SAS_TOKEN: $(BCACHE_SAS_TOKEN) + - task: PublishPipelineArtifact@1 + displayName: "Publish Artifact: file lists for ${{ replace(parameters.jobName, '_', '-') }}" + condition: always() + inputs: + targetPath: scripts/list_files + artifact: "file lists for ${{ replace(parameters.jobName, '_', '-') }}" + - task: PublishTestResults@2 + displayName: 'Publish Test Results' + condition: ne(variables['XML_RESULTS_FILE'], '') + inputs: + testRunTitle: ${{ replace(parameters.jobName, '_', '-') }} + testResultsFormat: xUnit + testResultsFiles: $(XML_RESULTS_FILE) + platform: ${{ replace(parameters.jobName, '_', '-') }} |