From bb7ea4bf4109aab6c9f8acc8e4ea76223aa198e2 Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Thu, 14 Jun 2018 01:32:08 -0400 Subject: [PATCH] Try new appveyor config - Auto abort re-built PRs - Better leverage of caching - Better exit handling Signed-off-by: Dan Ryan Fix appveyor config Signed-off-by: Dan Ryan Fix syntax error Signed-off-by: Dan Ryan Try tox with detox Signed-off-by: Dan Ryan Slight tweak? Signed-off-by: Dan Ryan Back to powershell Signed-off-by: Dan Ryan --- appveyor.yml | 99 +++++++++++++++++++++++++++++++++------------------- tox.ini | 16 +++++++++ 2 files changed, 79 insertions(+), 36 deletions(-) create mode 100644 tox.ini diff --git a/appveyor.yml b/appveyor.yml index 281be915..2a172f02 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,54 +4,81 @@ version: 1.0.{build} skip_branch_with_pr: true init: +- ps: >- - - git config --global core.sharedRepository true - - git config --global core.longpaths true - - git config --global core.autocrlf input + git config --global core.sharedRepository true + + git config --global core.longpaths true + + git config --global core.autocrlf input + + if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod ` + https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | ` + Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { ` + Write-Host "There are newer queued builds for this pull request, skipping build." + Exit-AppveyorBuild + } + + If (($env:SKIP_NOTAG -eq "true") -and ($env:APPVEYOR_REPO_TAG -ne "true")) { + Write-Host "Skipping build, not at a tag." + Exit-AppveyorBuild + } environment: - PYPI_VENDOR_DIR: '.\tests\pypi\' - GIT_ASK_YESNO: 'false' - SHELL: 'windows' - PYTHON_ARCH: '64' - PYTHONIOENCODING: 'utf-8' + PYPI_VENDOR_DIR: .\tests\pypi\ + PYTHONIOENCODING: utf-8 + GIT_ASK_YESNO: false + SHELL: windows + PYTHON_ARCH: 64 + APPVEYOR_SAVE_CACHE_ON_ERROR: true + APPVEYOR_SKIP_FINALIZE_ON_EXIT: true matrix: - - PYTHON: 'C:\Python27-x64' - PYTHON_VERSION: '2.7.x' - TEST_SUITE: 'not install' + - PYTHON: C:\Python27-x64 + PYTHON_VERSION: 2.7.x + PIPENV_PYTHON: 2.7 - - PYTHON: 'C:\Python27-x64' - PYTHON_VERSION: '2.7.x' - TEST_SUITE: 'install' - PYTEST_ADDOPTS: '--cache-clear' - RUN_INTEGRATION_TESTS: 'True' + - PYTHON: C:\Python36-x64 + PYTHON_VERSION: 3.6.x + PIPENV_PYTHON: 3.6 - - PYTHON: 'C:\Python36-x64' - PYTHON_VERSION: '3.6.x' - TEST_SUITE: 'not install' - - - PYTHON: 'C:\Python36-x64' - PYTHON_VERSION: '3.6.x' - TEST_SUITE: 'install' - PYTEST_ADDOPTS: '--cache-clear' - RUN_INTEGRATION_TESTS: 'True' install: - - 'set PATH=%PYTHON%;%PYTHON%\Scripts;%PATH%' - - '%PYTHON%\python.exe -m pip install --upgrade pip' - - '%PYTHON%\python.exe -m pip install -e .' - - '%PYTHON%\python.exe -m pipenv run pip install -e .' - - '%PYTHON%\python.exe -m pipenv install --dev' - - '%PYTHON%\python.exe -m pipenv --venv' - - '%PYTHON%\python.exe -m pipenv --py' - - '%PYTHON%\python.exe -m pipenv run python --version' +- ps: >- + + $script_path = Join-Path -path $env:PYTHON -childpath Scripts + + $py_exe = Join-Path -path $env:PYTHON -childpath python.exe + + $pipenv_exe = Join-Path -path $script_path -childpath pipenv.exe + + $env:PATH = "$py_path;$script_path;$env:PATH" + + Invoke-Expression "$py_exe -m pip install --upgrade pip" + + Invoke-Expression "$py_exe -m pip install -e ." + + Invoke-Expression "$pipenv_exe install --dev" + + Invoke-Expression "$pipenv_exe --venv" + + Invoke-Expression "$pipenv_exe --py" cache: - - '%LocalAppData%\pip\cache' +- '%LocalAppData%\pip\cache' +- '%LocalAppData%\pipenv\cache' test_script: - - 'if "%RUN_INTEGRATION_TESTS%" == "True" (rmdir /s /q %LocalAppData%\pip\cache)' - - '%PYTHON%\python.exe -m pipenv run pytest -v -n 4 -m "%TEST_SUITE%" tests' + +- ps: >- + $script_path = Join-Path -path $env:PYTHON -childpath Scripts + + $py_exe = Join-Path -path $env:PYTHON -childpath python.exe + + $pipenv_exe = Join-Path -path $script_path -childpath pipenv.exe + + $env:PATH = "$py_path;$script_path;$env:PATH" + + Invoke-Expression "$pipenv_exe run pytest -v -n 4 --ignore=pipenv\patched --ignore=pipenv\vendor tests" diff --git a/tox.ini b/tox.ini new file mode 100644 index 00000000..e0f660e0 --- /dev/null +++ b/tox.ini @@ -0,0 +1,16 @@ +[tox] +envlist = 2.7, + 3.6 + +[testenv] +setenv = PYPI_VENDOR_DIR = {toxinidir}/tests/pypi/ + PIPENV_PYTHON = {envname} + PYTHONIOENCODING = utf-8 + PIPENV_IGNORE_VIRTUALENVS = 1 +passenv = http_proxy https_proxy no_proxy SSL_CERT_FILE TOXENV CI TRAVIS TRAVIS_* APPVEYOR APPVEYOR_* CODECOV_* PIPENV_* PIP_* TEST_SUITE PYTHONIOENCODING GIT_ASK_YESNO SHELL PYTHON_ARCH +deps = -e . + pytest +basepython = python{envname} +commands = python -m pip install -e . + python -m pipenv install --dev + pipenv run pytest {posargs:-v -n 4 --ignore="{toxinidir}/pipenv/patched" --ignore="{toxinidir}/pipenv/vendor" -m "{env:TEST_SUITE}" tests}