-
Notifications
You must be signed in to change notification settings - Fork 0
216 lines (178 loc) · 5.92 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
name: GitHub Actions
on:
pull_request:
workflow_dispatch:
push:
tags:
- "*"
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
MAIN_PYTHON_VERSION: '3.10'
jobs:
style:
name: Code style
runs-on: ubuntu-latest
steps:
- name: PyAnsys code style checks
uses: ansys/actions/code-style@v8
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
docs-style:
name: Documentation Style Check
runs-on: ubuntu-latest
steps:
# - name: PyAnsys documentation style checks
# uses: ansys/actions/doc-style@v5
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
- name: Skip
run: exit 0
python-smoke-test:
name: Python - Smoke Tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install cmake and eigen library
run: |
sudo apt update
sudo apt install cmake libeigen3-dev
- name: Update pip
run: python -m pip install pip --upgrade
- name: Install demo-eigen-wrapper
run: |
pip install -r requirements/requirements_eigen_wrapper.txt
pip install src/ansys/eigen/cpp/eigen-wrapper
- name: Install api-eigen-example
run: |
pip install -r requirements/requirements_build.txt
pip install .
- name: Test import
run: |
python -c "from ansys.eigen.python.rest.client import DemoRESTClient; cli = DemoRESTClient('0.0.0.0', 5000); cli.get_connection_details()"
python-build-test:
name: Python - Build and Unit Testing
needs: [python-smoke-test, style]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- name: Install cmake and eigen library
run: |
sudo apt update
sudo apt install cmake libeigen3-dev
- name: Install packages
run: |
pip install -r requirements/requirements_eigen_wrapper.txt
pip install src/ansys/eigen/cpp/eigen-wrapper
pip install -r requirements/requirements_build.txt
pip install .
- name: Unit Testing
run: |
pytest
- name: Upload Coverage Results
uses: actions/upload-artifact@v4
with:
name: HTML-Coverage
path: cov_html
retention-days: 7
cpp-build-test-rest:
name: C++ - Build and Unit Testing - REST
needs: [style]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- name: Install conan
run: pip install 'conan<2'
- name: Build C++ REST Server
run: |
cd src/ansys/eigen/cpp/rest/server/build/
conan install .. && cmake .. && cmake --build .
# Requires installing restclient-cpp and jsoncpp libs manually - not available in conan.io
- name: Build C++ REST Client
run: |
sudo apt update && sudo apt install libcurl4-openssl-dev && cd external/restclient-cpp-v0.5.2 && ./autogen.sh && ./configure && sudo make install && cd -
sudo apt update && cd external/jsoncpp-v1.9.5/build && cmake -DCMAKE_INSTALL_INCLUDEDIR=include/jsoncpp .. && sudo make install && cd -
cd src/ansys/eigen/cpp/rest/client/build/ && cmake .. && cmake --build .
cpp-build-test-grpc:
name: C++ - Build and Unit Testing - gRPC
needs: [style]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
package: [client, server]
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- name: Build C++ gRPC ${{ matrix.package }}
run: |
cd src/ansys/eigen/cpp/grpc/${{ matrix.package }}/
make compile
build-doc:
name: Build Documentation
needs: [docs-style, python-build-test, cpp-build-test-rest, cpp-build-test-grpc]
runs-on: ubuntu-latest
services:
python-rest-server:
image: ghcr.io/ansys/api-eigen-example/python-rest-server:latest
ports:
- 5000:5000
python-grpc-server:
image: ghcr.io/ansys/api-eigen-example/python-grpc-server:latest
ports:
- 50051:50051
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- name: Install project requirements
run: |
sudo apt update
sudo apt install cmake libeigen3-dev doxygen graphviz
pip install -r requirements/requirements_eigen_wrapper.txt
pip install src/ansys/eigen/cpp/eigen-wrapper
pip install -r requirements/requirements_build.txt
pip install .
pip install -r requirements/requirements_docs.txt
- name: Build documentation
run: |
make -C doc html
- name: Upload documentation
uses: actions/upload-artifact@v4
with:
name: HTML-Documentation
path: doc/_build/html
retention-days: 7
- name: Deploy documentation to gh-pages
if: github.ref == 'refs/heads/main'
uses: JamesIves/[email protected]
with:
token: ${{ secrets.github_token }}
branch: gh-pages
folder: doc/_build/html
clean: true
single-commit: true