55 branches :
66 - main
77 - master
8-
98 tags :
10- - ' v*' # release tags in format of 'v25.12.00' for example
9+ - ' v*'
1110
1211 pull_request :
1312 types : [opened, synchronize, reopened, labeled]
1413
14+ workflow_dispatch :
15+ inputs :
16+ full_build :
17+ description : " Run full build (including macOS)"
18+ required : false
19+ default : false
20+ type : boolean
21+
22+
1523jobs :
1624 build-and-test :
1725 name : Run on ${{ matrix.os }} with SOFA ${{ matrix.sofa_branch }} / MeshRefinement=${{ matrix.with_mesh_refinement }}
26+
1827 if : >
1928 github.event_name == 'push' ||
2029 (
2130 github.event_name == 'pull_request' &&
22- (
23- contains(github.event.pull_request.labels.*.name, 'pr: run ci') &&
24- (
25- github.event.action != 'labeled' ||
26- github.event.label.name == 'pr: run ci'
27- )
28- )
29- )
31+ contains(github.event.pull_request.labels.*.name, 'pr: run ci')
32+ ) ||
33+ github.event_name == 'workflow_dispatch' ||
34+ startsWith(github.ref, 'refs/tags/')
3035
3136 runs-on : ${{ matrix.os }}
3237
3338 strategy :
3439 fail-fast : false
40+
3541 matrix :
36- os : [ubuntu-22.04, macos-14, windows-2022]
42+ os : ${{ fromJSON(
43+ github.event_name == 'pull_request' ||
44+ (github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/')) ?
45+ ' ["ubuntu-22.04","windows-2022"]' :
46+ ' ["ubuntu-22.04","windows-2022","macos-14"]'
47+ ) }}
48+
3749 sofa_branch : [master]
3850 with_mesh_refinement : [ON, OFF]
3951
5668 repository : InfinyTech3D/MeshRefinement
5769 token : ${{ secrets.MESH_REFINEMENT_DEPLOY_KEY }}
5870
59- # ############## Build and install MeshRefinement only if enabled ##############
71+ # ############## Build and install MeshRefinement ##############
6072 - name : Build and install MeshRefinement
6173 if : matrix.with_mesh_refinement == 'ON'
6274 shell : bash
@@ -66,16 +78,15 @@ jobs:
6678 if [[ "$RUNNER_OS" == "Windows" ]]; then
6779 cmd //c "${{ steps.sofa.outputs.vs_vsdevcmd }} \
6880 && cd /d %GITHUB_WORKSPACE%/deps/MeshRefinement/build \
69- && cmake \
70- -GNinja \
81+ && cmake -GNinja \
7182 -DCMAKE_PREFIX_PATH=$SOFA_ROOT/lib/cmake \
7283 -DCMAKE_BUILD_TYPE=Release \
7384 -DCMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%/deps/MeshRefinement/install \
7485 .. \
7586 && ninja install"
76- # Temp hack
87+
7788 cp deps/MeshRefinement/install/bin/MeshRefinement.dll "$WORKSPACE_BUILD_PATH/"
78-
89+
7990 else
8091 cd deps/MeshRefinement/build
8192 cmake \
@@ -92,17 +103,16 @@ jobs:
92103 - name : Checkout current source code
93104 uses : actions/checkout@v4
94105 with :
95- path : ${{ env.WORKSPACE_SRC_PATH }}
96-
97- # ############### Build and install current plugin ##############
106+ path : ${{ env.WORKSPACE_SRC_PATH }}
107+
108+ # ############### Build and install plugin ##############
98109 - name : Build and install
99110 shell : bash
100111 run : |
101112 if [[ "$RUNNER_OS" == "Windows" ]]; then
102113 cmd //c "${{ steps.sofa.outputs.vs_vsdevcmd }} \
103114 && cd /d %GITHUB_WORKSPACE%/build \
104- && cmake \
105- -GNinja \
115+ && cmake -GNinja \
106116 -DCMAKE_PREFIX_PATH=%SOFA_ROOT%/lib/cmake;%GITHUB_WORKSPACE%/deps/MeshRefinement/install \
107117 -DCMAKE_BUILD_TYPE=Release \
108118 -DCMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%/install \
@@ -122,16 +132,12 @@ jobs:
122132 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY="$WORKSPACE_BUILD_PATH/lib" \
123133 ../src
124134 ninja install
125- echo ${CCACHE_BASEDIR}
126135 ccache -s
127136 fi
128-
137+
138+ # ################## Artifact naming ##############
129139 - name : Sanitize artifact name
130140 id : sanitize
131- # This step removes special characters from the artifact name to ensure compatibility with upload-artifact
132- # Characters removed: " : < > | * ? \r \n \ /
133- # Spaces are replaced with underscores
134- # This sanitization prevents errors in artifact creation and retrieval
135141 shell : pwsh
136142 run : |
137143 if ("${{ matrix.with_mesh_refinement }}" -eq "ON") {
@@ -140,28 +146,20 @@ jobs:
140146 else {
141147 $dependency = "standalone"
142148 }
143-
144- $originalName = "InfinyToolkit_${dependency}_${{ steps.sofa.outputs.run_branch }}_for-SOFA -${{ steps.sofa.outputs.sofa_version }}_${{ runner.os }}"
149+
150+ $originalName = "InfinyToolkit_${dependency}_${{ steps.sofa.outputs.run_branch }}_SOFA -${{ steps.sofa.outputs.sofa_version }}_${{ runner.os }}"
145151 $artifact_name = $originalName -replace '[":;<>|*?\r\n\\/]', '' -replace ' ', '_'
146152 echo "artifact_name=$artifact_name" >> $env:GITHUB_OUTPUT
147-
148- # ################## Create and upload artifact ##############
153+
154+ # ################## Upload artifact ##############
149155 - name : Create artifact
150- id : create-artifact
151156 uses : actions/upload-artifact@v4.4.0
152157 with :
153158 name : ${{ steps.sanitize.outputs.artifact_name }}
154159 path : ${{ env.WORKSPACE_INSTALL_PATH }}
155160
156- - name : Install artifact
157- uses : actions/download-artifact@v4.1.7
158- with :
159- name : ${{ steps.sanitize.outputs.artifact_name }}
160- path : ${{ env.WORKSPACE_ARTIFACT_PATH }}
161-
162-
163- - name : Launch test
164- id : tests
161+ # ################## Tests ##############
162+ - name : Launch test
165163 uses : sofa-framework/sofa-test-action@v1.0
166164 with :
167165 sofa_root : ${{ github.workspace }}/sofa
@@ -173,13 +171,13 @@ jobs:
173171 nb_parallel_threads : ' 4'
174172
175173
176-
177174 deploy :
178175 name : Deploy artifacts
179- if : always() && startsWith(github.ref, 'refs/tags/')
176+ if : startsWith(github.ref, 'refs/tags/v ')
180177 needs : [build-and-test]
181178 runs-on : ubuntu-latest
182179 continue-on-error : true
180+
183181 steps :
184182 - name : Get artifacts
185183 uses : actions/download-artifact@v4.1.7
@@ -193,6 +191,7 @@ jobs:
193191 for artifact in *; do
194192 zip $artifact.zip -r $artifact/*
195193 done
194+
196195 - name : Upload release
197196 uses : softprops/action-gh-release@v1
198197 with :
@@ -203,5 +202,4 @@ jobs:
203202 files : |
204203 artifacts/InfinyToolkit_*_Linux.zip
205204 artifacts/InfinyToolkit_*_Windows.zip
206- artifacts/InfinyToolkit_*_macOS.zip
207-
205+ artifacts/InfinyToolkit_*_macOS.zip
0 commit comments