-
Notifications
You must be signed in to change notification settings - Fork 5
/
azure-pipelines.yaml
145 lines (128 loc) · 4.14 KB
/
azure-pipelines.yaml
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
trigger:
tags:
include:
- v*
branches:
include:
- master
stages:
- stage: Build
jobs:
- job: Build
strategy:
matrix:
linux_py38_jlab3:
imageName: 'ubuntu-22.04'
python.version: '3.8'
jupyterlab.version: '3.6.5'
linux_py39_jlab3:
imageName: 'ubuntu-22.04'
python.version: '3.9'
jupyterlab.version: '3.6.5'
linux_py38_jlab4:
imageName: 'ubuntu-22.04'
python.version: '3.8'
jupyterlab.version: '4.0.3'
linux_py39_jlab4:
imageName: 'ubuntu-22.04'
python.version: '3.9'
jupyterlab.version: '4.0.3'
pool:
vmImage: $(imageName)
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
architecture: 'x64'
- script: python -m pip install --upgrade ipywidgets traitlets pytest build jupyter-packaging==0.10.6 jupyterlab==$(jupyterlab.version)
# pip installs release candidates by default:
# https://github.com/pypa/pip/issues/4969
displayName: 'Install dependencies'
- script: python -m pip install --upgrade black
displayName: 'Install black (linter)'
condition: eq(variables['python.version'], '3.8')
- script: black --check .
displayName: 'Test Formating'
condition: eq(variables['python.version'], '3.8')
- task: NodeTool@0
inputs:
versionSpec: '18.x'
- script: jlpm
displayName: 'Install labextension dependencies'
env:
NPM_TOKEN: $(NPM_TOKEN)
- script: jlpm run build:prod
displayName: 'Build jupyterlab extension'
env:
NPM_TOKEN: $(NPM_TOKEN)
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
architecture: 'x64'
# Build the python distribution from source
- script: python -m build
displayName: 'Build python'
condition: ne(variables['Agent.OS'], 'Windows_NT')
env:
NPM_TOKEN: $(NPM_TOKEN)
- bash: |
set -xeo pipefail
# Display log files if the build failed
echo "Dumping log files for failed build"
echo "----------------------------------"
for f in $(find $BUILD_REPOSITORY_LOCALPATH/build -name *.log);
do echo "------"
echo $f
echo "======"
cat $f
done;
condition: failed() # only run this job if the build step failed
displayName: "Print log files (failed build only)"
- stage: Deploy
dependsOn: Build
condition: and(succeeded('Build'), startsWith(variables['Build.SourceBranch'], 'refs/tag'))
jobs:
- job: Deploy_package
pool:
vmImage: 'ubuntu-22.04'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.8'
architecture: 'x64'
- script: 'pip install twine build setuptools setuptools_scm jupyter-packaging==0.10.6 jupyterlab==3.6.5'
displayName: 'Install twine/build'
- task: NodeTool@0
inputs:
versionSpec: '18.x'
- script: |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
jlpm
displayName: 'Save npm token & install labextension dependencies'
env:
NPM_TOKEN: $(NPM_TOKEN)
- script: |
latestGitTag=$(git describe --tags --abbrev=0)
latestGitTag="${latestGitTag:1}"
npm version $latestGitTag --no-commit-hooks --no-git-tag-version
displayName: 'Update package.json version'
- script: jlpm run build:prod
displayName: 'Build jupyterlab extension'
env:
NPM_TOKEN: $(NPM_TOKEN)
# Build the python distribution from source
- script: python -m build
displayName: 'Build python'
env:
NPM_TOKEN: $(NPM_TOKEN)
- task: TwineAuthenticate@1
displayName: 'Twine Authenticate'
inputs:
pythonUploadServiceConnection: 'pypi-upload'
- script: python -m twine upload -r "pypi-upload" --config-file $(PYPIRC_PATH) dist/*.whl
displayName: 'Release to Pypi'
- script: ./scripts/publish.sh
env:
GITHUB_TOKEN: $(GITHUB_TOKEN)
NPM_TOKEN: $(NPM_TOKEN)
displayName: 'Release to npm'