Skip to content

Commit a0951e2

Browse files
authored
Add ci workflow (#2)
* Create ci.yml
1 parent c4b7259 commit a0951e2

File tree

6 files changed

+139
-152
lines changed

6 files changed

+139
-152
lines changed

.github/workflows/ci.yml

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
name: CI
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
8+
jobs:
9+
build-and-test:
10+
name: Run on ${{ matrix.os }} with SOFA ${{ matrix.sofa_branch }}
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
os: [ubuntu-20.04, macos-10.15, windows-2019]
16+
sofa_branch: [master]
17+
18+
steps:
19+
- name: Setup SOFA and environment
20+
id: sofa
21+
uses: sofa-framework/sofa-setup-action@v3
22+
with:
23+
sofa_root: ${{ github.workspace }}/sofa
24+
sofa_version: ${{ matrix.sofa_branch }}
25+
sofa_scope: 'full'
26+
- name: Checkout source code
27+
uses: actions/checkout@v2
28+
with:
29+
path: ${{ env.WORKSPACE_SRC_PATH }}
30+
31+
- name: Build and install
32+
shell: bash
33+
run: |
34+
if [[ "$RUNNER_OS" == "Windows" ]]; then
35+
cmd //c "${{ steps.sofa.outputs.vs_vsdevcmd }} \
36+
&& cd /d $WORKSPACE_BUILD_PATH \
37+
&& cmake \
38+
-GNinja \
39+
-DCMAKE_PREFIX_PATH="$SOFA_ROOT/lib/cmake" \
40+
-DCMAKE_BUILD_TYPE=Release \
41+
-DCMAKE_INSTALL_PREFIX="$WORKSPACE_INSTALL_PATH" \
42+
../src \
43+
&& ninja install"
44+
else
45+
cd "$WORKSPACE_BUILD_PATH"
46+
ccache -z
47+
cmake \
48+
-GNinja \
49+
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
50+
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
51+
-DCMAKE_PREFIX_PATH=$SOFA_ROOT/lib/cmake \
52+
-DCMAKE_BUILD_TYPE=Release \
53+
-DCMAKE_INSTALL_PREFIX="$WORKSPACE_INSTALL_PATH" \
54+
../src
55+
ninja install
56+
echo ${CCACHE_BASEDIR}
57+
ccache -s
58+
fi
59+
- name: Create artifact
60+
uses: actions/upload-artifact@v2
61+
with:
62+
name: BeamAdapter_${{ steps.sofa.outputs.run_branch }}_for-SOFA-${{ steps.sofa.outputs.sofa_version }}_${{ runner.os }}
63+
path: ${{ env.WORKSPACE_INSTALL_PATH }}
64+
65+
- name: Install artifact
66+
uses: actions/download-artifact@v2
67+
with:
68+
name: BeamAdapter_${{ steps.sofa.outputs.run_branch }}_for-SOFA-${{ steps.sofa.outputs.sofa_version }}_${{ runner.os }}
69+
path: ${{ env.WORKSPACE_ARTIFACT_PATH }}
70+
71+
#- name: Check environment for tests
72+
# shell: bash
73+
# run: |
74+
# echo '------ ls -la "$WORKSPACE_SRC_PATH" ------'
75+
# ls -la "$WORKSPACE_SRC_PATH"
76+
# echo '------ ls -la "$WORKSPACE_BUILD_PATH" ------'
77+
# ls -la "$WORKSPACE_BUILD_PATH"
78+
# echo '------ ls -la "$WORKSPACE_INSTALL_PATH" ------'
79+
# ls -la "$WORKSPACE_INSTALL_PATH"
80+
# echo '------ ls -la "$WORKSPACE_ARTIFACT_PATH" ------'
81+
# ls -la "$WORKSPACE_ARTIFACT_PATH"
82+
# echo '----------------------'
83+
# echo "SOFA_ROOT = $SOFA_ROOT"
84+
85+
- name: Run BeamAdapter_test
86+
if: always()
87+
shell: bash
88+
run: |
89+
chmod +x $WORKSPACE_BUILD_PATH/bin/BeamAdapter_test${{ steps.sofa.outputs.exe }}
90+
cd $WORKSPACE_BUILD_PATH
91+
./bin/BeamAdapter_test${{ steps.sofa.outputs.exe }}
92+
93+
94+
deploy:
95+
name: Deploy artifacts
96+
if: always() && startsWith(github.ref, 'refs/heads/') # we are on a branch (not a PR)
97+
needs: [build-and-test]
98+
runs-on: ubuntu-latest
99+
continue-on-error: true
100+
steps:
101+
- name: Get artifacts
102+
uses: actions/download-artifact@v2
103+
with:
104+
path: artifacts
105+
106+
- name: Zip artifacts
107+
shell: bash
108+
run: |
109+
cd $GITHUB_WORKSPACE/artifacts
110+
for artifact in *; do
111+
zip $artifact.zip -r $artifact/*
112+
done
113+
- name: Upload release
114+
uses: softprops/action-gh-release@v1
115+
with:
116+
name: ${{ github.ref_name }}
117+
tag_name: release-${{ github.ref_name }}
118+
fail_on_unmatched_files: true
119+
files: |
120+
artifacts/BeamAdapter_*_Linux.zip
121+
artifacts/BeamAdapter_*_Windows.zip
122+
artifacts/BeamAdapter_*_macOS.zip

BeamAdapterConfig.cmake.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@
33
@PACKAGE_INIT@
44

55
find_package(SofaFramework REQUIRED)
6+
find_package(SofaBaseMechanics REQUIRED)
7+
find_package(SofaConstraint REQUIRED)
8+
find_package(SofaUserInteraction REQUIRED)
69
find_package(SofaImplicitField REQUIRED)
10+
find_package(Sofa.GL REQUIRED)
11+
12+
find_package(SofaImplicitField QUIET)
713
find_package(SofaAdvancedConstraint QUIET)
814

915

BeamAdapter_test/BeamInterpolation_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ struct BeamInterpolationTest : public sofa::testing::BaseSimulationTest,
7272
"<Node name='Root' gravity='0 0 0' time='0' animate='0'>"
7373
" <RequiredPlugin name='SofaBaseLinearSolver' />"
7474
" <RequiredPlugin name='SofaImplicitOdeSolver' />"
75-
" <EulerImplicit rayleighStiffness='0.08' rayleighMass='0.08' printLog='false' />"
75+
" <EulerImplicitSolver rayleighStiffness='0.08' rayleighMass='0.08' printLog='false' />"
7676
" <CGLinearSolver iterations='100' threshold='1e-10' tolerance='1e-15' />"
7777
" $line1"
7878
" <BeamInterpolation template='Rigid3d' name='Interpol' radius='0.1'/>"

BeamAdapter_test/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ cmake_minimum_required(VERSION 3.1)
22

33
project(BeamAdapter_test VERSION 1.0)
44

5-
find_package(BeamAdapter REQUIRED)
5+
#find_package(BeamAdapter REQUIRED)
66
find_package(Sofa.Testing REQUIRED)
77
find_package(SofaBaseUtils REQUIRED)
8+
find_package(Threads REQUIRED)
89

910
set(SOURCE_FILES
1011
BeamInterpolation_test.cpp
11-
WireBeamInterpolation_test.cpp
1212
component/constraint/AdaptiveBeamSlidingConstraintTest.cpp
1313
component/forcefield/AdaptiveBeamForceFieldAndMassTest.cpp
1414
)
@@ -17,7 +17,7 @@ add_executable(${PROJECT_NAME} ${SOURCE_FILES})
1717

1818
target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>")
1919

20-
target_link_libraries(${PROJECT_NAME} BeamAdapter Sofa.Testing SofaCore SofaConstraint SofaBaseMechanics SofaUserInteraction SofaBaseUtils)
20+
target_link_libraries(${PROJECT_NAME} BeamAdapter Sofa.Testing SofaCore SofaConstraint SofaBaseMechanics SofaUserInteraction SofaBaseUtils Threads::Threads)
2121

2222
add_definitions("-DBEAMADAPTER_TEST_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}/\"")
2323

BeamAdapter_test/WireBeamInterpolation_test.cpp

Lines changed: 0 additions & 148 deletions
This file was deleted.

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ project(BeamAdapter VERSION 1.0)
44
include(cmake/environment.cmake)
55

66
find_package(SofaFramework REQUIRED)
7+
find_package(SofaBaseMechanics REQUIRED)
8+
find_package(SofaConstraint REQUIRED)
9+
find_package(SofaUserInteraction REQUIRED)
10+
find_package(SofaImplicitField REQUIRED)
11+
find_package(Sofa.GL REQUIRED)
12+
713
find_package(SofaImplicitField QUIET)
814
find_package(SofaAdvancedConstraint QUIET)
915

@@ -118,6 +124,7 @@ target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_BIN
118124
target_include_directories(${PROJECT_NAME} PUBLIC "$<INSTALL_INTERFACE:include>")
119125

120126
target_link_libraries(${PROJECT_NAME} Sofa.Helper Sofa.Core SofaConstraint SofaBaseMechanics SofaUserInteraction SofaImplicitField Sofa.GL)
127+
121128
sofa_create_package_with_targets(
122129
PACKAGE_NAME ${PROJECT_NAME}
123130
PACKAGE_VERSION ${PROJECT_VERSION}

0 commit comments

Comments
 (0)