239 lines
8.9 KiB
YAML
239 lines
8.9 KiB
YAML
# 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.
|
|
#
|
|
# 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: interferes with VCS-based version determination
|
|
shallow_clone: false
|
|
|
|
# turn of support for MS project build support (not needed)
|
|
build: off
|
|
|
|
environment:
|
|
# place coverage files to a known location regardless of where a test run
|
|
# is happening
|
|
COVERAGE_ROOT: /home/appveyor/DLTMP
|
|
# let hatch use uv for managing packages and envs
|
|
HATCH_ENV_TYPE_VIRTUAL_UV_PATH: /home/appveyor/.local/bin/uv
|
|
# we pin hatch's data file to make it easy to cache it
|
|
HATCH_DATA_DIR: /home/appveyor/hatch-data-dir
|
|
# same for uv
|
|
UV_CACHE_DIR: /home/appveyor/.cache/uv
|
|
# 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
|
|
|
|
# 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
|
|
|
|
# Windows core tests
|
|
- job_name: test-win
|
|
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
|
|
# Python version specification is non-standard on windows
|
|
COVERAGE_ROOT: C:\DLTMP
|
|
# make hatch use uv as an installer
|
|
HATCH_ENV_TYPE_VIRTUAL_UV_PATH: C:\Users\appveyor\.local\bin\uv.exe
|
|
HATCH_DATA_DIR: C:\hatch-data-dir
|
|
UV_CACHE_DIR: C:\Users\appveyor\AppData\Local\uv\cache
|
|
# appveyor has a default path that comprises _everything_. here we trim
|
|
# it to the bare necessities to reduce using preinstalled software
|
|
# that changes without notice. importantly, we
|
|
# - reset the default python to be a 64bit one
|
|
# - include the installation target path for `uv`
|
|
CUSTOMPATH: C:\Users\appveyor\.local\bin;C:\Program Files\Git\cmd;C:\Program Files\Git\usr\bin;C:\Windows\system32;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files\PowerShell\7;C:\Program Files\7-Zip;C:\Python312-x64;C:\Python312-x64\Scripts"
|
|
|
|
# MacOS core tests
|
|
- job_name: test-mac
|
|
APPVEYOR_BUILD_WORKER_IMAGE: macos-sonoma
|
|
COVERAGE_ROOT: /Users/appveyor/DLTMP
|
|
HATCH_ENV_TYPE_VIRTUAL_UV_PATH: /Users/appveyor/.local/bin/uv
|
|
HATCH_DATA_DIR: /Users/appveyor/hatch-data-dir
|
|
UV_CACHE_DIR: /Users/appveyor/.cache/uv
|
|
|
|
|
|
# only run the CI if there are code or tooling changes
|
|
only_commits:
|
|
files:
|
|
- datasalad/**/*
|
|
- tools/**/*
|
|
- pyproject.toml
|
|
- .appveyor.yml
|
|
|
|
|
|
## 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
|
|
|
|
cache:
|
|
- "${UV_CACHE_DIR} -> .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:
|
|
# DEBUG 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 -
|
|
# wipe out appveyor's collection of environment shims to prevent
|
|
# hatch from being confused by it
|
|
- rm -rf /home/appveyor/.pyenv
|
|
# Scratch space, top-level to get short paths
|
|
- mkdir ~/DLTMP && export TMPDIR=~/DLTMP
|
|
# deploy `uv`
|
|
- curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
- source $HOME/.local/bin/env
|
|
|
|
before_test:
|
|
# 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
|
|
# 250 MB VFAT FS in a box
|
|
sudo dd if=/dev/zero of=/crippledfs.img count=250 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
|
|
|
|
after_test:
|
|
- 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:
|
|
- "%UV_CACHE_DIR% -> .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:
|
|
# DEBUG 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'))
|
|
- cmd: "set PATH=%CUSTOMPATH%"
|
|
# 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
|
|
# 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"
|
|
# install `uv`
|
|
- cmd: powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
|
|
|
|
after_test:
|
|
- 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
|
|
- ps: while ((Test-Path "C:\Users\\appveyor\\Desktop\\BLOCK.txt")) { Start-Sleep 5 }
|
|
|
|
|
|
#
|
|
# ALL TEST RUNS
|
|
#
|
|
install:
|
|
# deploy git-annex from PyPi
|
|
- uv tool install hatch
|
|
- uv tool install coverage[toml]
|
|
- uv tool install codecov-cli
|
|
|
|
after_build:
|
|
# Identity setup
|
|
- git config --global user.email "test@appveyor.land"
|
|
- git config --global user.name "Appveyor Almighty"
|
|
|
|
test_script:
|
|
# always test the oldest support Python version, and also a fresh one
|
|
- 'hatch test -i py=3.9,3.13 --cover --doctest-modules --durations 10'
|