Skip to content

Commit 46167ef

Browse files
Merge pull request #36 from jeromekelleher/initial-circle
Initial circleCI config.
2 parents 58ace5f + 7ca664c commit 46167ef

File tree

6 files changed

+165
-9
lines changed

6 files changed

+165
-9
lines changed

.circleci/config.yml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
version: 2
2+
jobs:
3+
build:
4+
docker:
5+
- image: circleci/python:3.6-stretch
6+
working_directory: /home/circleci/tskit
7+
steps:
8+
- checkout
9+
- run: sudo chown -R circleci:circleci *
10+
# - restore_cache:
11+
# key: tskit-{{ .Branch }}
12+
- run:
13+
name: Checkout submodules
14+
command: |
15+
git submodule update --init --recursive --remote
16+
- run:
17+
name: Install dependencies and set path
18+
command: |
19+
sudo apt-get install ninja-build libcunit1-dev valgrind clang doxygen libgsl-dev
20+
pip install --user -r python/requirements/development.txt
21+
pip install meson --user
22+
# tmp; until we have an msprime package install from here.
23+
pip install --user --pre --upgrade tskit
24+
pip install --user git+https://github.com/tskit-dev/msprime
25+
echo 'export PATH=/home/circleci/.local/bin:$PATH' >> $BASH_ENV
26+
# - save_cache:
27+
# key: tskit-{{ .Branch }}
28+
# paths:
29+
# - "/home/circleci/.local"
30+
- run:
31+
name: Compile Python
32+
command: |
33+
cd python
34+
# CFLAGS="--coverage -Wall -Wextra -Werror -Wno-unused-parameter" \
35+
# python setup.py build_ext --inplace
36+
# TODO enable these flags later.
37+
CFLAGS="--coverage" python setup.py build_ext --inplace
38+
- run:
39+
name: Lint Python
40+
command: |
41+
cd python
42+
flake8 --max-line-length 89 tskit setup.py tests
43+
- run:
44+
name: Run Python tests
45+
command: |
46+
PYTHONPATH=python nosetests -v --with-coverage --cover-package tskit \
47+
--cover-branches --cover-erase --cover-xml \
48+
--cover-inclusive python/tests
49+
python3 -m codecov -F python
50+
- run:
51+
name: Build Python package
52+
command: |
53+
cd python
54+
rm -fR build
55+
python setup.py sdist
56+
python setup.py check
57+
python -m venv venv
58+
source venv/bin/activate
59+
pip install --upgrade setuptools pip wheel
60+
python setup.py build_ext
61+
python setup.py egg_info
62+
python setup.py bdist_wheel
63+
# TODO This doesn't seem to be installing, fails on bdist_wheel build.
64+
# pip install dist/*.tar.gz
65+
# - run:
66+
# name: Compile C
67+
# command: |
68+
# CFLAGS=--coverage meson c/ build-gcc && cd build-gcc && ninja
69+
# - run:
70+
# name: Run C tests
71+
# command: |
72+
# export KASTORE_SOPATH=./build-gcc/libtskit.so
73+
# ./build-gcc/tests
74+
# ./build-gcc/dynamic_api_tests
75+
# ./build-gcc/malloc_tests
76+
# ./build-gcc/io_tests
77+
# - run:
78+
# name: Valgrind for C tests.
79+
# command: |
80+
# export KASTORE_SOPATH=./build-gcc/libtskit.so
81+
# valgrind --leak-check=full --error-exitcode=1 ./build-gcc/tests
82+
# valgrind --leak-check=full --error-exitcode=1 ./build-gcc/dynamic_api_tests
83+
# valgrind --leak-check=full --error-exitcode=1 ./build-gcc/malloc_tests
84+
# valgrind --leak-check=full --error-exitcode=1 ./build-gcc/io_tests
85+
# - run:
86+
# name: Run gcov & upload coverage.
87+
# command: |
88+
# gcov -pb -o ./python/build/temp.linux*/ python/_tskitmodule.c
89+
# gcov -pb ./build-gcc/tests@exe/tskit.c.gcno \
90+
# ./build-gcc/malloc_tests@exe/tskit.c.gcno \
91+
# ./build-gcc/io_tests@exe/tskit.c.gcno \
92+
# ./build-gcc/dynamic_api_tests@exe/tskit.c.gcno \
93+
# ./build-gcc/tskit@sha/tskit.c.gcno
94+
# codecov -X gcov -F C
95+
# - run:
96+
# name: Compile C tests under clang
97+
# command: |
98+
# CC=clang meson c/ build-clang && cd build-clang && ninja
99+
# - run:
100+
# name: Run clang C tests
101+
# command: |
102+
# export KASTORE_SOPATH=./build-clang/libtskit.so
103+
# ./build-clang/tests
104+
# ./build-clang/dynamic_api_tests
105+
# ./build-clang/malloc_tests
106+
# ./build-clang/io_tests
107+
108+
# - run:
109+
# name: Build docs
110+
# command: |
111+
# cd docs && make

