-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
81 lines (76 loc) · 2.69 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
name: $(Date:yyyyMMdd).$(Rev:rr)
pool:
vmImage: ubuntu-latest
stages:
- stage: Test
jobs:
- job: Test
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.11'
- script: pip install --upgrade --upgrade-strategy eager --editable .[dev]
displayName: Install Application & Dependencies
- script: |
pytest --junitxml=junit/test-pytest-results.xml --cov-report=xml
displayName: Run Tests
continueOnError: true
- script: |
pytest --pylama -k 'pylama' --junit-xml=junit/test-pylama-results.xml -o addopts= tests/ grouper_python/
displayName: Run Linter Tests
continueOnError: true
- script: |
mypy --junit-xml junit/test-mypy-results.xml
displayName: Run MyPy Tests
continueOnError: true
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFiles: '**/test-*-results.xml'
failTaskOnFailedTests: true
- task: PublishCodeCoverageResults@1
condition: succeededOrFailed()
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.xml'
- stage: Build
jobs:
- job: Build
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.11'
- task: TwineAuthenticate@1
inputs:
artifactFeed: 'ITAC-API/pygrouper'
- ${{ if ne(variables['Build.SourceBranchName'], 'main') }}:
- task: PythonScript@0
inputs:
scriptSource: inline
script: |
with open('grouper_python/__init__.py', 'r+') as f:
content = f.read()
for line in content.splitlines():
if line.startswith('__version__'):
delim = '"' if '"' in line else "'"
version = line.split(delim)[1]
break
else:
raise RuntimeError("Unable to find version string.")
print(f"found {version}")
build_number = "$(Build.BuildNumber)".replace(".", "")
new_version = f"{version}b{build_number}"
print(f"new version: {new_version}")
content = content.replace(version, new_version)
f.seek(0)
f.write(content)
f.truncate()
displayName: Set prerelease Version
- script: |
pip install build twine
python -m build
cat $(PYPIRC_PATH)
twine upload -r pygrouper --config-file $(PYPIRC_PATH) dist/* --verbose
# pwd
# ls -l
# - publish: $(Pipeline.Workspace)/s/dist