66 - main
77 - master
88
9+ tags :
10+ - ' v*' # release tags in format of 'v25.12.00' for example
11+
912 pull_request :
1013 types : [opened, synchronize, reopened, labeled]
1114
1215jobs :
1316 build-and-test :
14- name : Run on ${{ matrix.os }} with SOFA ${{ matrix.sofa_branch }}
17+ name : Run on ${{ matrix.os }} with SOFA ${{ matrix.sofa_branch }} / MeshRefinement=${{ matrix.with_mesh_refinement }}
1518 if : >
1619 github.event_name == 'push' ||
1720 (
@@ -24,14 +27,18 @@ jobs:
2427 )
2528 )
2629 )
30+
2731 runs-on : ${{ matrix.os }}
32+
2833 strategy :
2934 fail-fast : false
3035 matrix :
31- os : [ubuntu-22.04] # [ubuntu-22.04 , macos-14, windows-2022]
36+ os : [ubuntu-22.04, macos-14, windows-2022]
3237 sofa_branch : [master]
38+ with_mesh_refinement : [ON, OFF]
3339
3440 steps :
41+ # ###################### Setup SOFA #######################
3542 - name : Setup SOFA and environment
3643 id : sofa
3744 uses : sofa-framework/sofa-setup-action@v5
@@ -40,17 +47,22 @@ jobs:
4047 sofa_version : ${{ matrix.sofa_branch }}
4148 sofa_scope : ' full'
4249
50+ # ############# Checkout MeshRefinement only if enabled ##############
4351 - name : Checkout MeshRefinement source code
52+ if : matrix.with_mesh_refinement == 'ON'
4453 uses : actions/checkout@v4
4554 with :
4655 path : deps/MeshRefinement
4756 repository : InfinyTech3D/MeshRefinement
4857 token : ${{ secrets.MESH_REFINEMENT_DEPLOY_KEY }}
4958
59+ # ############## Build and install MeshRefinement only if enabled ##############
5060 - name : Build and install MeshRefinement
61+ if : matrix.with_mesh_refinement == 'ON'
5162 shell : bash
5263 run : |
5364 mkdir -p deps/MeshRefinement/build
65+
5466 if [[ "$RUNNER_OS" == "Windows" ]]; then
5567 cmd //c "${{ steps.sofa.outputs.vs_vsdevcmd }} \
5668 && cd /d %GITHUB_WORKSPACE%/deps/MeshRefinement/build \
6375 && ninja install"
6476 # Temp hack
6577 cp deps/MeshRefinement/install/bin/MeshRefinement.dll "$WORKSPACE_BUILD_PATH/"
78+
6679 else
6780 cd deps/MeshRefinement/build
6881 cmake \
@@ -75,36 +88,44 @@ jobs:
7588 ninja install
7689 fi
7790
78- - name : Checkout source code
91+ # ################ Checkout current repository ##############
92+ - name : Checkout current source code
7993 uses : actions/checkout@v4
8094 with :
8195 path : ${{ env.WORKSPACE_SRC_PATH }}
8296
97+ # ############### Build and install current plugin ##############
8398 - name : Build and install
8499 id : build-install
85100 shell : bash
86101 run : |
102+
103+ ### Configure dependency on MeshRefinement if enabled
104+ if [[ "${{ matrix.with_mesh_refinement }}" == "ON" ]]; then
105+ EXTRA_PREFIX_PATH=";$GITHUB_WORKSPACE/deps/MeshRefinement/install"
106+ else
107+ EXTRA_PREFIX_PATH=""
108+ fi
109+
87110 if [[ "$RUNNER_OS" == "Windows" ]]; then
88111 cmd //c "${{ steps.sofa.outputs.vs_vsdevcmd }} \
89112 && cd /d $WORKSPACE_BUILD_PATH \
90113 && cmake \
91114 -GNinja \
92- -DCMAKE_PREFIX_PATH="$SOFA_ROOT/lib/cmake;$GITHUB_WORKSPACE/deps/MeshRefinement/install " \
115+ -DCMAKE_PREFIX_PATH="$SOFA_ROOT/lib/cmake%EXTRA_PREFIX_PATH% " \
93116 -DCMAKE_BUILD_TYPE=Release \
94117 -DCMAKE_INSTALL_PREFIX="$WORKSPACE_INSTALL_PATH" \
95118 -DCMAKE_RUNTIME_OUTPUT_DIRECTORY="$WORKSPACE_BUILD_PATH" \
96119 ../src \
97120 && ninja install"
98121 else
99122 cd "$WORKSPACE_BUILD_PATH"
100- echo "BUILDpATH : $WORKSPACE_BUILD_PATH"
101- echo "test : %GITHUB_WORKSPACE%/deps/MeshRefinement/install/lib/cmake"
102123 ccache -z
103124 cmake \
104125 -GNinja \
105126 -DCMAKE_C_COMPILER_LAUNCHER=ccache \
106127 -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
107- -DCMAKE_PREFIX_PATH="$SOFA_ROOT/lib/cmake;$GITHUB_WORKSPACE/deps/MeshRefinement/install " \
128+ -DCMAKE_PREFIX_PATH="$SOFA_ROOT/lib/cmake%EXTRA_PREFIX_PATH% " \
108129 -DCMAKE_BUILD_TYPE=Release \
109130 -DCMAKE_INSTALL_PREFIX="$WORKSPACE_INSTALL_PATH" \
110131 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY="$WORKSPACE_BUILD_PATH/lib" \
@@ -122,10 +143,18 @@ jobs:
122143 # This sanitization prevents errors in artifact creation and retrieval
123144 shell : pwsh
124145 run : |
125- $originalName = "InfinyToolkit_${{ steps.sofa.outputs.run_branch }}_for-SOFA-${{ steps.sofa.outputs.sofa_version }}_${{ runner.os }}"
146+ if ("${{ matrix.with_mesh_refinement }}" -eq "ON") {
147+ $dependency = "with_meshrefinement"
148+ }
149+ else {
150+ $dependency = "standalone"
151+ }
152+
153+ $originalName = "InfinyToolkit_${dependency}_${{ steps.sofa.outputs.run_branch }}_for-SOFA-${{ steps.sofa.outputs.sofa_version }}_${{ runner.os }}"
126154 $artifact_name = $originalName -replace '[":;<>|*?\r\n\\/]', '' -replace ' ', '_'
127155 echo "artifact_name=$artifact_name" >> $env:GITHUB_OUTPUT
128-
156+
157+ # ################## Create and upload artifact ##############
129158 - name : Create artifact
130159 id : create-artifact
131160 uses : actions/upload-artifact@v4.4.0
@@ -152,6 +181,8 @@ jobs:
152181 output_dir : ${{ github.workspace }}/tests-results_dir
153182 nb_parallel_threads : ' 4'
154183
184+
185+
155186 deploy :
156187 name : Deploy artifacts
157188 if : always() && startsWith(github.ref, 'refs/tags/')
0 commit comments