# Main pipeline spec for CI/CD on Azure Pipelines. trigger: branches: include: - master - rc # We cannot use Pipeline's matrixing framework because only it works with # *runtime variables*, while we want to use templates with *parameters* which # are evaluated at *compile time* only. By coding our matrixing data as # top-level parameters, we can use them in compile-time template evaluation # (`${{ }}` expressions) to achieve a matrixing effect. Only a few *variables* # can be used at compile time: see "Available in templates?" in the table at: # https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml # This is why some platform-specific steps use `condition:` terms rather than # compile-time `${{ if }}:` statements. parameters: - name: builds type: object default: - name: linux_stable vmImage: ubuntu-20.04 params: primaryBuild: true vars: TARGET: x86_64-unknown-linux-gnu TOOLCHAIN: stable - name: linux_beta vmImage: ubuntu-20.04 params: canaryBuild: true vars: TARGET: x86_64-unknown-linux-gnu TOOLCHAIN: beta - name: linux_nightly vmImage: ubuntu-20.04 params: canaryBuild: true vars: TARGET: x86_64-unknown-linux-gnu TOOLCHAIN: nightly - name: windows_msvc vmImage: windows-2019 params: {} vars: TARGET: x86_64-pc-windows-msvc TOOLCHAIN: stable-x86_64-pc-windows-msvc - name: windows_gnu vmImage: windows-2019 params: {} vars: TARGET: x86_64-pc-windows-gnu TOOLCHAIN: stable-x86_64-pc-windows-gnu - name: macos vmImage: macos-11 params: {} vars: TARGET: x86_64-apple-darwin TOOLCHAIN: stable stages: - stage: BuildAndTest jobs: - ${{ each build in parameters.builds }}: - job: ${{ format('build_{0}', build.name) }} pool: vmImage: ${{ build.vmImage }} steps: - template: azure-build-and-test.yml parameters: ${{ insert }}: ${{ build.params }} variables: ${{ insert }}: ${{ build.vars }} # If all of those succeed and we're not in a pull request, run the deployment # pipeline. If we're specifically on the `rc` branch, this will finalize any # releases. - stage: Deploy condition: and(succeeded('BuildAndTest'), not(eq(variables['build.reason'], 'PullRequest'))) jobs: - deployment: Deploy environment: Deploy displayName: Deploy pool: vmImage: ubuntu-20.04 variables: - group: Deployment Credentials strategy: runOnce: deploy: steps: - template: azure-deployment.yml parameters: rcBuild: ${{ eq(variables['Build.SourceBranchName'], 'rc') }}