mirror of
https://github.com/quamotion/dotnet-packaging.git
synced 2026-02-04 05:35:40 +00:00
166 lines
4.8 KiB
YAML
166 lines
4.8 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
|
|
|
|
stages:
|
|
- stage: Build
|
|
jobs:
|
|
- job: build
|
|
container: 3.0-buster
|
|
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
|
|
|
|
cp demo/Directory.Build.props $(Build.ArtifactStagingDirectory)
|
|
cp demo/version.txt $(Build.ArtifactStagingDirectory)
|
|
displayName: Build
|
|
- task: PublishBuildArtifacts@1
|
|
inputs:
|
|
pathToPublish: $(Build.ArtifactStagingDirectory)
|
|
artifactName: nuget
|
|
|
|
- stage: Test
|
|
jobs:
|
|
- job: build_package
|
|
strategy:
|
|
maxParallel: 8
|
|
matrix:
|
|
2.2-bionic-deb:
|
|
container: 2.2-bionic
|
|
command: deb
|
|
2.2-bionic-rpm:
|
|
container: 2.2-bionic
|
|
command: rpm
|
|
2.2-bionic-zip:
|
|
container: 2.2-bionic
|
|
command: zip
|
|
2.2-bionic-tarball:
|
|
container: 2.2-bionic
|
|
command: tarball
|
|
|
|
3.0-disco-deb:
|
|
container: 3.0-disco
|
|
command: deb
|
|
3.0-disco-rpm:
|
|
container: 3.0-disco
|
|
command: rpm
|
|
3.0-disco-zip:
|
|
container: 3.0-disco
|
|
command: zip
|
|
3.0-disco-tarball:
|
|
container: 3.0-disco
|
|
command: tarball
|
|
|
|
container: $[ variables['container'] ]
|
|
steps:
|
|
- template: .azure-pipelines-shared.yml
|
|
|
|
- job: molecule
|
|
pool:
|
|
vmImage: 'ubuntu-18.04'
|
|
strategy:
|
|
maxParallel: 8
|
|
matrix:
|
|
self-contained:
|
|
suite: self-contained
|
|
framework-dependent-app:
|
|
suite: framework-dependent
|
|
steps:
|
|
- bash: |
|
|
set -e
|
|
export PATH=~/.local/bin/:$PATH
|
|
|
|
pip3 install wheel
|
|
pip3 install --upgrade --user setuptools
|
|
pip3 install --user molecule
|
|
pip3 install --user docker-py
|
|
molecule --version
|
|
ansible --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)/
|
|
dotnet deb -o $(Build.SourcesDirectory)/molecule/$(suite)/
|
|
workingDirectory: $(Build.SourcesDirectory)/molecule/$(suite)
|
|
displayName: Build $(suite)-app
|
|
- 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.14'
|
|
variables:
|
|
container: macos
|
|
command: tarball
|
|
steps:
|
|
- task: UseDotNet@2
|
|
displayName: 'Use .NET Core 3.0'
|
|
inputs:
|
|
packageType: sdk
|
|
version: 3.0.100
|
|
- template: .azure-pipelines-shared.yml
|
|
|
|
- job: test_macos
|
|
pool:
|
|
vmImage: 'macOS-10.14'
|
|
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.0'
|
|
inputs:
|
|
packageType: sdk
|
|
version: 3.0.100
|
|
- bash: |
|
|
set -e
|
|
tar xvzf $(Build.ArtifactStagingDirectory)/packages/macos/test-tarball.1.0.0.tar.gz
|
|
displayName: Extract tarball
|
|
- bash: |
|
|
set -e
|
|
chmod +x ./test-tarball
|
|
./test-tarball
|
|
displayName: Execute program |