forked from AMICI-dev/AMICI
-
Notifications
You must be signed in to change notification settings - Fork 0
157 lines (129 loc) · 4.47 KB
/
Copy pathtest_python_cplusplus.yml
File metadata and controls
157 lines (129 loc) · 4.47 KB
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
name: C++/Python Tests
on: [push, pull_request]
jobs:
build:
name: Tests Ubuntu
# TODO: prepare image with more deps preinstalled
runs-on: ubuntu-latest
env:
ENABLE_GCOV_COVERAGE: "TRUE"
CI_SONARCLOUD: "TRUE"
steps:
- uses: actions/checkout@master
- run: git fetch --prune --unshallow
- run: echo "::set-env name=AMICI_DIR::$(pwd)"
- run: echo "::set-env name=BNGPATH::${AMICI_DIR}/ThirdParty/BioNetGen-2.3.2"
# sonar cloud
- run: echo "::set-env name=SONAR_SCANNER_VERSION::4.2.0.1873"
- run: echo "::set-env name=SONAR_SCANNER_HOME::$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux"
- run: echo "::set-env name=SONAR_SCANNER_OPTS::-server"
- run: echo "::add-path::${SONAR_SCANNER_HOME}/bin"
- run: echo "::add-path::$HOME/.sonar/build-wrapper-linux-x86"
# TODO: add to ci image
- name: Install sonarcloud tools
run: |
sudo apt install nodejs curl unzip \
&& curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip \
https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip \
&& unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/ \
&& curl --create-dirs -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip \
https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip \
&& unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/ \
# install amici dependencies
- name: apt
run: |
sudo apt-get update \
&& sudo apt-get install -y \
cmake \
g++ \
libatlas-base-dev \
libboost-serialization-dev \
libhdf5-serial-dev \
python3-venv \
swig \
lcov
- name: Build AMICI dependencies
run: |
scripts/buildDependencies.sh
- name: Build AMICI
run: |
CI_SONARCLOUD=TRUE scripts/buildAmici.sh
- name: Cache sonar files
id: cache-sonar
uses: actions/cache@v1
with:
path: sonar_cache
key: ${{ runner.os }}-sonar_cache
- name: C++ tests
run: |
scripts/run-cpputest.sh
- name: Install python package
run: |
scripts/installAmiciSource.sh
- name: Python tests
run: |
source build/venv/bin/activate \
&& pip3 install coverage pytest pytest-cov \
&& pytest \
--ignore-glob=*petab* \
--cov=amici \
--cov-report=xml:"${AMICI_DIR}/build/coverage_py.xml" \
--cov-append \
${AMICI_DIR}/python/tests
- name: Codecov Python
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./build/coverage_py.xml
flags: python
fail_ci_if_error: true
- name: lcov
run: |
lcov --compat-libtool --no-external \
-d ${AMICI_DIR}/build/CMakeFiles/amici.dir/src \
-b ${AMICI_DIR} -c -o coverage_cpp.info \
&& lcov --compat-libtool --no-external \
-d ${AMICI_DIR}/python/sdist/build/temp.linux-x86_64-3.6/amici/src \
-b ${AMICI_DIR}/python/sdist -c -o coverage_py.info \
&& lcov -a coverage_cpp.info -a coverage_py.info -o coverage.info
- name: Codecov CPP
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.info
flags: cpp
fail_ci_if_error: true
- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
sonar-scanner \
-Dsonar.cfamily.build-wrapper-output=bw-output \
-Dsonar.projectVersion="$(git describe --abbrev=4 --dirty=-dirty --always --tags | tr -d '\n')"
osx:
name: Tests OSX
runs-on: macos-latest
steps:
- uses: actions/checkout@master
- run: git fetch --prune --unshallow
- run: echo "::set-env name=AMICI_DIR::$(pwd)"
- run: echo "::set-env name=BNGPATH::${AMICI_DIR}/ThirdParty/BioNetGen-2.3.2"
# install amici dependencies
- name: homebrew
run: |
brew install hdf5 swig gcc cppcheck libomp
- name: Build AMICI
run: |
scripts/buildAll.sh
- name: Install python package
run: |
scripts/installAmiciSource.sh
- name: cppcheck
run: |
scripts/run-cppcheck.sh
- name: Python tests
run: |
scripts/run-python-tests.sh
- name: C++ tests
run: |
scripts/run-cpputest.sh