Skip to content

Commit

Permalink
Run tests on appveyor
Browse files Browse the repository at this point in the history
  • Loading branch information
konstin committed Jul 14, 2019
1 parent efd60ec commit 6f8debd
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 35 deletions.
47 changes: 17 additions & 30 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions ci/setup.ps1
Original file line number Diff line number Diff line change
@@ -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" )"
3 changes: 2 additions & 1 deletion tests/test_develop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ fn test_develop(package: impl AsRef<Path>, bindings: Option<String>) -> 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)
Expand Down
9 changes: 5 additions & 4 deletions tests/test_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down Expand Up @@ -120,14 +121,14 @@ fn test_integration(package: impl AsRef<Path>, bindings: Option<String>) -> 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)?,
);
}

Expand Down

0 comments on commit 6f8debd

Please sign in to comment.