generated from datalad/datalad-extension-template
-
Notifications
You must be signed in to change notification settings - Fork 10
/
.appveyor.yml
445 lines (411 loc) · 17.5 KB
/
.appveyor.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
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
# This CI setup provides a largely homogeneous configuration across all
# major platforms (Windows, MacOS, and Linux). The aim of this test setup is
# to create a "native" platform experience, using as few cross-platform
# helper tools as possible.
#
# On all platforms `hatch` is used for testing, and managing the test
# environment. This yields a near-identical environment/behavior across
# platforms and Python versions. The main difference between running tests
# on Appveyor and locally should be the service setup (e.g., SSH, HTTPBIN).
#
# All workers support remote login. Login details are shown at the top of each
# CI run log.
#
# - Linux/Mac workers (via SSH):
#
# - A permitted SSH key must be defined in an APPVEYOR_SSH_KEY environment
# variable (via the appveyor project settings)
#
# - SSH login info is given in the form of: 'appveyor@67.225.164.xx -p 22xxx'
#
# - Login with:
#
# ssh -o StrictHostKeyChecking=no <LOGIN>
#
# - to prevent the CI run from exiting, `touch` a file named `BLOCK` in the
# user HOME directory (current directory directly after login). The session
# will run until the file is removed (or 60 min have passed)
#
# - Windows workers (via RDP):
#
# - An RDP password should be defined in an APPVEYOR_RDP_PASSWORD environment
# variable (via the appveyor project settings), or a random password is used
# every time
#
# - RDP login info is given in the form of IP:PORT
#
# - Login with:
#
# xfreerdp /cert:ignore /dynamic-resolution /u:appveyor /p:<PASSWORD> /v:<LOGIN>
#
# - to prevent the CI run from exiting, create a textfile named `BLOCK` on the
# Desktop (a required .txt extension will be added automatically). The session
# will run until the file is removed (or 60 min have passed)
#
# do not make repository clone cheap: interfers with VCS-based version determination
shallow_clone: false
# turn of support for MS project build support (not needed)
build: off
environment:
# unless indicated otherwise, we test datalad_next
DTS: datalad_next
# place coverage files to a known location regardless of where a test run
# is happening
COVERAGE_ROOT: /home/appveyor/DLTMP
# we pin hatch's data file to make it easy to cache it
HATCH_DATA_DIR: /home/appveyor/hatch-data-dir
# same for pip
PIP_CACHE: /home/appveyor/.cache/pip
# SSH testing is done via a side-loaded container that provides a POSIX/SSHable
# server environment
DATALAD_TESTS_DOCKER_SSHD_SECKEY_DOWNLOADURL: https://ci.appveyor.com/api/projects/mih/datalad-ci-docker-containers/artifacts/recipes/sshd/id_rsa?job=sshd
DATALAD_TESTS_DOCKER_SSHD_DOWNLOADURL: https://ci.appveyor.com/api/projects/mih/datalad-ci-docker-containers/artifacts/sshd.dockerimg.gz?job=sshd
DATALAD_TESTS_DOCKER_SSHD_CONTAINER_NAME: test-sshd
# std SSH container runtime setup
DATALAD_TESTS_SERVER_SSH_HOST: datalad-test-sshd
DATALAD_TESTS_SERVER_SSH_PORT: 2222
DATALAD_TESTS_SERVER_SSH_LOGIN: sshuser
DATALAD_TESTS_SERVER_SSH_SECKEY: /home/appveyor/.ssh/datalad_tests_id_rsa
DATALAD_TESTS_SERVER_SSH_PATH: /usr/local/apache2/htdocs
DATALAD_TESTS_SERVER_LOCALPATH: /home/appveyor/DLTMP/sshdroot
# Do not use `image` as a matrix dimension, to have fine-grained control over
# what tests run on which platform
# The ID variable had no impact, but sorts first in the CI run overview
# an intelligible name can help to locate a specific test run
matrix:
# List a CI run for each platform first, to have immediate access when there
# is a need for debugging
# Ubuntu core tests
- job_name: test-linux
APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2204
PY: 3.9
# datalad-annex git remote needs something after git-annex_8.20211x
INSTALL_GITANNEX: git-annex -m snapshot
# 'test_publish_target_url' relies on a strict `localhost` target
# setup, we don't have that
KEYWORDS: >
not test_publish_target_url
and not test_initremote_basic_sshurl
and not test_version_check_ssh
and not test_remote_layout_ssh
and not test_setup_ds_in_store_ssh
and not test_obtain_permission_ssh
DEPLOY_HTTPBIN_IMAGE: yes
INSTALL_SYSPKGS:
DATALAD_TESTS_SSH: 1
# same as 'test-linux', but TMPDIR is on a crippled filesystem, causing
# most, if not all test datasets to be created on that filesystem
- job_name: test-linux-crippled
APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2204
PY: 3.9
# datalad-annex git remote needs something after git-annex_8.20211x
INSTALL_GITANNEX: git-annex -m snapshot
DEPLOY_HTTPBIN_IMAGE: yes
INSTALL_SYSPKGS:
DATALAD_TESTS_SSH: 1
KEYWORDS: >
not test_initremote_basic_sshurl
and not test_version_check_ssh
and not test_remote_layout_ssh
and not test_setup_ds_in_store_ssh
# Windows core tests
- job_name: test-win
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
# Python version specification is non-standard on windows
PY: 3.12
INSTALL_GITANNEX: git-annex -m datalad/packages
DATALAD_TESTS_SSH: 1
DATALAD_TESTS_SERVER_SSH_SECKEY: C:\DLTMP\datalad_tests_id_rsa
DATALAD_TESTS_SERVER_LOCALPATH: C:\DLTMP\sshdroot
COVERAGE_ROOT: C:\DLTMP
HATCH_DATA_DIR: C:\hatch-data-dir
PIP_CACHE: C:\Users\appveyor\AppData\Local\pip\Cache
KEYWORDS: >
not test_initremote_basic_sshurl
and not test_version_check_ssh
and not test_setup_ds_in_store_ssh
# MacOS core tests
- job_name: test-mac
APPVEYOR_BUILD_WORKER_IMAGE: macos-sonoma
PY: 3.12
INSTALL_GITANNEX: git-annex
DATALAD_LOCATIONS_SOCKETS: /Users/appveyor/DLTMP/sockets
DATALAD_TESTS_SSH: 1
# no docker on Mac, we log into self
# 'test_publish_target_url' relies git-annex being installed on the
# target, but we only have that in a personal env
KEYWORDS: >
not test_publish_target_url
and not test_initremote_basic_sshurl
and not test_version_check_ssh
and not test_remote_layout_ssh
and not test_setup_ds_in_store_ssh
DATALAD_TESTS_SERVER_SSH_HOST: localhost
DATALAD_TESTS_SERVER_SSH_PORT: 22
DATALAD_TESTS_SERVER_SSH_LOGIN: appveyor
DATALAD_TESTS_SERVER_SSH_SECKEY: /Users/appveyor/.ssh/datalad_tests_id_rsa
DATALAD_TESTS_SERVER_SSH_PATH: /Users/appveyor/DLTMP/riaroot
DATALAD_TESTS_SERVER_LOCALPATH: /Users/appveyor/DLTMP/riaroot
COVERAGE_ROOT: /Users/appveyor/DLTMP
HATCH_DATA_DIR: /Users/appveyor/hatch-data-dir
PIP_CACHE: /Users/appveyor/.cache/pip
# run a subset of the core tests on the oldest supported Python version
- job_name: datalad-core-1
DTS: >
datalad.cli
datalad.core
# do not run tests that ensure behavior we intentionally changed
# - test_gh1811: is included in next in an alternative implementation
# - test_librarymode: assumes that CLI config overrides end up in the
# session `datalad.cfg.overrides`, but -next changes that behavior
# to have `.overrides` be uniformly limited to instance overrides
KEYWORDS: >
not test_gh1811
and not test_librarymode
and not test_basics
APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004
PY: 3.9
INSTALL_SYSPKGS:
# datalad-annex git remote needs something after git-annex_8.20211x
INSTALL_GITANNEX: git-annex -m snapshot
- job_name: datalad-core-2
DTS: >
datalad.customremotes
datalad.dataset
datalad.distributed
datalad.downloaders
datalad.interface
# do not run tests that ensure behavior we intentionally changed
# - test_gh1811: is included in next in an alternative implementation
# - test_fake_gitlab: we have an updated variant in next
# - test_dryrun: we have an updated variant in next; what is disabled is
# the one in test_create_sibling_gitlab.py. However, there is one with
# identical name in test_create_sibling_ghlike.py, now also disabled
# because MIH does not know better
KEYWORDS: >
not test_gh1811
and not test_nested_pushclone_cycle_allplatforms
and not test_fake_gitlab
and not test_dryrun
and not test_initremote
and not test_push_url
and not test_read_access
and not test_ria_postclone_noannex
and not test_version_check_ssh
and not test_version_check
and not test_obtain_permission_ssh
and not test_obtain_permission_root
and not test_remote_layout
and not test_remote_layout_ssh
and not test_setup_store
and not test_setup_ds_in_store
and not test_initremote_basic_fileurl
and not test_initremote_basic_httpurl
and not test_initremote_basic_httpsurl
and not test_initremote_basic_sshurl
and not test_gitannex_local
and not test_gitannex_ssh
and not test_ria_postclonecfg
APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004
PY: 3.9
INSTALL_SYSPKGS:
# datalad-annex git remote needs something after git-annex_8.20211x
INSTALL_GITANNEX: git-annex -m snapshot
- job_name: datalad-core-3
DTS: >
datalad.distribution
KEYWORDS: not test_invalid_args
APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004
PY: 3.9
INSTALL_SYSPKGS:
# datalad-annex git remote needs something after git-annex_8.20211x
INSTALL_GITANNEX: git-annex -m snapshot
- job_name: datalad-core-4
DTS: >
datalad.local
APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004
PY: 3.9
INSTALL_SYSPKGS:
# datalad-annex git remote needs something after git-annex_8.20211x
INSTALL_GITANNEX: git-annex -m snapshot
KEYWORDS: >
not test_addurls_from_list
and not test_addurls_url_on_collision_error_if_different
and not test_addurls_url_on_collision_choose
- job_name: datalad-core-5
DTS: >
datalad.runner
datalad.support
datalad.tests
datalad.ui
APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004
PY: 3.9
INSTALL_SYSPKGS:
# datalad-annex git remote needs something after git-annex_8.20211x
INSTALL_GITANNEX: git-annex -m snapshot
# only run the CI if there are code or tooling changes
only_commits:
files:
- .appveyor.yml
- datalad_next/
- tools/
# tests need specific hostnames to be available
# note, this is insufficient on MacOS, and needs to be reflected
# in the SSH config too
hosts:
datalad-test-sshd: 127.0.0.1
# same, but for datalad-core implementations
datalad-test: 127.0.0.1
# job-specific configurations
for:
#
# POSIX TEST RUNS
#
- matrix:
only:
- job_name: test-linux
- job_name: test-linux-crippled
- job_name: test-mac
- job_name: datalad-core-1
- job_name: datalad-core-2
- job_name: datalad-core-3
- job_name: datalad-core-4
- job_name: datalad-core-5
cache:
# pip cache
- "${PIP_CACHE} -> .appveyor.yml"
# hatch-managed python versions
- "${HATCH_DATA_DIR}/env/virtual/.pythons -> pyproject.toml"
# cache the docker image for httpbin. in 2023 it has not changed in
# 4 years, not worth pulling each time
# given the low change frequency we also do not invalidate the cache
# but would do manually, if needed
- /home/appveyor/cache/httpbin.dockerimg
# init cannot use any components from the repo, because it runs prior to
# cloning it
init:
# enable external SSH access to CI worker
# needs APPVEYOR_SSH_KEY defined in project settings (or environment)
- curl -sflL 'https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-ssh.sh' | bash -e -
# Scratch space
# we place the "unix" one into the user's HOME to avoid git-annex issues on MacOSX
# gh-5291
- mkdir ~/DLTMP && export TMPDIR=~/DLTMP
# establish a root directory for SSH tests
- "mkdir ${DATALAD_TESTS_SERVER_LOCALPATH}"
install:
# verify that a PY variable is declared that identifies the desired Python version
# for this run
- "[ \"x$PY\" != x ]"
# Missing system software
- tools/appveyor/install-syspkgs $INSTALL_SYSPKGS
# activate Python env solely to get `python` to become available consistently
# hatch will manage the actual testing environment
- '. ${HOME}/venv${PY}/bin/activate'
- tools/appveyor/install-git-annex ${INSTALL_GITANNEX}
# enable the git-annex provisioned by the installer
- "[ -f ${HOME}/dlinstaller_env.sh ] && . ${HOME}/dlinstaller_env.sh || true"
# HTTPBIN
- "[ -n \"$DEPLOY_HTTPBIN_IMAGE\" ] && tools/appveyor/docker-load-httpbin || true"
before_test:
- "[ \"$DATALAD_TESTS_SSH\" = 1 ] && tools/appveyor/setup-sshd || true"
- "[ \"$DATALAD_TESTS_SSH\" = 1 ] && tools/appveyor/verify-ssh-access || true"
- 'hatch run tests.py${PY}:datalad wtf'
test_script:
# store original TMPDIR setting to limit modification to test execution
- export PREV_TMPDIR=$TMPDIR
# make TMPDIR a "crippled filesystem" to test wrong assumptions of POSIX-ness
# on POSIX OSes. The test fixtures will create all test datasets under TMPDIR
- |
set -e
if [ "$APPVEYOR_JOB_NAME" = "test-linux-crippled" ]; then
# 750 MB VFAT FS in a box
sudo dd if=/dev/zero of=/crippledfs.img count=750 bs=1M
sudo mkfs.vfat /crippledfs.img
sudo mkdir /crippledfs
sudo mount -o "uid=$(id -u),gid=$(id -g)" /crippledfs.img /crippledfs
echo "== mount >>"
mount | grep crippled
echo "<< mount =="
export TMPDIR=/crippledfs
fi
- echo TMPDIR=$TMPDIR
# not ready for doctests yet, some are invalid
# 'hatch run tests.py${PY}:run-cov --doctest-modules --durations 20 -m "not (turtle)" -k "$KEYWORDS" --pyargs ${DTS}'
- 'hatch run tests.py${PY}:run-cov --reruns 5 --reruns-delay 5 --durations 20 -m "not (turtle)" -k "$KEYWORDS" --pyargs ${DTS}'
after_test:
- 'hatch run tests.py${PY}:cov-combine'
- 'hatch run tests.py${PY}:coverage xml'
- 'codecovcli --auto-load-params-from AppVeyor upload-process -n "appveyor-$APPVEYOR_JOB_NAME" --disable-search -f coverage.xml'
on_finish:
# conditionally block the exit of a CI run for direct debugging
- while [ -f ~/BLOCK ]; do sleep 5; done
#
# WINDOWS TEST RUNS
#
- matrix:
only:
- job_name: test-win
cache:
# pip cache
- "%PIP_CACHE% -> .appveyor.yml"
# hatch-managed python versions
- "%HATCH_DATA_DIR%\\env\\virtual\\.pythons -> pyproject.toml"
# init cannot use any components from the repo, because it runs prior to
# cloning it
init:
# remove windows 260-char limit on path names
- ps: Set-Itemproperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name LongPathsEnabled -value 1
# enable developer mode on windows
# this should enable mklink without admin privileges, but it doesn't seem to work
#- ps: tools\ci\appveyor_enable_windevmode.ps1
# enable RDP access on windows (RDP password is in appveyor project config)
# this is relatively expensive (1-2min), but very convenient to jump into any build at any time
- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# Scratch space
- cmd: md C:\DLTMP
# and use that scratch space to get short paths in test repos
# (avoiding length-limits as much as possible)
- cmd: "set TMP=C:\\DLTMP"
- cmd: "set TEMP=C:\\DLTMP"
# establish a root directory for SSH tests
- cmd: "md %DATALAD_TESTS_SERVER_LOCALPATH%"
install:
# place a debug setup helper at a convenient location
- cmd: copy tools\appveyor\env_setup.bat C:\\datalad_debug.bat
- cmd: "set PATH=C:\\Python%PY%;C:\\Python%PY%\\Scripts;%PATH%"
# deploy the datalad installer, override version via DATALAD_INSTALLER_VERSION
- cmd:
IF DEFINED DATALAD_INSTALLER_VERSION (
python -m pip install "datalad-installer%DATALAD_INSTALLER_VERSION%"
) ELSE (
python -m pip install datalad-installer
)
# Install git-annex on windows, otherwise INSTALL_SYSPKGS can be used
# deploy git-annex, if desired
- cmd: IF DEFINED INSTALL_GITANNEX datalad-installer --sudo ok %INSTALL_GITANNEX%
before_test:
- tools\appveyor\setup-sshd
- tools\appveyor\verify-ssh-access
- cmd: 'hatch run tests.py%PY%:datalad wtf'
test_script:
# run test selection
# not ready for doctests yet, some are invalid
# 'hatch run tests.py%PY%:run-cov --doctest-modules --durations 20 -m "not (turtle)" -k "%KEYWORD%" --pyargs %DTS%'
- cmd: 'hatch run tests.py%PY%:run-cov --reruns 5 --reruns-delay 5 --durations 20 -m "not (turtle)" -k "%KEYWORDS%" --pyargs %DTS%'
after_test:
- cmd: 'hatch run tests.py%PY%:cov-combine'
- cmd: 'hatch run tests.py%PY%:coverage xml'
- cmd: 'codecovcli --auto-load-params-from AppVeyor upload-process -n "appveyor-%APPVEYOR_JOB_NAME%" --disable-search -f coverage.xml'
on_finish:
# conditionally block the exit of a CI run for direct debugging
- ps: while ((Test-Path "C:\Users\\appveyor\\Desktop\\BLOCK.txt")) { Start-Sleep 5 }
#
# ALL TEST RUNS
#
build_script:
- python -m pip install hatch codecov-cli
after_build:
# Identity setup
- git config --global user.email "test@appveyor.land"
- git config --global user.name "Appveyor Almighty"