appveyor.yml 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. environment:
  2. matrix:
  3. # Unit and integration tests.
  4. - PYTHON: "C:\\Python27"
  5. RUN_INTEGRATION_TESTS: "True"
  6. - PYTHON: "C:\\Python36-x64"
  7. RUN_INTEGRATION_TESTS: "True"
  8. # Unit tests only.
  9. - PYTHON: "C:\\Python27-x64"
  10. - PYTHON: "C:\\Python34"
  11. - PYTHON: "C:\\Python34-x64"
  12. - PYTHON: "C:\\Python35"
  13. - PYTHON: "C:\\Python35-x64"
  14. - PYTHON: "C:\\Python36"
  15. install:
  16. - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
  17. - "python --version"
  18. - "pip install certifi tox"
  19. # Fix git SSL errors.
  20. - "python -m certifi >cacert.txt"
  21. - "set /p GIT_SSL_CAINFO=<cacert.txt"
  22. - "set GIT_SSL_CAINFO"
  23. build: off
  24. cache:
  25. - '%LOCALAPPDATA%\pip\Cache'
  26. test_script:
  27. - ps: |
  28. function should_run_tests {
  29. if ("$env:APPVEYOR_PULL_REQUEST_NUMBER" -eq "") {
  30. Write-Host "Not a pull request - running tests"
  31. return $true
  32. }
  33. Write-Host "Pull request $env:APPVEYOR_PULL_REQUEST_NUMBER based on branch $env:APPVEYOR_REPO_BRANCH"
  34. git fetch -q origin +refs/heads/$env:APPVEYOR_REPO_BRANCH
  35. $changes = (git diff --name-only HEAD (git merge-base HEAD FETCH_HEAD))
  36. Write-Host "Files changed:"
  37. Write-Host $changes
  38. $important = $changes | Where-Object { $_ -NotLike "*.rst" } |
  39. Where-Object { $_ -NotLike "docs*" } |
  40. Where-Object { $_ -NotLike "news*" } |
  41. Where-Object { $_ -NotLike "*travis*" } |
  42. Where-Object { $_ -NotLike ".github*" }
  43. if (!$important) {
  44. Write-Host "Only documentation changes - skipping tests"
  45. return $false
  46. }
  47. Write-Host "Pull request $env:APPVEYOR_PULL_REQUEST_NUMBER alters code - running tests"
  48. return $true
  49. }
  50. if (should_run_tests) {
  51. # Shorten paths, workaround https://bugs.python.org/issue18199
  52. subst T: $env:TEMP
  53. $env:TEMP = "T:\"
  54. $env:TMP = "T:\"
  55. tox -e py -- -m unit -n 3
  56. if ($env:RUN_INTEGRATION_TESTS -eq "True") {
  57. tox -e py -- -m integration -n 3 --duration=5
  58. }
  59. }