Skip to content

Commit bd2dff8

Browse files
authored
[CI] add CentOS build (#151)
* initial add * missing steps * trying with more braces * try sth else * updated others * running tests in CentOS * fix for py version * using python3 in CentOS build * using python3.5
1 parent b714e0b commit bd2dff8

2 files changed

Lines changed: 77 additions & 40 deletions

File tree

.github/workflows/ci.yml

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ jobs:
7878
uses: actions/setup-python@v1
7979
with:
8080
python-version: ${{ matrix.python-version }}
81-
81+
8282
- name: Installing dependencies
8383
shell: cmd
8484
run: |
@@ -125,3 +125,36 @@ jobs:
125125
cd tests
126126
rem TODO delete build dir to make sure the linking etc works correctly? (Needs to be done after running CTests)
127127
python run_python_tests.py
128+
129+
130+
centos:
131+
runs-on: ubuntu-latest
132+
133+
container:
134+
image: kratosmultiphysics/kratos-image-ci-centos7-python35:latest
135+
136+
steps:
137+
- uses: actions/checkout@v2
138+
139+
- name: Build CoSimIO
140+
run: |
141+
cmake -H"." -B"build" \
142+
-DCMAKE_BUILD_TYPE="Debug" \
143+
-DBUILD_C=ON \
144+
-DBUILD_PYTHON=ON \
145+
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -Werror" \
146+
-DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} -Werror"
147+
148+
cmake --build "build" --target install -- -j2
149+
150+
- name: Running tests (Ctest)
151+
run: |
152+
cd build
153+
ctest
154+
155+
- name: Running tests (Python)
156+
run: |
157+
export PYTHONPATH=${PYTHONPATH}:${GITHUB_WORKSPACE}/bin
158+
cd tests
159+
# TODO delete build dir to make sure the linking etc works correctly? (Needs to be done after running CTests)
160+
python3.5 run_python_tests.py

tests/co_sim_io/impl/test_communication.cpp

