/
config.yml
75 lines (66 loc) · 2.31 KB
/
config.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
version: 2
jobs:
build:
working_directory: /root/project
docker:
- image: karrlab/build:0.0.24
steps:
# Clone repository
- checkout
# Load packages from cache
- restore_cache:
keys:
- cache-v4-{{ .Branch }}-{{ checksum "requirements.txt" }}
- cache-v4-{{ .Branch }}-
- cache-v4-
# Python 3 installation tasks
- run:
name: Install pkg_utils (Python 3)
command: pip3 install -U --process-dependency-links -e .[all]
- run:
name: Install karr_lab_build_utils (Python 3)
command: pip3 install -U --process-dependency-links git+https://github.com/KarrLab/karr_lab_build_utils.git#egg=karr_lab_build_utils
- run:
name: Upgrade requirements (Python 3)
command: karr_lab_build_utils3 upgrade-requirements
# Save packages to cache
- save_cache:
key: cache-v4-{{ .Branch }}-{{ checksum "requirements.txt" }}
paths:
- /usr/local/lib/python3.6/site-packages
# Test code
- run:
name: Test code
command: |
set +e
karr_lab_build_utils3 run-tests --with-xunit --with-coverage
TEST_EXIT_CODE_PY3=$?
# Calculate exit code and save to file for reading by the next step
if [[ $TEST_EXIT_CODE_PY3 -eq 0 ]]; then
echo "0" > TEST_EXIT_CODE
exit 0
else
echo "0" > TEST_EXIT_CODE
exit 1
fi
# Generate reports, archive results, and send notifications
- run:
name: Generate reports, archive results, and send notifications
when: always
command: |
if [[ -f TEST_EXIT_CODE ]]; then
INSTALLATION_EXIT_CODE=0
TEST_EXIT_CODE=$(<TEST_EXIT_CODE)
else
INSTALLATION_EXIT_CODE=1
TEST_EXIT_CODE=1
fi
karr_lab_build_utils3 do-post-test-tasks $INSTALLATION_EXIT_CODE $TEST_EXIT_CODE
- store_test_results:
path: /root/project/tests/reports
- store_artifacts:
path: /root/project/.coverage.3.6.4
destination: .coverage.3.6.4
- store_artifacts:
path: /root/project/docs/_build/html
destination: docs