Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
ta264 committed May 10, 2020
1 parent e87c27c commit 402347d
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 32 deletions.
94 changes: 67 additions & 27 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,65 +11,105 @@ 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:
strategy:
matrix:
Linux_Python37:
imageName: 'ubuntu-16.04'
osName: 'Linux'
pythonVersion: '3.7'
toxEnv: 'py37'
Windows_Python37:
imageName: 'vs2017-win2016'
osName: 'Windows'
pythonVersion: '3.7'
toxEnv: 'py37'
Mac_Python37:
imageName: 'macOS-latest'
osName: 'macOS'
pythonVersion: '3.7'
toxEnv: 'py37'
displayName: Test
displayName: Build

pool:
vmImage: $(imageName)
vmImage: 'Ubuntu-18.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 $(pythonVersion)'
inputs:
versionSpec: '$(pythonVersion)'
versionSpec: '3.7'

- task: SonarCloudPrepare@1
condition: and(succeeded(), eq(variables['osName'], 'Linux'))
inputs:
SonarCloud: 'SonarCloud'
organization: 'lidarr'
scannerMode: 'CLI'
configMode: 'manual'
cliProjectKey: 'lidarr_LidarrAPI.Metadata'
cliProjectName: 'LidarrAPI.Metadata'
cliProjectVersion: '1.0' # Fix this
cliProjectVersion: $(lidarrVersion)
cliSources: 'lidarrmetadata'
extraProperties: |
sonar.python.coverage.reportPath=$(System.DefaultWorkingDirectory)/coverage.xml
- script: python -m pip install --pre -U pypandoc tox
displayName: 'Install tools'
- script: tox -e $(toxEnv)

- script: tox -e py37
displayName: 'Run Tests'

- task: PublishTestResults@2
inputs:
testResultsFiles: '**/test-*.xml'
testRunTitle: '$(osName) - Python $(pythonVersion)'
testRunTitle: 'Linux - Python $(pythonVersion)'
condition: succeededOrFailed()

- publish: $(System.DefaultWorkingDirectory)/htmlcov
artifact: 'PyTestCoverageReport'
displayName: Publish PyTest Coverage Report
condition: and(succeededOrFailed(), eq(variables['osName'], 'Linux'))
condition: succeededOrFailed()

- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.xml'
reportDirectory: '$(System.DefaultWorkingDirectory)/**/htmlcov'
condition: and(succeededOrFailed(), eq(variables['osName'], 'Linux'))
condition: succeededOrFailed()

- task: SonarCloudAnalyze@1
condition: and(succeeded(), eq(variables['osName'], 'Linux'))
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)
tags: |
latest
$(Build.SourceBranchName)
- task: Docker@2
displayName: Push image
condition: and(succeeded(), eq(variables['system.pullrequest.isfork'], false))
inputs:
containerRegistry: 'dockerhub'
repository: $(imageName)
command: push
tags: |
latest
$(Build.SourceBranchName)
- bash: |
echo "Creating sentry release"
curl -sL https://sentry.io/get-cli/ | bash
sentry-cli releases new --finalize -p lidarr-metadata "${LIDARRVERSION}"
sentry-cli releases set-commits --auto "${LIDARRVERSION}"
sentry-cli releases deploys "${LIDARRVERSION}" new -e production
displayName: Create sentry release
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['system.pullrequest.isfork'], false))
env:
SENTRY_AUTH_TOKEN: $(sentryAuthTokenServarr)
SENTRY_ORG: $(sentryOrg)
SENTRY_URL: $(sentryUrl)
2 changes: 1 addition & 1 deletion lidarrmetadata/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.4.28'
__version__ = '10.0.0.0'
4 changes: 2 additions & 2 deletions lidarrmetadata/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,8 @@ class DefaultConfig(six.with_metaclass(ConfigMeta, ConfigBase)):

# Spotify app details
SPOTIFY_REDIRECT_URL = ''
SPOTIFY_ID = ''
SPOTIFY_SECRET = ''
SPOTIFY_ID = 'replaceme'
SPOTIFY_SECRET = 'replaceme'

# Whether or not running in production
PRODUCTION = False
Expand Down
4 changes: 2 additions & 2 deletions tests/provider_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ def test_title_from_url(self, url, expected):
assert expected == self.provider.wikipedia_title_from_url(url)

@pytest.mark.parametrize('url,expected', [
('http://en.wikipedia.org/wiki/Blink-182', u'Blink-182 (often stylized as blink-182'),
('http://en.wikipedia.org/wiki/Blink-182', u'Blink-182 (sometimes written as Blink 182;'),
('https://ja.wikipedia.org/wiki/%CE%9D_(%E3%83%90%E3%83%B3%E3%83%89)', u'\u03bd'),
('https://de.wikipedia.org/wiki/The_Boys#The_Mattless_Boys', 'The Boys are an English punk rock'),
('https://www.wikidata.org/wiki/Q953918', 'Mumford & Sons are a British folk-rock band formed in 2007'),
('https://www.wikidata.org/wiki/Q953918', 'Mumford & Sons are a British folk rock band formed in 2007'),
('https://www.wikidata.org/wiki/Q127939', 'Russian folk rock band'),
])
@pytest.mark.asyncio
Expand Down

0 comments on commit 402347d

Please sign in to comment.