-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
101 lines (89 loc) · 2.65 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# ASP.NET Core (.NET Framework)
# Build and test ASP.NET Core projects targeting the full .NET Framework.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
trigger:
branches:
include:
- master
paths:
exclude:
- '*.md'
- '*.MD'
- 'README.md'
- 'SECURITY.md'
- '.gitignore'
pool:
vmImage: 'ubuntu-20.04'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: Bash@3
displayName: "Install docker-compose"
inputs:
targetType: 'inline'
script: |
sudo curl -L https://github.com/docker/compose/releases/download/1.18.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
- task: Bash@3
displayName: "Start a CouchDb instance"
inputs:
targetType: 'inline'
script: |
cd tests/integration
docker-compose up -d
cd -
- task: Bash@3
displayName: "Build docker container"
inputs:
targetType: 'inline'
script: |
docker build -t couchdb-lib .
- task: Bash@3
displayName: "Create test result output folder"
inputs:
targetType: 'inline'
script: |
mkdir output
chmod -R 777 output
- task: Bash@3
displayName: "Wait for CouchDb to be online"
inputs:
targetType: 'inline'
script: |
scripts/up-test.sh localhost 5985
- task: Bash@3
displayName: "Run tests in container"
inputs:
targetType: 'inline'
script: |
HOSTIP=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')
docker run --name couchdb_tests -e COUCHDB_HOST=$HOSTIP couchdb-lib:latest test
docker cp couchdb_tests:/output/integration.xml output/
docker rm couchdb_tests
- task: PublishTestResults@2
displayName: "Publish test results to the Azure dashboard"
inputs:
testResultsFormat: 'XUnit'
testResultsFiles: 'output/*.xml'
failTaskOnFailedTests: true
- task: Bash@3
displayName: "Create a nuget package"
env:
NUGET_ORG_KEY: $(NUGET_KEY)
inputs:
targetType: 'inline'
script: |
HOSTIP=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')
docker run --name couchdb_tests -e NUGET_ORG_KEY=$NUGET_ORG_KEY couchdb-lib:latest nuget
docker cp couchdb_tests:/output/couchdb.nupkg $(Build.ArtifactStagingDirectory)
docker rm couchdb_tests
echo "Contents of the ArtifactStagingDirectory:"
ls $(Build.ArtifactStagingDirectory)
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'nuget-package'
publishLocation: 'Container'