/
package-installation-step-template.yml
96 lines (82 loc) · 2.93 KB
/
package-installation-step-template.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
# Install interpret-community in some way
# Beyond 'None', the options are:
# PipLocal -> pip install .
# WheelArtifact -> Get a .whl file from a Pipeline Artifact
# PyPI -> Get a version from a Pipeline Artifact and install from PyPI
parameters:
- name: installationType
type: string
values:
- None
- PipLocal
- PyPI
- WheelArtifact
- name: packageOptions
type: string
values:
- " "
- '[visualization]'
default: " "
- name: pypiUrl
type: string
- name: versionArtifactName
type: string
- name: versionArtifactFile
type: string
- name: pipVersionVariable
type: string
default: pipVersionVar
- name: wheelArtifactName
type: string
- name: condaEnv
type: string
steps:
# ==============================================================
# Install PipLocal
- ${{ if eq(parameters.installationType, 'PipLocal') }}:
- bash: |
source activate ${{parameters.condaEnv}}
pip install -e ${{ format( './python{0}', parameters.packageOptions )}}
displayName: "Local install of interpret-community with pip"
# ===============================================================
# Install from a wheel package or from PyPI
- ${{ if in(parameters.installationType, 'PyPI', 'WheelArtifact') }}:
# Clear out the checked out code
- task: DeleteFiles@1
inputs:
contents: |
python
- script: ls -p
displayName: "List after deletion"
# Install from PyPI
- ${{ if eq(parameters.installationType, 'PyPI') }}:
- task: DownloadPipelineArtifact@2
displayName: "Download version Artifact ${{parameters.versionArtifactName}}"
inputs:
artifact: ${{parameters.versionArtifactName}}
path: $(Build.SourcesDirectory)
- script: ls -p $(Build.SourcesDirectory)
displayName: "Show sources directory"
- task: PowerShell@2
displayName: 'Read version Artifact and set pipeline variable from file contents'
inputs:
filePath: tools/set-variable-from-file.ps1
arguments: "-baseDir $(Build.SourcesDirectory) -subDir . -fileName ${{parameters.versionArtifactFile}} -targetVariable ${{parameters.pipVersionVariable}}"
pwsh: true
- bash: |
source activate ${{parameters.condaEnv}}
pip install --index-url ${{parameters.pypiUrl}} interpret-community==$(${{parameters.pipVersionVariable}})
displayName: "Install interpret-community with pip"
# Install from Wheel Artifact
- ${{ if eq(parameters.InstallationType, 'WheelArtifact') }}:
- task: DownloadPipelineArtifact@2
displayName: "Download wheel Artifact ${{parameters.wheelArtifactName}}"
inputs:
artifact: ${{parameters.wheelArtifactName}}
path: $(Build.SourcesDirectory)
- script: ls -p $(Build.SourcesDirectory)
displayName: "Show sources directory"
- bash: |
source activate ${{parameters.condaEnv}}
pip install interpret_community*.whl
displayName: "Install interpret-community with pip from local file"