-
Notifications
You must be signed in to change notification settings - Fork 1
/
azure-pipelines.yml
250 lines (237 loc) · 8.86 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
trigger:
- main
schedules:
- cron: '0,15,30,45 * * * *'
branches:
include:
- main
always: true
stages:
- stage: prepare
jobs:
- job: prepare
pool:
vmImage: 'ubuntu-latest'
steps:
- checkout: self
fetchDepth: 1
- bash: |
set -xeuo pipefail
tag="$(
git ls-remote --tags https://github.com/bioconda/bioconda-repodata-archive | \
grep -oE '2\.[0-9]+\.[0-9]+\.[0-9]{4}\.[0-9]{2}\.[0-9]{2}\.[0-9]{2}\.[0-9]{2}\.[0-9]{2}$' | \
tail -n1
)"
echo "##vso[task.setvariable variable=REPODATA;isOutput=true]${tag}"
name: select_repodata_archive
- bash: |
set -xeuo pipefail
pip install ntplib
PYTHONPATH="$( pwd )/src" \
python -m bioconda_tests.select_packages \
--num-packages=10 \
--output-dir='$(Pipeline.Workspace)/selected_packages'
name: select_packages
- task: InstallSSHKey@0
inputs:
knownHostsEntry: github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==
sshPublicKey: $(BiocondaBot_deploy_bioconda_tests)
sshKeySecureFile: BiocondaBot-deploy-bioconda-tests
name: install_deploy_key
- bash: |
set -xeuo pipefail
ntp_time="$(
PYTHONPATH=$(pwd)/src \
python -m bioconda_tests.ntp_time
)"
git fetch --depth=1 origin main
git checkout main
git reset --hard FETCH_HEAD
results_dir=./status
mkdir -p "${results_dir}"
cat '$(Pipeline.Workspace)/selected_packages/'*.txt \
| sort -u \
| while read package ; do
mkdir -p "${results_dir}/${package}"
printf '{"state":"running","started_at":"'"${ntp_time}"'"}' \
> "${results_dir}/${package}/status.json"
git add "${results_dir}/${package}/status.json"
done
git config --global user.email "[email protected]"
git config --global user.name "BiocondaBot"
git commit -m \
"Set state=running at ${ntp_time} ***NO_CI***
repodata archive: $(select_repodata_archive.REPODATA)
packages:
$( cat '$(Pipeline.Workspace)/selected_packages/'*.txt | sort -u )
"
echo "##vso[task.setvariable variable=NTP_TIME;isOutput=true]${ntp_time}"
name: mark_as_running
- bash: |
git remote get-url origin \
| sed \
-e 's|^https://github.com|[email protected]:|' \
-e 's|$|.git|' \
| xargs git remote set-url origin
git push
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
name: push_marks
- publish: $(Pipeline.Workspace)/selected_packages
artifact: selected_packages
- stage: test
dependsOn: prepare
variables:
REPODATA: $[ stageDependencies.prepare.prepare.outputs['select_repodata_archive.REPODATA'] ]
MICROMAMBA_VERSION: 0.15.2
jobs:
- job: linux
pool:
vmImage: 'ubuntu-latest'
steps:
- checkout: self
fetchDepth: 1
- bash: |
set -xeuo pipefail
SUBDIR=linux-64 REPODATA="$(REPODATA)" bash src/setup-conda.sh
. "${HOME}/conda/etc/profile.d/conda.sh"
conda activate base
conda info -a
conda config --show-sources
name: setup_conda
- download: current
artifact: selected_packages
name: download_selected_packages
- bash: |
set -xeuo pipefail
. "${HOME}/conda/etc/profile.d/conda.sh"
conda activate base
PYTHONPATH=$(pwd)/src \
python -m bioconda_tests.test_packages \
--workspace='$(Pipeline.Workspace)' \
--subdir=linux-64 \
--subdir=noarch
name: test_packages
- publish: $(Pipeline.Workspace)/linux-64
artifact: linux-64
- job: macos
pool:
vmImage: 'macOS-latest'
steps:
- checkout: self
fetchDepth: 1
- bash: |
set -xeuo pipefail
SUBDIR=osx-64 REPODATA="$(REPODATA)" bash src/setup-conda.sh
. "${HOME}/conda/etc/profile.d/conda.sh"
conda activate base
conda info -a
conda config --show-sources
name: setup_conda
- download: current
artifact: selected_packages
name: download_selected_packages
- bash: |
set -xeuo pipefail
. "${HOME}/conda/etc/profile.d/conda.sh"
conda activate base
PYTHONPATH=$(pwd)/src \
python -m bioconda_tests.test_packages \
--workspace='$(Pipeline.Workspace)' \
--subdir=osx-64 \
--subdir=noarch
name: test_packages
- publish: $(Pipeline.Workspace)/osx-64
artifact: osx-64
# - job: windows
# pool:
# vmImage: 'windows-latest'
# bash:
# - script: |
# ...
# name: ...
- stage: gather
dependsOn:
- prepare
- test
variables:
REPODATA: $[ stageDependencies.prepare.prepare.outputs['select_repodata_archive.REPODATA'] ]
NTP_TIME: $[ stageDependencies.prepare.prepare.outputs['mark_as_running.NTP_TIME'] ]
condition: succeededOrFailed()
jobs:
- job: gather
pool:
vmImage: 'ubuntu-latest'
steps:
- checkout: self
fetchDepth: 1
- download: current
- task: InstallSSHKey@0
inputs:
knownHostsEntry: github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==
sshPublicKey: $(BiocondaBot_deploy_bioconda_tests)
sshKeySecureFile: BiocondaBot-deploy-bioconda-tests
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
name: install_deploy_key
- bash: |
set -xeuo pipefail
git fetch --depth=1 origin main
git checkout main
git reset --hard FETCH_HEAD
results_dir=./status
cat '$(Pipeline.Workspace)/selected_packages/'*.txt \
| sort -u \
| while read package ; do
package_results_dir="${results_dir}/${package}"
if [ -d "${package_results_dir}" ] ; then
find "${package_results_dir}" -mindepth 1 -maxdepth 1 -type f \! -name 'status.json' -exec git rm {} +
fi
mkdir -p "${package_results_dir}"
for subdir in linux-64 osx-64 ; do
platform_workspace_dir='$(Pipeline.Workspace)/'"${subdir}/${package}"
if [ -f "${platform_workspace_dir}/status.json" ] ; then
python -c '
import json, pathlib, sys
status_path = pathlib.Path(sys.argv[1])
if status_path.is_file():
with status_path.open() as status_file:
status = json.load(status_file)
else:
status = {}
status["state"] = "completed"
if "status" not in status:
status["status"] = []
with pathlib.Path(sys.argv[2]).open() as platform_status_file:
status["status"].append(json.load(platform_status_file))
with status_path.open("w") as status_file:
json.dump(status, status_file, indent=1, sort_keys=True)
' "${package_results_dir}/status.json" "${platform_workspace_dir}/status.json"
for file in "${platform_workspace_dir}/"* ; do
filename="${file##*/}"
if ! [ "${filename}" = 'status.json' ] ; then
dest="${package_results_dir}/${subdir}-${filename}"
cp -f "${file}" "${dest}"
git add -- "${dest}"
fi
done
fi
done
git add "${package_results_dir}/status.json"
done
git config --global user.email "[email protected]"
git config --global user.name "BiocondaBot"
git commit -m \
"Commit status for $(NTP_TIME) ***NO_CI***
repodata archive: $(select_repodata_archive.REPODATA)
packages:
$( cat '$(Pipeline.Workspace)/selected_packages/'*.txt | sort -u )
"
name: gather_results
- bash: |
git remote get-url origin \
| sed \
-e 's|^https://github.com|[email protected]:|' \
-e 's|$|.git|' \
| xargs git remote set-url origin
git push
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
name: push_results