forked from jonescompneurolab/hnn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
109 lines (92 loc) · 2.68 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
language: c
matrix:
include:
# OSX
- os: osx
name: "MacOS Catalina"
osx_image: xcode12
# WSL
- os: windows
name: "WSL"
env:
- WSL_INSTALL=1
- USE_CONDA=0
# Windows
- os: windows
name: "Windows"
env:
- WSL_INSTALL=0
# Linux
- os: linux
dist: bionic
name: "Ubuntu Bionic"
env:
- USE_CONDA=1
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- xvfb
- os: linux
dist: focal
name: "Ubuntu focal"
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- xvfb
before_install:
- |
# Step 0: set common environment variables
set -e
export TRAVIS_TESTING=1
export DISPLAY=:0
export LOGFILE="hnn_travis.log"
export PATH="$PATH:$HOME/.local/bin"
if [[ "${WSL_INSTALL}" -eq 1 ]]; then
# for sharing with WSL environment
export OMPI_MCA_btl_vader_single_copy_mechanism=none
export WSLENV=TRAVIS_TESTING/u:DISPLAY/u:OMPI_MCA_btl_vader_single_copy_mechanism/u:WSL_INSTALL/u
fi
- |
# Step 1: install prerequisites
if [[ "${WSL_INSTALL}" -eq 1 ]]; then
powershell.exe -ExecutionPolicy Bypass -File ./scripts/setup-travis-wsl.ps1
# scripts/setup-travis-wsl.sh
else
echo "Installing ${TRAVIS_OS_NAME} prerequisites"
scripts/setup-travis-${TRAVIS_OS_NAME}.sh
source "$HOME/Miniconda3/etc/profile.d/conda.sh"
conda activate hnn
fi
install:
- |
# Step 2: install hnn Python module and modules for testing
if [[ "${WSL_INSTALL}" -ne 1 ]]; then
pip install flake8 pytest pytest-cov coverage coveralls mne pytest-qt
python setup.py install
else
wsl -- pip install flake8 pytest pytest-cov coverage coveralls mne \
pytest-qt
wsl -- python3 setup.py install --user
fi
script:
- |
# Step 3: run CI tests with py.test
if [[ "${WSL_INSTALL}" -eq 1 ]]; then
wsl -- //home/hnn_user/hnn/scripts/run-pytest.sh
else
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
# NEURON will fail to import if DISPLAY is set
unset DISPLAY
elif [[ "${TRAVIS_OS_NAME}" == "windows" ]]; then
# Python will search path to find neuron dll's
export PATH=$PATH:/c/nrn/bin
# run tests first as a user with a space (TODO)
# runas //user:"test user" //wait "bash" "scripts/run-pytest.sh" < "$HOME/test_user_creds"
# echo "Finished test with 'test user'"
fi
scripts/run-pytest.sh
fi
after_success:
- bash <(curl -s https://codecov.io/bash)