-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathazure-pipelines.yml
103 lines (89 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# Python package
# Create and test a Python package on multiple Python versions.
# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/python
trigger:
branches:
include:
- 'master'
tags:
include:
- '*'
jobs:
- job: Test
pool:
vmImage: 'ubuntu-latest'
strategy:
matrix:
Python39-spark32:
python.version: '3.9'
TOXENV: py39-spark32
Python39-spark33:
python.version: '3.9'
TOXENV: py39-spark33
Python310-spark35:
python.version: '3.10'
TOXENV: py310-spark35
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
displayName: 'Use Python $(python.version)'
- script: |
python -m pip install --upgrade pip poetry tox
poetry install
displayName: 'Install dependencies'
- script: |
poetry run flake8
displayName: 'Check flake8'
- script: |
poetry run isort --check --diff .
displayName: 'Check isort'
- script: |
poetry run black --check --fast .
displayName: 'Check black'
- script: |
docker-compose up -d
tox
displayName: 'Test the code'
- script: |
poetry run coverage xml
displayName: 'Generate coverage xml file'
- script: |
export SONAR_SCANNER_VERSION=5.0.1.3006
export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux
curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip
unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
export PATH=$SONAR_SCANNER_HOME/bin:$PATH
export SONAR_SCANNER_OPTS="-server"
sonar-scanner \
-Dsonar.organization=ailab \
-Dsonar.projectKey=GETL \
-Dsonar.sources=. \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.login=$(SONAR_TOKEN) \
-Dsonar.python.version=3
displayName: 'Sonar scanner'
- job: Publish
dependsOn: Test
condition: "and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))"
pool:
vmImage: 'ubuntu-latest'
strategy:
matrix:
Python310:
python.version: '3.10'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
displayName: 'Use Python $(python.version)'
- script: |
python -m pip install --upgrade pip poetry
poetry install
displayName: 'Install dependencies'
- script: |
poetry config pypi-token.pypi $(PYPI_TOKEN)
poetry build
poetry publish
displayName: 'Publish to pypi'