Lines changed: 43 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -125,31 +125,33 @@ std::shared_ptr<CoSimIO::ModelPart> CreateSurfaceModelPart()
125125
{
126126
std::shared_ptr<CoSimIO::ModelPart> p_model_part(std::make_shared<CoSimIO::ModelPart>("surface_model_part"));
127127

128-
std::vector<std::tuple<int, std::array<double,3>>> node_coords {
129-
{1, {0,0,0}},
130-
{2, {1,0,0}},
131-
{3, {1,2,0}},
132-
{4, {0,2,0}},
133-
{9, {2.5,0,0}},
134-
{10, {2.5,2,0}},
135-
{21, {0,3,0}},
136-
{22, {1,3,0}},
137-
{23, {2.5,3,0}},
138-
{53, {0,3,-2}},
139-
{55, {2.5,3,-2}}
128+
using tup = std::tuple<int, std::array<double,3>>; // workaround for older compilers
129+
std::vector<tup> node_coords {
130+
tup{1, {0,0,0}},
131+
tup{2, {1,0,0}},
132+
tup{3, {1,2,0}},
133+
tup{4, {0,2,0}},
134+
tup{9, {2.5,0,0}},
135+
tup{10, {2.5,2,0}},
136+
tup{21, {0,3,0}},
137+
tup{22, {1,3,0}},
138+
tup{23, {2.5,3,0}},
139+
tup{53, {0,3,-2}},
140+
tup{55, {2.5,3,-2}}
140141
};
141142

142143
// Id, type, connectivities
144+
using tup2 = std::tuple<int, CoSimIO::ElementType, CoSimIO::ConnectivitiesType>; // workaround for older compilers
143145
std::vector<std::tuple<int, CoSimIO::ElementType, CoSimIO::ConnectivitiesType>> elem_info {
144-
{10, ElementType::Quadrilateral2D4, {1,2,3,4}},
145-
{3, ElementType::Quadrilateral2D4, {3,2,9,10}},
146-
{4, ElementType::Quadrilateral2D4, {4,3,22,21}},
147-
{6, ElementType::Quadrilateral2D4, {3,10,23,22}},
148-
{11, ElementType::Triangle2D3, {21,22,53}},
149-
{12, ElementType::Triangle2D3, {22,55,53}},
150-
{15, ElementType::Triangle2D3, {22,23,55}},
151-
{26, ElementType::Triangle2D3, {4,21,53}},
152-
{27, ElementType::Triangle2D3, {10,23,55}}
146+
tup2{10, ElementType::Quadrilateral2D4, {1,2,3,4}},
147+
tup2{3, ElementType::Quadrilateral2D4, {3,2,9,10}},
148+
tup2{4, ElementType::Quadrilateral2D4, {4,3,22,21}},
149+
tup2{6, ElementType::Quadrilateral2D4, {3,10,23,22}},
150+
tup2{11, ElementType::Triangle2D3, {21,22,53}},
151+
tup2{12, ElementType::Triangle2D3, {22,55,53}},
152+
tup2{15, ElementType::Triangle2D3, {22,23,55}},
153+
tup2{26, ElementType::Triangle2D3, {4,21,53}},
154+
tup2{27, ElementType::Triangle2D3, {10,23,55}}
153155
};
154156

155157
for (const auto& node_info : node_coords) {
@@ -176,28 +178,30 @@ std::shared_ptr<CoSimIO::ModelPart> CreateVolumeModelPart()
176178
{
177179
std::shared_ptr<CoSimIO::ModelPart> p_model_part(std::make_shared<CoSimIO::ModelPart>("volume_model_part"));
178180

179-
std::vector<std::tuple<int, std::array<double,3>>> node_coords {
180-
{1, {0,0,0}},
181-
{2, {1,0,0}},
182-
{3, {1,1,0}},
183-
{4, {0,1,0}},
184-
{11, {0,0,1.5}},
185-
{12, {1,0,1.5}},
186-
{13, {1,1,1.5}},
187-
{14, {0,1,1.5}},
188-
{22, {5,0,0}},
189-
{23, {5,1,0}},
190-
{112, {5.5,0,1.5}},
191-
{113, {5.5,1,1.5}},
192-
{6, {3,-1.5,5}}
181+
using tup = std::tuple<int, std::array<double,3>>; // workaround for older compilers
182+
std::vector<tup> node_coords {
183+
tup{1, {0,0,0}},
184+
tup{2, {1,0,0}},
185+
tup{3, {1,1,0}},
186+
tup{4, {0,1,0}},
187+
tup{11, {0,0,1.5}},
188+
tup{12, {1,0,1.5}},
189+
tup{13, {1,1,1.5}},
190+
tup{14, {0,1,1.5}},
191+
tup{22, {5,0,0}},
192+
tup{23, {5,1,0}},
193+
tup{112, {5.5,0,1.5}},
194+
tup{113, {5.5,1,1.5}},
195+
tup{6, {3,-1.5,5}}
193196
};
194197

195198
// Id, type, connectivities
199+
using tup2 = std::tuple<int, CoSimIO::ElementType, CoSimIO::ConnectivitiesType>; // workaround for older compilers
196200
std::vector<std::tuple<int, CoSimIO::ElementType, CoSimIO::ConnectivitiesType>> elem_info {
197-
{10, ElementType::Hexahedra3D8, {1,2,3,4,11,12,13,14}},
198-
{3, ElementType::Hexahedra3D8, {2,22,23,3,12,112,113,13}},
199-
{26, ElementType::Tetrahedra3D4, {11,12,13,6}},
200-
{27, ElementType::Tetrahedra3D4, {12,112,13,6}}
201+
tup2{10, ElementType::Hexahedra3D8, {1,2,3,4,11,12,13,14}},
202+
tup2{3, ElementType::Hexahedra3D8, {2,22,23,3,12,112,113,13}},
203+
tup2{26, ElementType::Tetrahedra3D4, {11,12,13,6}},
204+
tup2{27, ElementType::Tetrahedra3D4, {12,112,13,6}}
201205
};
202206

203207
for (const auto& node_info : node_coords) {

0 commit comments

Comments
 (0)