-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathazure-pipelines.yml
153 lines (133 loc) · 4.91 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
trigger:
branches:
include:
- '*'
pr:
- master
strategy:
matrix:
linux-ubuntu-16-04:
imageName: 'ubuntu-16.04'
macOS:
imageName: 'macOS-10.14'
windows-64bit:
imageName: 'vs2017-win2016'
platform: x64
winArch: 'win64'
windows-32bit:
imageName: 'vs2017-win2016'
platform: x86
winArch: 'win32'
pool:
vmImage: $(imageName)
steps:
# Set python version - 64bit python 3.6
- task: UsePythonVersion@0
inputs:
versionSpec: '3.6'
condition: not(and(eq( variables['Agent.OS'], 'Windows_NT'), eq( variables['platform'], 'x86')))
# Set python version - 32bit python 3.6
- task: UsePythonVersion@0
inputs:
versionSpec: '3.6'
architecture: x86
condition: and(eq( variables['Agent.OS'], 'Windows_NT'), eq( variables['platform'], 'x86'))
- script: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install -r requirements.txt
python -m pip install pytest-azurepipelines
displayName: 'Install python dependencies'
- script: |
python -m pre_commit run --all-files
displayName: 'black, flake8 and bandit checks'
- script: |
python -m pytest tests/ --cov textx_ls_core --cov-report html
workingDirectory: textX-LS/core
displayName: 'Run textX-LS-core tests'
- script: |
python -m pytest tests/ --cov textx_ls_server --cov-report html
workingDirectory: textX-LS/server
displayName: 'Run textX-LS-server tests'
- task: NodeTool@0
inputs:
versionSpec: '10.16.3'
- task: Npm@1
displayName: 'Install node modules'
inputs:
workingDir: client
verbose: false
- bash: './node_modules/.bin/tslint src\*.ts'
workingDirectory: client
displayName: '[textX-vscode] tslint'
continueOnError: true
- bash: 'exit 1'
displayName: 'Fail if one of the steps succeeded with issues '
condition: in(variables['Agent.JobStatus'], 'SucceededWithIssues', 'Failed')
################################ BUILD VSIX ###################################
- bash: |
# Append build id to versions
get_setuppy_version() {
version=$(grep -o "'\d.\d.\d'" $1)
echo "${version//\'}"
}
replace_setuppy_version() {
version=$(get_setuppy_version $1)
build_version=$version+$2
sed -i "" "s|$version|$build_version|g" $1
}
replace_packagejson_version() {
version_line=$(grep -o '"version".*' $1)
version=$(python -m json.tool package.json | awk -F'"' '/version/{print $4}')
build_version=$version+$2
build_version_line=${version_line/$version/$build_version}
sed -i "" "s|$version_line|$build_version_line|g" $1
}
build_suffix=${BUILD_SOURCEVERSION:0:8}
replace_setuppy_version ./textX-LS/core/setup.py $build_suffix
replace_setuppy_version ./textX-LS/server/setup.py $build_suffix
cd client
replace_packagejson_version package.json $build_suffix
displayName: 'Change versions (except for master branch and tags)'
condition: and(eq(variables['Agent.OS'], 'Darwin'), and(ne(variables['Build.SourceBranch'], 'refs/heads/master'), ne(startsWith(variables['Build.SourceBranch'], 'refs/tags/'), True)))
- bash: |
# Build .vsix file
./node_modules/.bin/vsce package
# Create output env vars
this_folder=$(dirname "$(pwd)")
TEXTX_LS_CORE_ARTIFACT_NAME=$(ls ./wheels | grep core)
TEXTX_LS_SERVER_ARTIFACT_NAME=$(ls ./wheels | grep server)
TEXTX_LS_VSCODE_ARTIFACT_NAME=$(ls | grep vsix)
# Create output variables
echo "##vso[task.setvariable variable=TEXTX_LS_CORE_ARTIFACT_NAME]$TEXTX_LS_CORE_ARTIFACT_NAME"
echo "##vso[task.setvariable variable=TEXTX_LS_SERVER_ARTIFACT_NAME]$TEXTX_LS_SERVER_ARTIFACT_NAME"
echo "##vso[task.setvariable variable=TEXTX_LS_VSCODE_ARTIFACT_NAME]$TEXTX_LS_VSCODE_ARTIFACT_NAME"
workingDirectory: client
displayName: 'Create wheels and extension file'
condition: eq(variables['Agent.OS'], 'Darwin')
- task: CopyFiles@2
displayName: 'Copy wheels and vsix to artifact staging dir'
inputs:
SourceFolder: client
Contents: |
wheels/*.whl
*.vsix
TargetFolder: '$(build.artifactstagingdirectory)'
condition: eq(variables['Agent.OS'], 'Darwin')
- task: PublishBuildArtifacts@1
displayName: '[textX-LS-core] Publish Artifact'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)/wheels/$(TEXTX_LS_CORE_ARTIFACT_NAME)'
ArtifactName: '$(TEXTX_LS_CORE_ARTIFACT_NAME)'
condition: eq(variables['Agent.OS'], 'Darwin')
- task: PublishBuildArtifacts@1
displayName: '[textX-LS-server] Publish Artifact'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)/wheels/$(TEXTX_LS_SERVER_ARTIFACT_NAME)'
ArtifactName: '$(TEXTX_LS_SERVER_ARTIFACT_NAME)'
condition: eq(variables['Agent.OS'], 'Darwin')
- task: PublishBuildArtifacts@1
displayName: '[textX-vscode] Publish Artifact'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)/$(TEXTX_LS_VSCODE_ARTIFACT_NAME)'
ArtifactName: '$(TEXTX_LS_VSCODE_ARTIFACT_NAME)'
condition: eq(variables['Agent.OS'], 'Darwin')