Skip to content
This repository was archived by the owner on Nov 15, 2022. It is now read-only.

Commit 0e42ae7

Browse files
author
Christian Puhrsch
committed
CI setup
1 parent 46eedbb commit 0e42ae7

File tree

6 files changed

+130
-0
lines changed

6 files changed

+130
-0
lines changed

Diff for: build_tools/travis/after_success.sh

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
# This script is meant to be called by the "after_success" step defined in
3+
# .travis.yml. See http://docs.travis-ci.com/ for more details.
4+
5+
set -e
6+
7+
if [[ "$COVERAGE" == "true" ]]; then
8+
# Ignore codecov failures as the codecov server is not
9+
# very reliable but we don't want travis to report a failure
10+
# in the github UI just because the coverage report failed to
11+
# be published.
12+
codecov || echo "codecov upload failed"
13+
fi

Diff for: build_tools/travis/install.sh

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/bin/bash
2+
# This script is meant to be called by the "install" step defined in
3+
# .travis.yml. See http://docs.travis-ci.com/ for more details.
4+
# The behavior of the script is controlled by environment variabled defined
5+
# in the .travis.yml in the top level folder of the project.
6+
7+
set -e
8+
9+
echo 'List files from cached directories'
10+
if [ -d $HOME/download ]; then
11+
echo 'download:'
12+
ls $HOME/download
13+
fi
14+
if [ -d $HOME/.cache/pip ]; then
15+
echo 'pip:'
16+
ls $HOME/.cache/pip
17+
fi
18+
19+
# Deactivate the travis-provided virtual environment and setup a
20+
# conda-based environment instead
21+
deactivate
22+
23+
# Add the miniconda bin directory to $PATH
24+
export PATH=/home/travis/miniconda3/bin:$PATH
25+
echo $PATH
26+
27+
# Use the miniconda installer for setup of conda itself
28+
pushd .
29+
cd
30+
mkdir -p download
31+
cd download
32+
if [[ ! -f /home/travis/miniconda3/bin/activate ]]
33+
then
34+
if [[ ! -f miniconda.sh ]]
35+
then
36+
wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh \
37+
-O miniconda.sh
38+
fi
39+
chmod +x miniconda.sh && ./miniconda.sh -b -f
40+
conda update --yes conda
41+
echo "Creating environment to run tests in."
42+
conda create -n testenv --yes python="$PYTHON_VERSION"
43+
fi
44+
cd ..
45+
popd
46+
47+
# Activate the python environment we created.
48+
source activate testenv
49+
50+
# Install requirements via pip in our conda environment
51+
pip install -r requirements.txt
52+
53+
# Install the following only if running tests
54+
if [[ "$SKIP_TESTS" != "true" ]]; then
55+
# PyTorch
56+
conda install --yes pytorch torchvision -c pytorch
57+
58+
# Installation
59+
python setup.py install
60+
fi

Diff for: build_tools/travis/test_script.sh

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
# This script is meant to be called by the "script" step defined in
3+
# .travis.yml. See http://docs.travis-ci.com/ for more details.
4+
# The behavior of the script is controlled by environment variabled defined
5+
# in the .travis.yml in the top level folder of the project.
6+
7+
set -e
8+
9+
python --version
10+
11+
run_tests() {
12+
if [[ "$RUN_SLOW" == "true" ]]; then
13+
TEST_CMD="py.test --runslow -s -v --cov=nestedtensor --durations=20"
14+
else
15+
TEST_CMD="py.test -v --cov=nestedtensor --durations=20"
16+
fi
17+
$TEST_CMD
18+
}
19+
20+
if [[ "$RUN_FLAKE8" == "true" ]]; then
21+
flake8
22+
fi
23+
24+
if [[ "$SKIP_TESTS" != "true" ]]; then
25+
run_tests
26+
fi

Diff for: codecov.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
coverage:
2+
precision: 0
3+
round: down
4+
status:
5+
patch:
6+
default:
7+
target: 90
8+
project:
9+
default:
10+
threshold: 1%
11+
changes: false
12+
comment: false
13+
ignore:
14+
- "test/"

Diff for: pytest.ini

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[pytest]
2+
testpaths = test/
3+
python_paths = ./

Diff for: requirements.txt

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Required for tests only:
2+
3+
# Style-checking for PEP8
4+
flake8
5+
6+
# Run unit tests
7+
pytest
8+
9+
# Lets pytest find our code by automatically modifying PYTHONPATH
10+
pytest-pythonpath
11+
12+
# Coverage statistics
13+
pytest-cov
14+
codecov

0 commit comments

Comments
 (0)