|
| 1 | +# This CI setup provides a largely homogeneous configuration across all |
| 2 | +# major platforms (Windows, MacOS, and Linux). The aim of this test setup is |
| 3 | +# to create a "native" platform experience, using as few cross-platform |
| 4 | +# helper tools as possible. |
| 5 | +# |
| 6 | +# On all platforms `hatch` is used for testing, and managing the test |
| 7 | +# environment. This yields a near-identical environment/behavior across |
| 8 | +# platforms and Python versions. The main difference between running tests |
| 9 | +# on Appveyor and locally should be the service setup (e.g., SSH, HTTPBIN). |
| 10 | +# |
| 11 | +# All workers support remote login. Login details are shown at the top of each |
| 12 | +# CI run log. |
| 13 | +# |
| 14 | +# - Linux/Mac workers (via SSH): |
| 15 | +# |
| 16 | +# - A permitted SSH key must be defined in an APPVEYOR_SSH_KEY environment |
| 17 | +# variable (via the appveyor project settings) |
| 18 | +# |
| 19 | +# - SSH login info is given in the form of: '[email protected] -p 22xxx' |
| 20 | +# |
| 21 | +# - Login with: |
| 22 | +# |
| 23 | +# ssh -o StrictHostKeyChecking=no <LOGIN> |
| 24 | +# |
| 25 | +# - to prevent the CI run from exiting, `touch` a file named `BLOCK` in the |
| 26 | +# user HOME directory (current directory directly after login). The session |
| 27 | +# will run until the file is removed (or 60 min have passed) |
| 28 | +# |
| 29 | +# - Windows workers (via RDP): |
| 30 | +# |
| 31 | +# - An RDP password should be defined in an APPVEYOR_RDP_PASSWORD environment |
| 32 | +# variable (via the appveyor project settings), or a random password is used |
| 33 | +# every time |
| 34 | +# |
| 35 | +# - RDP login info is given in the form of IP:PORT |
| 36 | +# |
| 37 | +# - Login with: |
| 38 | +# |
| 39 | +# xfreerdp /cert:ignore /dynamic-resolution /u:appveyor /p:<PASSWORD> /v:<LOGIN> |
| 40 | +# |
| 41 | +# - to prevent the CI run from exiting, create a textfile named `BLOCK` on the |
| 42 | +# Desktop (a required .txt extension will be added automatically). The session |
| 43 | +# will run until the file is removed (or 60 min have passed) |
| 44 | +# |
| 45 | + |
| 46 | +# do not make repository clone cheap: interfers with VCS-based version determination |
| 47 | +shallow_clone: false |
| 48 | + |
| 49 | +# turn of support for MS project build support (not needed) |
| 50 | +build: off |
| 51 | + |
| 52 | +environment: |
| 53 | + # place coverage files to a known location regardless of where a test run |
| 54 | + # is happening |
| 55 | + COVERAGE_ROOT: /home/appveyor/DLTMP |
| 56 | + # we pin hatch's data file to make it easy to cache it |
| 57 | + HATCH_DATA_DIR: /home/appveyor/hatch-data-dir |
| 58 | + # same for pip |
| 59 | + PIP_CACHE: /home/appveyor/.cache/pip |
| 60 | + # Do not use `image` as a matrix dimension, to have fine-grained control over |
| 61 | + # what tests run on which platform |
| 62 | + # The ID variable had no impact, but sorts first in the CI run overview |
| 63 | + # an intelligible name can help to locate a specific test run |
| 64 | + matrix: |
| 65 | + # List a CI run for each platform first, to have immediate access when there |
| 66 | + # is a need for debugging |
| 67 | + |
| 68 | + # Ubuntu core tests |
| 69 | + - job_name: test-linux |
| 70 | + APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2204 |
| 71 | + PY: 3.9 |
| 72 | + INSTALL_GITANNEX: git-annex -m snapshot |
| 73 | + |
| 74 | + # same as 'test-linux', but TMPDIR is on a crippled filesystem, causing |
| 75 | + # most, if not all test datasets to be created on that filesystem |
| 76 | + - job_name: test-linux-crippled |
| 77 | + APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2204 |
| 78 | + PY: 3.9 |
| 79 | + # datalad-annex git remote needs something after git-annex_8.20211x |
| 80 | + INSTALL_GITANNEX: git-annex -m snapshot |
| 81 | + |
| 82 | + # Windows core tests |
| 83 | + - job_name: test-win |
| 84 | + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 |
| 85 | + # Python version specification is non-standard on windows |
| 86 | + PY: 3.12 |
| 87 | + INSTALL_GITANNEX: git-annex -m datalad/packages |
| 88 | + COVERAGE_ROOT: C:\DLTMP |
| 89 | + HATCH_DATA_DIR: C:\hatch-data-dir |
| 90 | + PIP_CACHE: C:\Users\appveyor\AppData\Local\pip\Cache |
| 91 | + |
| 92 | + # MacOS core tests |
| 93 | + - job_name: test-mac |
| 94 | + APPVEYOR_BUILD_WORKER_IMAGE: macos-sonoma |
| 95 | + PY: 3.12 |
| 96 | + INSTALL_GITANNEX: git-annex |
| 97 | + COVERAGE_ROOT: /Users/appveyor/DLTMP |
| 98 | + HATCH_DATA_DIR: /Users/appveyor/hatch-data-dir |
| 99 | + PIP_CACHE: /Users/appveyor/.cache/pip |
| 100 | + |
| 101 | + |
| 102 | +# only run the CI if there are code or tooling changes |
| 103 | +only_commits: |
| 104 | + files: |
| 105 | + - datalad_remake/ |
| 106 | + - tools/ |
| 107 | + - pyproject.toml |
| 108 | + - .appveyor.yml |
| 109 | + |
| 110 | + |
| 111 | +## tests need specific hostnames to be available |
| 112 | +## note, this is insufficient on MacOS, and needs to be reflected |
| 113 | +## in the SSH config too |
| 114 | +#hosts: |
| 115 | +# datalad-test-sshd: 127.0.0.1 |
| 116 | +# # same, but for datalad-remake implementations |
| 117 | +# datalad-test: 127.0.0.1 |
| 118 | + |
| 119 | + |
| 120 | +# job-specific configurations |
| 121 | +for: |
| 122 | + # |
| 123 | + # POSIX TEST RUNS |
| 124 | + # |
| 125 | + - matrix: |
| 126 | + only: |
| 127 | + - job_name: test-linux |
| 128 | + - job_name: test-linux-crippled |
| 129 | + - job_name: test-mac |
| 130 | + |
| 131 | + cache: |
| 132 | + # pip cache |
| 133 | + - "${PIP_CACHE} -> .appveyor.yml" |
| 134 | + # hatch-managed python versions |
| 135 | + - "${HATCH_DATA_DIR}/env/virtual/.pythons -> pyproject.toml" |
| 136 | + |
| 137 | + # init cannot use any components from the repo, because it runs prior to |
| 138 | + # cloning it |
| 139 | + init: |
| 140 | + # enable external SSH access to CI worker |
| 141 | + # needs APPVEYOR_SSH_KEY defined in project settings (or environment) |
| 142 | + - curl -sflL 'https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-ssh.sh' | bash -e - |
| 143 | + # Scratch space |
| 144 | + # we place the "unix" one into the user's HOME to avoid git-annex issues on MacOSX |
| 145 | + # gh-5291 |
| 146 | + - mkdir ~/DLTMP && export TMPDIR=~/DLTMP |
| 147 | + |
| 148 | + install: |
| 149 | + # verify that a PY variable is declared that identifies the desired Python version |
| 150 | + # for this run |
| 151 | + - "[ \"x$PY\" != x ]" |
| 152 | + # Missing system software |
| 153 | + - tools/appveyor/install-syspkgs $INSTALL_SYSPKGS |
| 154 | + # activate Python env solely to get `python` to become available consistently |
| 155 | + # hatch will manage the actual testing environment |
| 156 | + - '. ${HOME}/venv${PY}/bin/activate' |
| 157 | + - tools/appveyor/install-git-annex ${INSTALL_GITANNEX} |
| 158 | + # enable the git-annex provisioned by the installer |
| 159 | + - "[ -f ${HOME}/dlinstaller_env.sh ] && . ${HOME}/dlinstaller_env.sh || true" |
| 160 | + test_script: |
| 161 | + # store original TMPDIR setting to limit modification to test execution |
| 162 | + - export PREV_TMPDIR=$TMPDIR |
| 163 | + # make TMPDIR a "crippled filesystem" to test wrong assumptions of POSIX-ness |
| 164 | + # on POSIX OSes. The test fixtures will create all test datasets under TMPDIR |
| 165 | + - | |
| 166 | + set -e |
| 167 | + if [ "$APPVEYOR_JOB_NAME" = "test-linux-crippled" ]; then |
| 168 | + # 100 MB VFAT FS in a box |
| 169 | + sudo dd if=/dev/zero of=/crippledfs.img count=100 bs=1M |
| 170 | + sudo mkfs.vfat /crippledfs.img |
| 171 | + sudo mkdir /crippledfs |
| 172 | + sudo mount -o "uid=$(id -u),gid=$(id -g)" /crippledfs.img /crippledfs |
| 173 | + echo "== mount >>" |
| 174 | + mount | grep crippled |
| 175 | + echo "<< mount ==" |
| 176 | + export TMPDIR=/crippledfs |
| 177 | + fi |
| 178 | + - echo TMPDIR=$TMPDIR |
| 179 | + - 'hatch run tests.py${PY}:run-cov --doctest-modules --durations 10' |
| 180 | + |
| 181 | + after_test: |
| 182 | + - 'hatch run tests.py${PY}:cov-combine' |
| 183 | + - 'hatch run tests.py${PY}:coverage xml' |
| 184 | + - 'codecovcli --auto-load-params-from AppVeyor upload-process -n "appveyor-$APPVEYOR_JOB_NAME" --disable-search -f coverage.xml' |
| 185 | + |
| 186 | + on_finish: |
| 187 | + # conditionally block the exit of a CI run for direct debugging |
| 188 | + - while [ -f ~/BLOCK ]; do sleep 5; done |
| 189 | + |
| 190 | + |
| 191 | + # |
| 192 | + # WINDOWS TEST RUNS |
| 193 | + # |
| 194 | + - matrix: |
| 195 | + only: |
| 196 | + - job_name: test-win |
| 197 | + cache: |
| 198 | + # pip cache |
| 199 | + - "%PIP_CACHE% -> .appveyor.yml" |
| 200 | + # hatch-managed python versions |
| 201 | + - "%HATCH_DATA_DIR%\\env\\virtual\\.pythons -> pyproject.toml" |
| 202 | + |
| 203 | + # init cannot use any components from the repo, because it runs prior to |
| 204 | + # cloning it |
| 205 | + init: |
| 206 | + # remove windows 260-char limit on path names |
| 207 | + - ps: Set-Itemproperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name LongPathsEnabled -value 1 |
| 208 | + # enable developer mode on windows |
| 209 | + # this should enable mklink without admin privileges, but it doesn't seem to work |
| 210 | + #- ps: tools\ci\appveyor_enable_windevmode.ps1 |
| 211 | + # enable RDP access on windows (RDP password is in appveyor project config) |
| 212 | + # this is relatively expensive (1-2min), but very convenient to jump into any build at any time |
| 213 | + - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) |
| 214 | + # Scratch space |
| 215 | + - cmd: md C:\DLTMP |
| 216 | + # and use that scratch space to get short paths in test repos |
| 217 | + # (avoiding length-limits as much as possible) |
| 218 | + - cmd: "set TMP=C:\\DLTMP" |
| 219 | + - cmd: "set TEMP=C:\\DLTMP" |
| 220 | + |
| 221 | + install: |
| 222 | + # place a debug setup helper at a convenient location |
| 223 | + - cmd: copy tools\appveyor\env_setup.bat C:\\datalad_debug.bat |
| 224 | + - cmd: "set PATH=C:\\Python%PY%;C:\\Python%PY%\\Scripts;%PATH%" |
| 225 | + # deploy the datalad installer, override version via DATALAD_INSTALLER_VERSION |
| 226 | + - cmd: |
| 227 | + IF DEFINED DATALAD_INSTALLER_VERSION ( |
| 228 | + python -m pip install "datalad-installer%DATALAD_INSTALLER_VERSION%" |
| 229 | + ) ELSE ( |
| 230 | + python -m pip install datalad-installer |
| 231 | + ) |
| 232 | + # Install git-annex on windows, otherwise INSTALL_SYSPKGS can be used |
| 233 | + # deploy git-annex, if desired |
| 234 | + - cmd: IF DEFINED INSTALL_GITANNEX datalad-installer --sudo ok %INSTALL_GITANNEX% |
| 235 | + |
| 236 | + test_script: |
| 237 | + - cmd: 'hatch run tests.py%PY%:run-cov --doctest-modules --durations 10' |
| 238 | + |
| 239 | + after_test: |
| 240 | + - cmd: 'hatch run tests.py%PY%:cov-combine' |
| 241 | + - cmd: 'hatch run tests.py%PY%:coverage xml' |
| 242 | + - cmd: 'codecovcli --auto-load-params-from AppVeyor upload-process -n "appveyor-%APPVEYOR_JOB_NAME%" --disable-search -f coverage.xml' |
| 243 | + |
| 244 | + on_finish: |
| 245 | + # conditionally block the exit of a CI run for direct debugging |
| 246 | + - ps: while ((Test-Path "C:\Users\\appveyor\\Desktop\\BLOCK.txt")) { Start-Sleep 5 } |
| 247 | + |
| 248 | + |
| 249 | +# |
| 250 | +# ALL TEST RUNS |
| 251 | +# |
| 252 | +build_script: |
| 253 | + - python -m pip install hatch codecov-cli |
| 254 | + |
| 255 | +after_build: |
| 256 | + # Identity setup |
| 257 | + - git config --global user.email "[email protected]" |
| 258 | + - git config --global user.name "Appveyor Almighty" |
0 commit comments