From 6f8debd62ccba764124017dadbe291e8927977cb Mon Sep 17 00:00:00 2001 From: konstin Date: Sun, 14 Jul 2019 20:07:10 +0200 Subject: [PATCH] Run tests on appveyor --- appveyor.yml | 47 ++++++++++++++------------------------- ci/setup.ps1 | 8 +++++++ tests/test_develop.rs | 3 ++- tests/test_integration.rs | 9 ++++---- 4 files changed, 32 insertions(+), 35 deletions(-) create mode 100644 ci/setup.ps1 diff --git a/appveyor.yml b/appveyor.yml index 46dc23ca6..0560026eb 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -9,54 +9,41 @@ environment: PYO3_PACK_PASSWORD: secure: 3xTkaAvLd84qjLwY/quMb0w1Kh5NRXQ0a/zHtjnH4WY= matrix: + # For the integration test + - TARGET: x86_64-pc-windows-msvc + CHANNEL: nightly + PYTHON: "C:/Python36-x64" + # Publishes to pypi - TARGET: i686-pc-windows-msvc CHANNEL: stable - TARGET: x86_64-pc-windows-msvc CHANNEL: stable - # Commented out to avoid duplicate uploads to pypi - #- TARGET: i686-pc-windows-gnu - # CHANNEL: stable - #- TARGET: x86_64-pc-windows-gnu - # CHANNEL: stable - - # For the integration test - # Comment out because it is failing for not locally reproducable reasons (maybe LIB is set incorrectly) - #- TARGET: x86_64-pc-windows-msvc - # CHANNEL: nightly - matrix: fast_finish: true install: - - cinst miniconda3 - - ps: | - # For the gnu target we need gcc, provided by mingw. mingw which is already preinstalled, - # but we need the right version (32-bit or 64-bit) to the PATH. - # See https://www.appveyor.com/docs/build-environment/#mingw-msys-cygwin - if ($env:target -like "*-gnu") { - if ($env:target -like "x86_64-*") { # x86_64-pc-windows-gnu - $env:path += ";C:\msys64\mingw64\bin" - } else { # i686-pc-windows-gnu - $env:path += ";C:\msys64\mingw32\bin" - } - gcc --version - } + #- cinst miniconda3 # Deactivate because it makes non-conda tests fail - appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe - rustup-init.exe -y --default-host %TARGET% --default-toolchain %CHANNEL% - SET PATH=%PATH%;%CARGO_HOME%\bin - # We need python 3.x 64 bit as default in path for the develop test - - SET PATH=C:\Python36-x64\bin;%PATH% + + # See https://github.com/PyO3/pyo3/blob/master/ci/appveyor/setup.ps1 + - ps: if ($env:channel -like "nightly") { .\ci\setup.ps1 } + + # From and for ring + - IF "%CHANNEL%" == "nightly" (call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64) + + - echo %PATH% + - echo %LIBPATH% - rustc -V - cargo -V test_script: - cargo build - - ps: | - if ($env:channel -like "nightly") { - cargo test - } + - IF "%CHANNEL%" == "nightly" (python.exe -m pip install cffi) + - IF "%CHANNEL%" == "nightly" (cargo test) before_deploy: - cargo build --release --features password-storage diff --git a/ci/setup.ps1 b/ci/setup.ps1 new file mode 100644 index 000000000..414faa34d --- /dev/null +++ b/ci/setup.ps1 @@ -0,0 +1,8 @@ +$env:PATH="$env:PYTHON;$env:PYTHON\\Scripts;$env:PATH" + +Start-FileDownload "https://static.rust-lang.org/dist/rust-nightly-${env:TARGET}.msi" +Start-Process -FilePath "msiexec.exe" -ArgumentList "/i rust-nightly-$env:TARGET.msi INSTALLDIR=`"$((Get-Location).Path)\rust-nightly-$env:TARGET`" /quiet /qn /norestart" -Wait +$env:PATH="$env:PATH;$((Get-Location).Path)/rust-nightly-$env:TARGET/bin" + +$pythonLocation = Invoke-Expression "python -c `"import sys; print(sys.base_prefix)`"" +$env:LIBPATH = "$env:LIBPATH; $( Join-Path $pythonLocation "libs" )" diff --git a/tests/test_develop.rs b/tests/test_develop.rs index 3642c69b5..bc41968ad 100644 --- a/tests/test_develop.rs +++ b/tests/test_develop.rs @@ -60,7 +60,8 @@ fn test_develop(package: impl AsRef, bindings: Option) -> Result<( if venv_dir.is_dir() { fs::remove_dir_all(&venv_dir)?; } - let output = Command::new("python3") + + let output = Command::new(target.get_python()) .arg("-m") .arg("venv") .arg(&venv_dir) diff --git a/tests/test_integration.rs b/tests/test_integration.rs index f670ef3f1..821fc3a62 100644 --- a/tests/test_integration.rs +++ b/tests/test_integration.rs @@ -42,6 +42,7 @@ fn test_integration_pyo3_mixed() { #[cfg(not(feature = "skip-nightly-tests"))] #[cfg(target_os = "windows")] #[test] +#[ignore] fn test_integration_pyo3_pure_conda() { handle_result(test_integration_conda("text-crates/pyo3-pure", None)); } @@ -120,14 +121,14 @@ fn test_integration(package: impl AsRef, bindings: Option) -> Resu .arg("-m") .arg("venv") .arg(&venv_dir) - .stderr(Stdio::inherit()) - .stdout(Stdio::inherit()) .output()?; if !output.status.success() { bail!( - "Failed to create a virtualenv at {}: {}", + "Failed to create a virtualenv at {}: {}\n--- Stdout:\n{}\n--- Stderr:\n{}", venv_dir.display(), - output.status + output.status, + str::from_utf8(&output.stdout)?, + str::from_utf8(&output.stderr)?, ); }