.codecov.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
coverage:
2+
status:
3+
project:
4+
python:
5+
target: 95%
6+
flags: python
7+
8+
patch:
9+
python:
10+
target: 90%
11+
flags: python
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
codecov
2+
coverage
3+
flake8
4+
h5py
5+
mock
6+
newick
7+
nose
8+
numpy
9+
six
10+
kastore>=0.2.2
11+
jsonschema
12+
sphinx
13+
sphinx-argparse
14+
sphinx_rtd_theme
15+
svgwrite
16+
# Seems to be a problem with Python 3. svgwrite imports
17+
# pyparsing.
18+
pyparsing < 2.1
19+
20+
# We need pysam and PyVCF for testing VCF output.
21+
# Pin pysam at 0.9 version as there are problems with building py33 version
22+
# on travis.
23+
pysam==0.9.1.4
24+
PyVCF
25+
26+
# We use JSON-schema to test out metadata handling.
27+
python_jsonschema_objects

python/tests/test_file_format.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222

2323
CURRENT_FILE_MAJOR = 12
2424

25+
test_data_dir = os.path.join(os.path.dirname(__file__), "data")
26+
2527

2628
def single_locus_no_mutation_example():
2729
return msprime.simulate(10, random_seed=10)
@@ -172,22 +174,25 @@ def verify_tree_sequence(self, ts):
172174

173175
def test_format_too_old_raised_for_hdf5(self):
174176
files = [
175-
"tests/data/hdf5-formats/msprime-0.3.0_v2.0.hdf5",
176-
"tests/data/hdf5-formats/msprime-0.4.0_v3.1.hdf5",
177-
"tests/data/hdf5-formats/msprime-0.5.0_v10.0.hdf5"]
177+
"msprime-0.3.0_v2.0.hdf5", "msprime-0.4.0_v3.1.hdf5",
178+
"msprime-0.5.0_v10.0.hdf5"]
178179
for filename in files:
179-
self.assertRaises(exceptions.VersionTooOldError, tskit.load, filename)
180+
path = os.path.join(test_data_dir, "hdf5-formats", filename)
181+
self.assertRaises(exceptions.VersionTooOldError, tskit.load, path)
180182

181183
def test_msprime_v_0_5_0(self):
182-
ts = tskit.load_legacy("tests/data/hdf5-formats/msprime-0.5.0_v10.0.hdf5")
184+
path = os.path.join(test_data_dir, "hdf5-formats", "msprime-0.5.0_v10.0.hdf5")
185+
ts = tskit.load_legacy(path)
183186
self.verify_tree_sequence(ts)
184187

185188
def test_msprime_v_0_4_0(self):
186-
ts = tskit.load_legacy("tests/data/hdf5-formats/msprime-0.4.0_v3.1.hdf5")
189+
path = os.path.join(test_data_dir, "hdf5-formats", "msprime-0.4.0_v3.1.hdf5")
190+
ts = tskit.load_legacy(path)
187191
self.verify_tree_sequence(ts)
188192

189193
def test_msprime_v_0_3_0(self):
190-
ts = tskit.load_legacy("tests/data/hdf5-formats/msprime-0.3.0_v2.0.hdf5")
194+
path = os.path.join(test_data_dir, "hdf5-formats", "msprime-0.3.0_v2.0.hdf5")
195+
ts = tskit.load_legacy(path)
191196
self.verify_tree_sequence(ts)
192197

193198

python/tests/test_highlevel.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1340,7 +1340,8 @@ def test_simplify(self):
13401340
self.assertGreater(num_mutations, 0)
13411341

13421342
def test_simplify_bugs(self):
1343-
prefix = "tests/data/simplify-bugs/"
1343+
prefix = os.path.join(
1344+
os.path.dirname(__file__), "data", "simplify-bugs")
13441345
j = 1
13451346
while True:
13461347
nodes_file = os.path.join(prefix, "{:02d}-nodes.txt".format(j))

python/tests/test_provenance.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,8 @@ class TestGetSchema(unittest.TestCase):
173173
"""
174174
def test_file_equal(self):
175175
s1 = provenance.get_schema()
176-
with open(os.path.join("tskit", "provenance.schema.json")) as f:
176+
base = os.path.join(os.path.dirname(__file__), "..", "tskit")
177+
with open(os.path.join(base, "provenance.schema.json")) as f:
177178
s2 = json.load(f)
178179
self.assertEqual(s1, s2)
179180

0 commit comments

Comments
 (0)