parameters: - name: canaryBuild type: boolean default: false - name: primaryBuild type: boolean default: false steps: - checkout: self - 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 # Helpful versions rustup -V rustc -Vv cargo -V displayName: Setup Rust - 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: | cranko release-workflow apply-versions displayName: "cranko release-workflow apply-versions" - bash: cargo build --all --release displayName: "cargo build" - bash: cargo test --all --release displayName: "cargo test" # For non-canary builds, export artifacts. - ${{ if eq(parameters.canaryBuild, false) }}: - bash: | git add . cranko release-workflow commit git show HEAD displayName: Make release commit - bash: | artifact_dir="$(Build.ArtifactStagingDirectory)/binary-$TARGET" mkdir -p "$artifact_dir" cranko cargo package-released-binaries -t $TARGET $artifact_dir -- build --release displayName: Package binaries - task: PublishPipelineArtifact@1 displayName: Publish packaged binary artifact(s) inputs: targetPath: '$(Build.ArtifactStagingDirectory)/binary-$(TARGET)' artifactName: binary-$(TARGET) # If, further, we're the primary build on the `rc` branch, export ours as the # canonical release commit. - ${{ if and(eq(parameters.primaryBuild, true), eq(variables['Build.SourceBranchName'], 'rc')) }}: - bash: | artifact_dir="$(Build.ArtifactStagingDirectory)/git-release" mkdir -p "$artifact_dir" git bundle create "$artifact_dir/release.bundle" origin/master..HEAD displayName: "Generate and Bundle release commit" - task: PublishPipelineArtifact@1 displayName: Publish git bundle artifact inputs: targetPath: '$(Build.ArtifactStagingDirectory)/git-release' artifactName: git-release