-
Notifications
You must be signed in to change notification settings - Fork 0
256 lines (220 loc) · 6.65 KB
/
ci.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
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
name: Build, test and publish
on:
push:
branches: [ master, develop ]
tags:
- 'v*'
paths-ignore:
- python/docs/**
- cpp/docs/**
- README.md
- CHANGELOG.md
pull_request:
branches: [ master, develop ]
paths-ignore:
- python/docs/**
- cpp/docs/**
- README.md
- CHANGELOG.md
env:
CONAN_USER_HOME: /home/runner/
PROTOC: ./bin/protoc
CONAN_VERSION: 1.59.0
jobs:
cpp-build:
name: "Test C++ generation"
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./cpp
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install conan
run: pip3 install conan~=${CONAN_VERSION}
- name: Build package
run: |
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build .
cpp-conan-test:
needs: [ cpp-build ]
name: "Test package with examples"
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./cpp
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install conan
run: pip3 install conan~=${CONAN_VERSION}
- name: Create profile
run: |
conan profile new default --detect
conan profile update settings.compiler.libcxx=libstdc++11 default
- name: Build test package
run: |
conan remote add panda https://conan.panda.technology/artifactory/api/conan/drift
CONAN_DP_SOURCE_DIR=`pwd`/.. conan create . drift/develop --build=missing
- name: Build examples
run: |
mkdir examples/build
cd examples/build
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build . --target all
- name: Run examples
run: find examples/build/bin/ -type f -executable -print0 | xargs -n 1 -0 nice
cpp-conan-upload:
needs: [ cpp-conan-test ]
name: "Build and upload conan package"
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./cpp
strategy:
matrix:
arch: [x86_64, armv8]
include:
- arch: x86_64
dep_install_cmd: ""
conan_tail: ""
- arch: armv8
dep_install_cmd: "sudo apt-get update && sudo apt-get install g++-aarch64-linux-gnu"
conan_tail: "-pr:b=default -pr:h=./linux_armv8 -tf=None"
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install conan
run: pip3 install conan~=${CONAN_VERSION}
- name: Setup panda remote
run: |
conan remote add panda https://conan.panda.technology/artifactory/api/conan/drift
conan user -p ${{secrets.CONAN_PASSWORD}} -r panda --skip-auth ${{secrets.CONAN_LOGIN_USERNAME}}
- name: Install compiler toolkit
run: ${{ matrix.dep_install_cmd }}
- name: Prefix version for development version
if: ${{ (github.ref == 'refs/heads/develop') }}
run: echo "VERSION_SUFFIX=$(echo ${GITHUB_RUN_ID})" >> $GITHUB_ENV
- name: Create profile
run: |
conan profile new default --detect
conan profile update settings.compiler.libcxx=libstdc++11 default
- name: Build package for stable channel
if: github.ref_type == 'tag'
run: |
CONAN_DP_SOURCE_DIR=`pwd`/.. conan create . drift/stable --build=missing ${{ matrix.conan_tail }}
- name: Build package for develop channel
if: github.ref_type == 'branch'
run: |
CONAN_DP_SOURCE_DIR=`pwd`/.. conan create . drift/develop --build=missing ${{ matrix.conan_tail }}
- name: Upload package
run: conan upload drift_protocol --all --confirm --remote=panda
py-format:
runs-on: ubuntu-latest
name: "Check PEP-8"
defaults:
run:
working-directory: ./python
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Update pip
run: python3 -m pip install --no-cache --upgrade pip
- name: Install dependencies
run: pip3 install -r extra_requirements.txt
- name: Check PEP8 with black
run: black . --check
py-pip:
name: "Build PIP package"
needs: [ py-format ]
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./python
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: ./.github/actions/download-protoc
- name: Prefix version for development version
if: ${{ (github.ref == 'refs/heads/develop') }}
run: echo "VERSION_SUFFIX=$(echo ${GITHUB_RUN_ID})" >> $GITHUB_ENV
- name: Build package
run: |
python3 setup.py egg_info
python3 setup.py bdist_wheel
- name: Build package
run: python3 setup.py bdist_wheel
- uses: actions/upload-artifact@master
with:
name: package
path: ./python/dist
py-lint:
name: "Lint PIP package"
needs: [ py-pip ]
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./python
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: ./.github/actions/install-pkg
- name: Run Pylint for tests
run: pylint tests/
py-test:
name: "Test PIP package"
needs: [ py-pip ]
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./python
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: ./.github/actions/download-protoc
- uses: ./.github/actions/install-pkg
- name: Run Pytest
run: pytest tests/
py-test-examples:
name: "Test Examples"
needs: [ py-pip ]
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./python
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: ./.github/actions/install-pkg
- name: Install example dependencies
run: pip3 install -r examples/requirements.txt
- name: Run Examples
run: find examples/ -name "*.py" -print0 | xargs -n 1 -0 python3
py-pip-upload:
name: Upload if release
needs: [ py-test, py-lint, py-pip, py-test-examples ]
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./python
if: ${{ startsWith(github.event.ref, 'refs/tags/v') }}
steps:
- uses: actions/setup-python@v2
- uses: actions/download-artifact@v2
with:
name: package
path: ./dist
- uses: pypa/[email protected]
with:
user: ${{ secrets.PYPI_USERNAME }}
password: ${{ secrets.PYPI_PASSWORD }}