Skip to content

Commit

Permalink
Add appveyor.yml for Windows CI (#3)
Browse files Browse the repository at this point in the history
Add appveyor.yml for windows CI
  • Loading branch information
lijunzh authored Apr 14, 2019
1 parent 82847d3 commit a26ea70
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 2 deletions.
9 changes: 7 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,16 @@ before_install:
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- hash -r
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
- conda config --set always_yes yes --set changeps1 no --set auto_update_conda no --set safety_checks disabled
- conda install -q conda pip
# Useful for debugging any issues with conda
- conda info -a

# Upgrade to the latest version of pip to avoid it displaying warnings
# about it being out of date.
- pip install --upgrade pip

# Create a conda environment using the required packages
- conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION pytorch scipy -c pytorch
- source activate test-environment
- pip install pytest pytest-cov codecov
Expand Down
77 changes: 77 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Build only the master branch, tagged commits, and pull requests
branches:
only:
- master
- /\d+\.\d+.*/

# Don't run the (redundant) branch build with a pull request
skip_branch_with_pr: true

matrix:
fast_finish: true

environment:
global:
# SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the
# /E:ON and /V:ON options are not enabled in the batch script intepreter
# See: http://stackoverflow.com/a/13751649/163740
CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\appveyor\\run_with_env.cmd"

PYTHONUNBUFFERED: 1
COVERAGE_DIR: ""
MINICONDA: C:\\Miniconda3-x64

matrix:
- PYTHON_VERSION: 3.7
- PYTHON_VERSION: 3.6


init:
# If there is a newer build queued for the same PR, cancel this one.
# The AppVeyor 'rollout builds' option is supposed to serve the same
# purpose but it is problematic because it tends to cancel builds pushed
# directly to master instead of just PR builds (or the converse).
# credits: JuliaLang developers.
- ps: 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) { `
throw "There are newer queued builds for this pull request, failing early." }
- ps: |
If (($env:SKIP_NOTAG -eq "true") -and ($env:APPVEYOR_REPO_TAG -ne "true")) {
throw "Skipping Python version, not a tag."
}
install:
# conda 4.5.11 seems to expect that this directory exists already
- mkdir C:\Users\appveyor\.conda
- call %MINICONDA%\Scripts\activate.bat
# The safety checks are simply intended to ensure that there is enough disk space
# and the user has the necessary permissions to make environment changes. In a CI
# environment these are not necessary and slow things down noticeably on Windows.
- conda config --set always_yes yes --set changeps1 no --set auto_update_conda no --set safety_checks disabled
- conda install -q conda pip
- conda info -a

# Upgrade to the latest version of pip to avoid it displaying warnings
# about it being out of date.
- pip install --upgrade pip

# Create a conda environment using the required packages.
- conda create -q --yes -n test python=%PYTHON_VERSION% pytorch scipy -c pytorch
- activate test
- pip install pytest pytest-cov codecov
# list package versions
- conda list
# Using pip instead of setup.py ensures we install a non-compressed version of the package
# (as opposed to an egg), which is necessary to collect coverage.
# We still get the benefit of testing an installed version over the
# test version to iron out installation file-inclusion bugs but can
# also collect coverage.
- pip install .

# Not a .NET project, build in the install setup
build: false

test_script:
- pytest tests

0 comments on commit a26ea70

Please sign in to comment.