-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathazure-pipelines.yml
113 lines (95 loc) · 3.68 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
102
103
104
105
106
107
108
109
110
111
112
113
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
- master
- develop
pr:
- master
- develop
variables:
majorVersion: '0.4'
minorVersion: $[counter('minorVersion', 29)]
lidarrVersion: '$(majorVersion).$(minorVersion)'
buildName: '$(Build.SourceBranchName).$(lidarrVersion)'
imageName: 'lidarr/lidarrapi.metadata'
sentryOrg: 'servarr'
sentryUrl: 'https://sentry.servarr.com'
jobs:
- job:
displayName: Build
pool:
vmImage: 'Ubuntu-20.04'
steps:
- powershell: Write-Host "##vso[build.updatebuildnumber]$($env:LIDARRVERSION)"
displayName: 'Set Build Name'
- bash: sed -i'' -e "s/10.0.0.0/$LIDARRVERSION/g" lidarrmetadata/__init__.py
displayName: 'Set Code Version'
- task: UsePythonVersion@0
displayName: 'Set Python Version 3.9'
inputs:
versionSpec: '3.9'
- task: SonarCloudPrepare@1
inputs:
SonarCloud: 'SonarCloud'
organization: 'lidarr'
scannerMode: 'CLI'
configMode: 'manual'
cliProjectKey: 'lidarr_LidarrAPI.Metadata'
cliProjectName: 'LidarrAPI.Metadata'
cliProjectVersion: $(lidarrVersion)
cliSources: 'lidarrmetadata'
extraProperties: |
sonar.python.coverage.reportPath=$(System.DefaultWorkingDirectory)/coverage.xml
# - script: python -m pip install -U -Iv pypandoc==1.5 tox==3.23.0 poetry
# displayName: 'Install tools'
# - script: tox -e py39
# displayName: 'Run Tests'
# - task: PublishTestResults@2
# inputs:
# testResultsFiles: '**/test-*.xml'
# testRunTitle: 'Linux - Python 3.9'
# condition: succeededOrFailed()
# - publish: $(System.DefaultWorkingDirectory)/htmlcov
# artifact: 'PyTestCoverageReport'
# displayName: Publish PyTest Coverage Report
# condition: succeededOrFailed()
# - task: PublishCodeCoverageResults@1
# inputs:
# codeCoverageTool: Cobertura
# summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.xml'
# reportDirectory: '$(System.DefaultWorkingDirectory)/**/htmlcov'
# condition: succeededOrFailed()
# - task: SonarCloudAnalyze@1
# displayName: 'Run Sonarcloud Analysis'
- task: Docker@2
displayName: Build image
condition: and(succeeded(), eq(variables['system.pullrequest.isfork'], false))
inputs:
command: build
Dockerfile: Dockerfile
arguments: --build-arg GIT_BRANCH=$(Build.SourceBranchName) --build-arg COMMIT_HASH=$(Build.SourceVersion) -t ghcr.io/$(imageName):latest -t ghcr.io/$(imageName):$(Build.SourceBranchName)
- task: Docker@2
displayName: Push image
condition: and(succeeded(), eq(variables['system.pullrequest.isfork'], false))
inputs:
containerRegistry: 'ghcr'
repository: $(imageName)
command: push
tags: |
latest
$(Build.SourceBranchName)
- bash: |
echo "Creating sentry release"
SENTRYRELEASE="lidarr-metadata-${LIDARRVERSION}"
curl -sL https://sentry.io/get-cli/ | bash
sentry-cli releases new --finalize -p lidarr-metadata "${SENTRYRELEASE}"
sentry-cli releases set-commits --auto "${SENTRYRELEASE}"
sentry-cli releases deploys "${SENTRYRELEASE}" new -e production
displayName: Create sentry release
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/develop'), eq(variables['system.pullrequest.isfork'], false))
env:
SENTRY_AUTH_TOKEN: $(sentryAuthTokenServarr)
SENTRY_ORG: $(sentryOrg)
SENTRY_URL: $(sentryUrl)