1
- version : 2
1
+ version : 2.1
2
+
3
+ # Use this orb install python dependences.
4
+ orbs :
5
+ python :
circleci/[email protected]
6
+ gh-pages :
sugarshin/[email protected]
7
+
8
+
9
+ commands :
10
+ # For installing dep and building toppra C++ API
11
+ build_cpp :
12
+ description : " Install dependencies (C++) and build toppra C++ API"
13
+ parameters :
14
+ python-version :
15
+ type : string
16
+ default : " 3.6"
17
+ python-version-short :
18
+ type : string
19
+ default : " 36"
20
+ steps :
21
+ - run :
22
+ name : Install dependencies
23
+ command : |
24
+ echo "deb [arch=amd64] http://robotpkg.openrobots.org/packages/debian/pub $(lsb_release -sc) robotpkg" \
25
+ | sudo tee /etc/apt/sources.list.d/robotpkg.list
26
+ curl http://robotpkg.openrobots.org/packages/debian/robotpkg.key \
27
+ | sudo apt-key add -
28
+ sudo apt update
29
+ sudo apt install -y cmake clang-tidy libeigen3-dev robotpkg-pinocchio robotpkg-qpoases libglpk-dev \
30
+ robotpkg-py<< parameters.python-version-short >>-pinocchio \
31
+ robotpkg-py<< parameters.python-version-short >>-example-robot-data
32
+
33
+ cd ~/ && git clone https://github.com/pybind/pybind11
34
+ cd pybind11 && git checkout v2.5.0
35
+ mkdir build && cd build && cmake -DPYBIND11_TEST=false .. && sudo make install
36
+
37
+ cd ~/ && git clone https://github.com/msgpack/msgpack-c.git
38
+ cd msgpack-c && git checkout cpp-3.2.1 && cmake -DMSGPACK_CXX11=ON -DMSGPACK_BUILD_EXAMPLES=OFF -DMSGPACK_CXX_ONLY=ON .
39
+ sudo make install
40
+
41
+ working_directory : ~/
42
+ - run :
43
+ name : Build toppra C++ API
44
+ command : |
45
+ export LD_LIBRARY_PATH=/opt/openrobots/lib:${LD_LIBRARY_PATH}
46
+ export CMAKE_PREFIX_PATH=/opt/openrobots
47
+ mkdir build && cd build && cmake \
48
+ -DBUILD_WITH_PINOCCHIO=ON \
49
+ -DBUILD_WITH_qpOASES=ON \
50
+ -DBUILD_WITH_GLPK=ON \
51
+ -DPYTHON_BINDINGS=ON \
52
+ -DPYTHON_VERSION=<< parameters.python-version >> \
53
+ -DBUILD_WITH_PINOCCHIO_PYTHON=true \
54
+ -DOPT_MSGPACK=ON ..
55
+ make -j4
56
+ working_directory : ~/repo/cpp
2
57
3
58
jobs :
4
- check-codestyle :
59
+ # Test the base python installation on multiple environments. In
60
+ # addition, run lint task.
61
+ python :
62
+ parameters :
63
+ python-version :
64
+ type : string
65
+ default : " "
66
+ tox-base-cmd :
67
+ type : string
68
+ default : " py"
5
69
docker :
6
70
- image : hungpham2511/toppra-dep:0.0.3
7
71
8
72
working_directory : ~/repo
9
-
10
73
steps :
11
74
- checkout
12
- - restore_cache :
13
- keys :
14
- - v1-dependencies3-{{ checksum "requirements3.txt" }}
15
75
- run :
16
- name : install dependencies
76
+ name : Run tests for python << parameters.python-version >>
17
77
command : |
18
- python3 -m virtualenv --python python3 venv3 && . venv3/bin/activate
19
- pip install invoke pathlib2 numpy cython
20
- invoke install-solvers
21
- pip install -e .[dev]
22
-
23
- - save_cache :
24
- paths :
25
- - ./venv3
26
- key : v1-dependencies3-{{ checksum "requirements3.txt" }}
78
+ virtualenv --python python3.7 venv3 && . venv3/bin/activate
79
+ pip install tox numpy cython # need numpy and cython to create the sdist
80
+ tox -e << parameters.tox-base-cmd >><< parameters.python-version >>
27
81
28
- - run :
29
- name : check codestyle
30
- command : |
31
- . venv3/bin/activate
32
- invoke lint || echo "allow failure"
82
+ - store_test_results :
83
+ path : test-results
33
84
34
85
- store_artifacts :
35
- path : test-reports
36
- destination : test-reports
86
+ path : test-results
37
87
38
- build-python-3 :
88
+ # Test the cpp api and bindings on python3.6 The base image of this
89
+ # job is Ubuntu 18.04, which is required to install pinocchio and
90
+ # other deps.
91
+ cpp-python36 :
92
+ description : Build and test the full Python API
39
93
docker :
40
- - image : hungpham2511/toppra-dep:0.0.3
41
-
94
+ - image : cimg/python:3.6
42
95
working_directory : ~/repo
43
-
44
96
steps :
45
97
- checkout
46
-
47
- # Download and cache dependencies
48
- - restore_cache :
49
- keys :
50
- - v1-dependencies3-{{ checksum "requirements3.txt" }}
51
-
98
+ - build_cpp
52
99
- run :
53
- name : install dependencies
100
+ name : Unit tests (C++)
54
101
command : |
55
- virtualenv --python python3.7 venv3 && . venv3/bin/activate
56
- pip install invoke pathlib2 numpy cython
102
+ ./tests/all_tests
103
+ working_directory : ~/repo/cpp/build
104
+ - run :
105
+ name : Check codestyle (C++)
106
+ command : |
107
+ clang-tidy src/**/*.cpp \
108
+ -checks=clang-analyzer-*,clang-analyzer-cplusplus*,cppcoreguidelines-*,performance-*,modernize-*,readability-,-cppcoreguidelines-pro-bounds-array-to-pointer-decay\
109
+ -warnings-as-errors=clang-analyzer-*,clang-analyzer-cplusplus*,cppcoreguidelines-*,modernize-*
110
+ working_directory : ~/repo/cpp
111
+ - python/load-cache :
112
+ dependency-file : requirements3.txt
113
+ - python/install-deps :
114
+ dependency-file : requirements3.txt
115
+ - python/save-cache :
116
+ dependency-file : requirements3.txt
117
+ - run :
118
+ name : Install Python API with bindings
119
+ command : |
120
+ pip install numpy cython invoke # absolute minimum to run setup.py
57
121
invoke install-solvers
58
122
pip install -e .[dev]
59
123
60
- - save_cache :
61
- paths :
62
- - ./venv3
63
- key : v1-dependencies3-{{ checksum "requirements3.txt" }}
64
-
65
124
- run :
66
- name : test
125
+ name : Test Python API with bindings
67
126
command : |
68
- . venv3/bin/activate
69
- mkdir test-reports
70
- python --version
71
- python -m pytest -q tests --durations=3 --junitxml=test-reports/junit.xml
127
+ export ROS_PACKAGE_PATH=/opt/openrobots/share
128
+ export PYTHONPATH=/opt/openrobots/lib/python3.6/site-packages:$PYTHONPATH
129
+ pytest tests --durations=3 --junitxml=test-reports/junit.xml
72
130
73
131
- store_test_results :
74
132
path : test-reports
75
133
76
- build-cpp :
77
- docker :
78
- - image : hungpham2511/toppra-dep:0.0.3
79
-
80
- working_directory : ~/repo
81
-
82
- steps :
83
- - checkout
84
134
- run :
85
- name : dependencies
135
+ name : Build docs
86
136
command : |
87
- sudo apt install -y curl
88
- echo "deb [arch=amd64] http://robotpkg.openrobots.org/packages/debian/pub $(lsb_release -sc) robotpkg" \
89
- | sudo tee /etc/apt/sources.list.d/robotpkg.list
90
- curl http://robotpkg.openrobots.org/packages/debian/robotpkg.key \
91
- | sudo apt-key add -
92
- sudo apt update
93
- sudo apt install -y clang-tidy libeigen3-dev robotpkg-pinocchio robotpkg-qpoases libglpk-dev
137
+ export ROS_PACKAGE_PATH=/opt/openrobots/share
138
+ export PYTHONPATH=/opt/openrobots/lib/python3.6/site-packages:$PYTHONPATH
139
+ pip install -r docs/requirements.txt
140
+ invoke build-docs
94
141
95
- - run :
96
- name : build
97
- command : |
98
- export LD_LIBRARY_PATH=/opt/openrobots/lib:${LD_LIBRARY_PATH}
99
- export CMAKE_PREFIX_PATH=/opt/openrobots
100
- mkdir build && cd build && cmake -DBUILD_WITH_PINOCCHIO=ON -DBUILD_WITH_qpOASES=ON -DBUILD_WITH_GLPK=ON ..
101
- make -j4
102
- working_directory : ~/repo/cpp
142
+ - persist_to_workspace :
143
+ root : .
144
+ paths :
145
+ - docs/build
103
146
104
- - run :
105
- name : test
106
- command : |
107
- ./tests/all_tests
108
- working_directory : ~/repo/cpp/build
147
+ # Publishthe built doc from the last build step
148
+ publish-docs :
149
+ docker :
150
+ - image : cimg/python:3.6
151
+ working_directory : ~/repo
152
+ steps :
153
+ - checkout
154
+ - attach_workspace :
155
+ at : .
156
+ - add_ssh_keys
157
+ - gh-pages/deploy :
158
+ ssh-fingerprints : " 9f:09:37:d6:4a:48:0d:17:a7:c5:4a:5d:af:b5:fc:ab"
159
+ build-dir : ./docs/build/html
109
160
110
161
pre-release :
111
162
docker :
@@ -122,48 +173,52 @@ jobs:
122
173
123
174
release :
124
175
docker :
125
- - image : buildpack-deps:trusty
176
+ - image : cimg/python:3.6
126
177
working_directory : ~/repo
127
178
steps :
128
179
- checkout
129
180
- run :
130
- name : Tag code with the latest version in VERSION and push tag.
181
+ name : Build distribution
131
182
command : |
132
- VERSION=`cat VERSION`
133
- git fetch --tags
134
- git tag $VERSION
135
- git push origin $VERSION
183
+ pip install cython numpy twine
184
+ python setup.py sdist
185
+
136
186
- run :
137
187
name : Publish to PyPI
138
188
command : |
139
- echo "TODO"
189
+ twine upload dist/* --username hungpham --password $PYPI_PASSWORD
140
190
141
191
workflows :
142
192
version : 2
143
193
integrate :
144
194
jobs :
145
- - build-cpp
146
- - check-codestyle
147
- - build-python-3 :
195
+ - python :
196
+ tox-base-cmd : " lint"
197
+ - python :
198
+ matrix :
199
+ parameters :
200
+ python-version : ["27", "36", "37"]
201
+
202
+ - cpp-python36
203
+ - publish-docs :
148
204
requires :
149
- - check-codestyle
150
-
151
- release :
152
- jobs :
153
- - pre-release :
205
+ - cpp-python36
154
206
filters :
155
207
branches :
156
208
only :
157
- - fix-ci
158
- - /release-.*/
159
-
160
- publish :
209
+ - fix-doc
210
+ - develop
211
+ release :
161
212
jobs :
162
213
- release :
163
214
filters :
164
215
branches :
165
216
only :
166
217
- master
218
+ - test-release
167
219
168
-
169
-
220
+ - pre-release :
221
+ filters :
222
+ branches :
223
+ only :
224
+ - /release-.*/
0 commit comments