Files
dotnet-packaging/.azure-pipelines.yml
Nickolas Gupton 330216e4a5 .NET 10 support
2025-12-14 08:30:51 +00:00

411 lines
12 KiB
YAML

trigger:
- master
resources:
containers:
- container: 2.2-bionic
image: mcr.microsoft.com/dotnet/core/sdk:2.2-bionic
- container: 3.0-disco
image: mcr.microsoft.com/dotnet/core/sdk:3.0-disco
- container: 3.0-buster
image: mcr.microsoft.com/dotnet/core/sdk:3.0-buster
- container: 3.1-focal
image: mcr.microsoft.com/dotnet/core/sdk:3.1-focal
- container: 5.0-focal
image: mcr.microsoft.com/dotnet/sdk:5.0-focal
- container: 5.0-buster
image: mcr.microsoft.com/dotnet/sdk:5.0-buster-slim
- container: 5.0-bullseye
image: mcr.microsoft.com/dotnet/sdk:5.0-bullseye-slim
- container: 5.0-nanoserver
image: mcr.microsoft.com/dotnet/sdk:5.0-nanoserver-1809
- container: 6.0-focal
image: mcr.microsoft.com/dotnet/sdk:6.0-focal
- container: 6.0-bullseye
image: mcr.microsoft.com/dotnet/sdk:6.0-bullseye-slim
- container: 6.0-nanoserver
image: mcr.microsoft.com/dotnet/sdk:6.0-nanoserver-1809
- container: 7.0-bullseye
image: mcr.microsoft.com/dotnet/sdk:7.0-bullseye-slim
- container: 7.0-nanoserver
image: mcr.microsoft.com/dotnet/sdk:7.0-nanoserver-1809
- container: 8.0-jammy
image: mcr.microsoft.com/dotnet/sdk:8.0-jammy
- container: 8.0-nanoserver
image: mcr.microsoft.com/dotnet/sdk:8.0-nanoserver-1809
- container: 9.0-noble
image: mcr.microsoft.com/dotnet/sdk:9.0-noble
- container: 9.0-nanoserver
image: mcr.microsoft.com/dotnet/sdk:9.0-nanoserver-1809
- container: 10.0-noble
image: mcr.microsoft.com/dotnet/sdk:10.0-noble
- container: 10.0-nanoserver
image: mcr.microsoft.com/dotnet/sdk:10.0-nanoserver-ltsc2025
stages:
- stage: Build
jobs:
- job: build_noble
container: 10.0-noble
pool:
vmImage: ubuntu-22.04
steps:
- bash: |
dotnet restore dotnet-packaging.sln
dotnet pack dotnet-packaging.sln -c Release -o $(Build.ArtifactStagingDirectory)
dotnet test Packaging.Targets.Tests/Packaging.Targets.Tests.csproj -l "trx;LogFileName=$(Build.ArtifactStagingDirectory)/Packaging.Targets.Tests.trx"
cp demo/Directory.Build.props $(Build.ArtifactStagingDirectory)
cp demo/version.txt $(Build.ArtifactStagingDirectory)
displayName: Build
- task: PublishTestResults@2
inputs:
testRunner: VSTest
testResultsFiles: $(Build.ArtifactStagingDirectory)/*.trx
condition: true
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: $(Build.ArtifactStagingDirectory)
artifactName: nuget
- job: build_windows
pool:
vmImage: windows-2019
container: 10.0-nanoserver-ltsc2025
# Make sure we can run scripts in PowerShell core:
# https://github.com/microsoft/azure-pipelines-tasks/issues/11448
variables:
agent.preferPowerShellOnContainers: false
steps:
- pwsh: |
dotnet restore dotnet-packaging.sln
dotnet pack dotnet-packaging.sln -c Release -o $(Build.ArtifactStagingDirectory)
dotnet test Packaging.Targets.Tests/Packaging.Targets.Tests.csproj -l "trx;LogFileName=$(Build.ArtifactStagingDirectory)/Packaging.Targets.Tests.trx"
displayName: Build
- task: PublishTestResults@2
inputs:
testRunner: VSTest
testResultsFiles: $(Build.ArtifactStagingDirectory)/*.trx
- stage: Test
jobs:
- job: build_package
strategy:
maxParallel: 8
matrix:
3.1-focal-deb:
container: 3.1-focal
command: deb
3.1-disco-rpm:
container: 3.1-focal
command: rpm
3.1-focal-zip:
container: 3.1-focal
command: zip
3.1-focal-tarball:
container: 3.1-focal
command: tarball
5.0-focal-deb:
container: 5.0-focal
command: deb
5.0-focal-rpm:
container: 5.0-focal
command: rpm
5.0-focal-zip:
container: 5.0-focal
command: zip
5.0-focal-tarball:
container: 5.0-focal
command: tarball
5.0-buster-deb:
container: 5.0-buster
command: deb
5.0-buster-rpm:
container: 5.0-buster
command: rpm
5.0-buster-zip:
container: 5.0-buster
command: zip
5.0-buster-tarball:
container: 5.0-buster
command: tarball
5.0-bullseye-deb:
container: 5.0-bullseye
command: deb
5.0-bullseye-rpm:
container: 5.0-bullseye
command: rpm
5.0-bullseye-zip:
container: 5.0-bullseye
command: zip
5.0-bullseye-tarball:
container: 5.0-bullseye
command: tarball
6.0-focal-deb:
container: 6.0-focal
command: deb
6.0-focal-rpm:
container: 6.0-focal
command: rpm
6.0-focal-zip:
container: 6.0-focal
command: zip
6.0-focal-tarball:
container: 6.0-focal
command: tarball
6.0-bullseye-deb:
container: 6.0-bullseye
command: deb
6.0-bullseye-rpm:
container: 6.0-bullseye
command: rpm
6.0-bullseye-zip:
container: 6.0-bullseye
command: zip
6.0-bullseye-tarball:
container: 6.0-bullseye
command: tarball
7.0-bullseye-deb:
container: 7.0-bullseye
command: deb
7.0-bullseye-rpm:
container: 7.0-bullseye
command: rpm
7.0-bullseye-zip:
container: 7.0-bullseye
command: zip
7.0-bullseye-tarball:
container: 7.0-bullseye
command: tarball
8.0-jammy-deb:
container: 8.0-jammy
command: deb
8.0-jammy-rpm:
container: 8.0-jammy
command: rpm
8.0-jammy-zip:
container: 8.0-jammy
command: zip
8.0-jammy-tarball:
container: 8.0-jammy
command: tarball
9.0-noble-deb:
container: 9.0-noble
command: deb
9.0-noble-rpm:
container: 9.0-noble
command: rpm
9.0-noble-zip:
container: 9.0-noble
command: zip
9.0-noble-tarball:
container: 9.0-noble
command: tarball
10.0-noble-deb:
container: 10.0-noble
command: deb
10.0-noble-rpm:
container: 10.0-noble
command: rpm
10.0-noble-zip:
container: 10.0-noble
command: zip
10.0-noble-tarball:
container: 10.0-noble
command: tarball
container: $[ variables['container'] ]
pool:
vmImage: ubuntu-22.04
steps:
- template: .azure-pipelines-shared.yml
- job: molecule
pool:
vmImage: ubuntu-22.04
strategy:
maxParallel: 8
matrix:
self-contained-3_1:
suite: self-contained
framework: netcoreapp3.1
framework-dependent-app-3_1:
suite: framework-dependent
framework: netcoreapp3.1
self-contained-5_0:
suite: self-contained
framework: net5.0
framework-dependent-app-5_0:
suite: framework-dependent
framework: net5.0
self-contained-6_0:
suite: self-contained
framework: net6.0
framework-dependent-app-6_0:
suite: framework-dependent
framework: net6.0
self-contained-7_0:
suite: self-contained
framework: net7.0
framework-dependent-app-7_0:
suite: framework-dependent
framework: net7.0
self-contained-8_0:
suite: self-contained
framework: net8.0
framework-dependent-app-8_0:
suite: framework-dependent
framework: net8.0
self-contained-9_0:
suite: self-contained
framework: net9.0
framework-dependent-app-9_0:
suite: framework-dependent
framework: net9.0
self-contained-10_0:
suite: self-contained
framework: net10.0
framework-dependent-app-10_0:
suite: framework-dependent
framework: net10.0
steps:
- task: UseDotNet@2
displayName: 'Use .NET Core 10.0'
inputs:
packageType: sdk
version: 10.0.x
- bash: |
set -e
export PATH=~/.local/bin/:$PATH
pip3 install --upgrade pip
pip3 install wheel
pip3 install --upgrade --user setuptools
pip3 install --user ansible==4.8.0
pip3 install --user molecule==3.5.2
pip3 install --user molecule-docker==1.1.0
pip3 install --user docker==5.0.3
pip3 install --user pytest==6.2.5
pip3 install --user testinfra==6.0.0
molecule --version
ansible --version
pytest --version
dotnet --version
displayName: Install molecule
- task: DownloadBuildArtifacts@0
displayName: Download Build Artifacts
inputs:
artifactName: nuget
downloadPath: $(Build.ArtifactStagingDirectory)
- bash: |
set -e
export PATH="$PATH:/$HOME/.dotnet/tools"
cd $(suite)-app
echo "<configuration><packageSources><add key='local' value='$(Build.ArtifactStagingDirectory)/nuget' /></packageSources></configuration>" > NuGet.config
version=$(cat $(Build.ArtifactStagingDirectory)/nuget/version.txt)
# Install the dotnet-rpm and dotnet-deb tools
dotnet tool install --global dotnet-deb --version $version --add-source $(Build.ArtifactStagingDirectory)/nuget
dotnet tool install --global dotnet-rpm --version $version --add-source $(Build.ArtifactStagingDirectory)/nuget
# Create .deb and .rpm packages
dotnet rpm install
dotnet rpm -o $(Build.SourcesDirectory)/molecule/$(suite)/ -f $(framework)
dotnet deb -o $(Build.SourcesDirectory)/molecule/$(suite)/ -f $(framework)
workingDirectory: $(Build.SourcesDirectory)/molecule/$(suite)
displayName: Build $(suite)-app for $(framework)
- bash: |
set -e
export PATH=~/.local/bin/:$PATH
molecule test
workingDirectory: $(Build.SourcesDirectory)/molecule/$(suite)
displayName: Run molecule tests for $(suite)-app
- task: PublishTestResults@2
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: 'pytest.xml'
searchFolder: '$(Build.SourcesDirectory)/molecule/$(suite)/molecule/default/'
condition: always()
displayName: Publish test results
- job: build_macos
pool:
vmImage: macOS-10.15
variables:
container: macos
command: tarball
steps:
- task: UseDotNet@2
displayName: 'Use .NET Core 3.1'
inputs:
packageType: sdk
version: 3.1.415
- template: .azure-pipelines-shared.yml
- job: test_macos
pool:
vmImage: macOS-10.15
dependsOn: build_macos
steps:
- task: DownloadBuildArtifacts@0
displayName: Download Build Artifacts
inputs:
artifactName: packages
downloadPath: $(Build.ArtifactStagingDirectory)/
- task: UseDotNet@2
displayName: 'Use .NET Core 3.1'
inputs:
packageType: sdk
version: 3.1.415
- bash: |
set -e
tar xvzf $(Build.ArtifactStagingDirectory)/packages/macos/test-tarball.1.0.0.tar.gz
displayName: Extract tarball
# .NET Core 3.x adn 5.x don't generate an app host for because the apps won't run on ARM if not notarized.
# See https://github.com/dotnet/sdk/pull/4019/files and https://github.com/dotnet/sdk/issues/4012.
# This means there's no 'test-tarball' executable to run.
- bash: |
set -e
dotnet ./test-tarball.dll
displayName: Execute program
- job: publish_nuget
pool:
vmImage: windows-2019
dependsOn:
- test_macos
- molecule
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
steps:
- task: DownloadBuildArtifacts@0
inputs:
artifactName: 'nuget'
displayName: 'Download NuGet artifacts'
- task: NuGetToolInstaller@0
displayName: Install NuGet
- task: NuGetCommand@2
inputs:
command: push
packagesToPush: '$(System.ArtifactsDirectory)/nuget/*.nupkg'
publishFeedCredentials: 'NuGet'
nuGetFeedType: external