tectonic/dist/azure-generic-build-setup.yml

67 lines
2.3 KiB
YAML

# Copyright 2016-2022 the Tectonic Project
# Licensed under the MIT License.
#
# Generic setup for Azure Pipelines builds. Expected variables:
#
# - TOOLCHAIN: the rust toolchain type (e.g., "stable", "beta-x86_64-pc-windows-msvc")
steps:
- download: current
- checkout: self
submodules: true
- bash: |
set -ex
rustup set profile minimal
rustup component remove --toolchain=$TOOLCHAIN rust-docs || echo "already removed"
rustup update --no-self-update $TOOLCHAIN
rustup default $TOOLCHAIN
# Log versions
rustup -V
rustc -Vv
cargo -V
displayName: Set up Rust
# work around https://github.com/microsoft/azure-pipelines-tasks/issues/10653
# also note that `set -x` messes up `task.setvariable`
- bash: |
set -euo pipefail
PIPELINE_WORKSPACE="$(Pipeline.Workspace)"
ARTIFACT_STAGING="$(Build.ArtifactStagingDirectory)"
if [[ $AGENT_OS == Windows_NT ]] ; then
PIPELINE_WORKSPACE=$(echo "$PIPELINE_WORKSPACE" | sed -e 's|\\|\/|g' -e 's|^\([A-Za-z]\)\:/\(.*\)|/\L\1\E/\2|')
ARTIFACT_STAGING=$(echo "$ARTIFACT_STAGING" | sed -e 's|\\|\/|g' -e 's|^\([A-Za-z]\)\:/\(.*\)|/\L\1\E/\2|')
fi
echo "##vso[task.setvariable variable=PIPELINE_WORKSPACE;]$PIPELINE_WORKSPACE"
echo "##vso[task.setvariable variable=ARTIFACT_STAGING;]$ARTIFACT_STAGING"
displayName: Ensure bash-friendly variable names
# Builds need Cranko for packaging Cargo binaries
- bash: |
d="$(mktemp -d /tmp/cranko.XXXXXX)"
cd "$d"
curl --proto '=https' --tlsv1.2 -sSf https://pkgw.github.io/cranko/fetch-latest.sh | sh
echo "##vso[task.prependpath]$d"
displayName: Install latest Cranko (not Windows)
condition: and(succeeded(), ne(variables['Agent.OS'], 'Windows_NT'))
- pwsh: |
$d = Join-Path $Env:Temp cranko-$(New-Guid)
[void][System.IO.Directory]::CreateDirectory($d)
cd $d
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
iex ((New-Object System.Net.WebClient).DownloadString('https://pkgw.github.io/cranko/fetch-latest.ps1'))
echo "##vso[task.prependpath]$d"
displayName: Install latest Cranko (Windows)
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
- bash: |
set -xeuo pipefail
git switch -c release
git pull --ff-only $PIPELINE_WORKSPACE/git-release/release.bundle
displayName: Restore release commit