forked from RPCS3/discord-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
94 lines (78 loc) · 2.46 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
#trigger:
#- master
#pr:
#- master
jobs:
- job: BuildAndTest
displayName: 'Run tests'
pool:
vmImage: 'ubuntu-latest'
timeoutInMinutes: 2
steps:
- task: UseDotNet@2
displayName: 'update dotnet core sdk'
inputs:
version: "3.1.x"
- script: dotnet restore --ignore-failed-sources
displayName: 'dotnet restore (first try)'
- script: dotnet restore --ignore-failed-sources
displayName: 'dotnet restore (second try)'
- script: dotnet restore
displayName: 'dotnet restore (last try)'
- script: dotnet build --configuration Debug
displayName: 'dotnet build Debug'
- task: DotNetCoreCLI@2
displayName: 'dotnet test'
inputs:
command: 'test'
projects: Tests/Tests.csproj
- job: DockerImage
displayName: 'Build Docker image'
condition: "and(succeeded(), eq(variables['ReleaseBranch'], variables['Build.SourceBranch']))"
dependsOn: BuildAndTest
pool:
vmImage: 'ubuntu-latest'
steps:
- script: git checkout -f $(Build.SourceBranchName)
displayName: 'create local tracking branch'
- script: git clean -dfx
displayName: 'clean build artifacts'
- task: UseDotNet@2
displayName: 'update dotnet core sdk'
inputs:
version: 3.1.x
- script: dotnet restore --ignore-failed-sources
displayName: 'dotnet restore (first try)'
- script: dotnet restore --ignore-failed-sources
displayName: 'dotnet restore (second try)'
- script: dotnet restore
displayName: 'dotnet restore (last try)'
- script: dotnet build --configuration Release
displayName: 'dotnet build Release'
- script: "mkdir packages && cp -a /home/vsts/.nuget/packages ./packages/"
displayName: 'copy nuget package cache for docker'
- task: Docker@2
displayName: 'logging into docker registry'
condition: succeeded()
inputs:
containerRegistry: $(DockerConnection)
command: 'login'
- task: Docker@2
displayName: 'building release docker image'
condition: "and(succeeded(), eq(variables['ReleaseKind'], 'release'))"
inputs:
repository: $(DockerRegistry)
command: 'buildAndPush'
Dockerfile: 'Dockerfile'
tags: |
$(Build.BuildId)
release-latest
latest
- task: Docker@2
displayName: 'building test docker image'
condition: "and(succeeded(), not(eq(variables['ReleaseKind'], 'release')))"
inputs:
repository: $(DockerRegistry)
command: 'buildAndPush'
Dockerfile: 'Dockerfile'
tags: test-latest