Skip to content

Commit 8800fa6

Browse files
authored
Merge branch 'master' into 2025_sprintsed_basemapping
2 parents fcedf65 + 80ceb0c commit 8800fa6

1 file changed

Lines changed: 46 additions & 27 deletions

File tree

.github/workflows/ci.yml

Lines changed: 46 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ jobs:
4141
path: ${{ env.WORKSPACE_SRC_PATH }}
4242

4343
- name: Build and install
44+
id: build-and-install
4445
shell: bash
4546
run: |
4647
if [[ "$RUNNER_OS" == "Windows" ]]; then
@@ -51,6 +52,7 @@ jobs:
5152
-DCMAKE_PREFIX_PATH="$SOFA_ROOT/lib/cmake" \
5253
-DCMAKE_BUILD_TYPE=Release \
5354
-DCMAKE_INSTALL_PREFIX="$WORKSPACE_INSTALL_PATH" \
55+
-DPLUGINEXAMPLE_BUILD_TESTS=ON \
5456
../src \
5557
&& ninja -v install"
5658
else
@@ -63,6 +65,7 @@ jobs:
6365
-DCMAKE_PREFIX_PATH=$SOFA_ROOT/lib/cmake \
6466
-DCMAKE_BUILD_TYPE=Release \
6567
-DCMAKE_INSTALL_PREFIX="$WORKSPACE_INSTALL_PATH" \
68+
-DPLUGINEXAMPLE_BUILD_TESTS=ON \
6669
../src
6770
ninja -v install
6871
echo ${CCACHE_BASEDIR}
@@ -82,49 +85,65 @@ jobs:
8285
echo "artifact_name=$artifact_name" >> $env:GITHUB_OUTPUT
8386
8487
- name: Create artifact
88+
id: create-artifact
8589
uses: actions/upload-artifact@v4.4.0
8690
with:
8791
name: ${{ steps.sanitize.outputs.artifact_name }}
8892
path: ${{ env.WORKSPACE_INSTALL_PATH }}
8993

9094
- name: Install artifact
95+
id: install-artifact
9196
uses: actions/download-artifact@v4.1.7
9297
with:
9398
name: ${{ steps.sanitize.outputs.artifact_name }}
9499
path: ${{ env.WORKSPACE_ARTIFACT_PATH }}
95100

96-
- name: Set env vars for tests
101+
- name: Pepare python environement for tests
97102
shell: bash
98103
run: |
99-
# Set env vars for tests
100-
if [[ "$RUNNER_OS" == "Windows" ]]; then
101-
echo "$(cd $WORKSPACE_ARTIFACT_PATH/lib && pwd -W)" >> $GITHUB_PATH
102-
echo "$(cd $WORKSPACE_ARTIFACT_PATH/bin && pwd -W)" >> $GITHUB_PATH
103-
elif [[ "$RUNNER_OS" == "macOS" ]]; then
104-
echo "DYLD_LIBRARY_PATH=$WORKSPACE_ARTIFACT_PATH/lib:$SOFA_ROOT/lib:$DYLD_LIBRARY_PATH" | tee -a $GITHUB_ENV
105-
fi
106-
echo "LD_LIBRARY_PATH=$WORKSPACE_ARTIFACT_PATH/lib:$SOFA_ROOT/lib:$LD_LIBRARY_PATH" | tee -a $GITHUB_ENV
107-
# Add execution right on the tests
108-
chmod +x $WORKSPACE_BUILD_PATH/PluginExample_test/PluginExample_test${{ steps.sofa.outputs.exe }}
109-
110-
- name: Check environment for tests
111-
shell: bash
112-
run: |
113-
echo '------ ls -la "$WORKSPACE_SRC_PATH" ------'
114-
ls -la "$WORKSPACE_SRC_PATH"
115-
echo '------ ls -la "$WORKSPACE_BUILD_PATH" ------'
116-
ls -la "$WORKSPACE_BUILD_PATH"
117-
echo '------ ls -la "$WORKSPACE_INSTALL_PATH" ------'
118-
ls -la "$WORKSPACE_INSTALL_PATH"
119-
echo '------ ls -la "$WORKSPACE_ARTIFACT_PATH" ------'
120-
ls -la "$WORKSPACE_ARTIFACT_PATH"
104+
${{ steps.sofa.outputs.python_exe }} -m pip install matplotlib
121105
122-
- name: Run test PluginExample_test
123-
if: always()
106+
- name: Launch test
107+
id: tests
108+
uses: sofa-framework/sofa-test-action@v1.0
109+
with:
110+
sofa_root: ${{ github.workspace }}/sofa
111+
sofa_version: ${{ steps.sofa.outputs.sofa_version }}
112+
src_dir: ${{ env.WORKSPACE_SRC_PATH }}
113+
build_dir: ${{ env.WORKSPACE_BUILD_PATH }}
114+
python_exe: ${{ steps.sofa.outputs.python_exe }}
115+
output_dir: ${{ github.workspace }}/tests-results_dir
116+
nb_parallel_threads: '4'
117+
118+
- name: Notify dashboard
119+
if: always() && startsWith(github.repository, 'sofa-framework') && startsWith(github.ref, 'refs/heads/master') # we are not on a fork and on master
120+
env:
121+
DASH_AUTH: ${{ secrets.PLUGIN_DASH }}
124122
shell: bash
125123
run: |
126-
cd $WORKSPACE_BUILD_PATH
127-
./PluginExample_test/PluginExample_test${{ steps.sofa.outputs.exe }}
124+
os=$(echo "${{ matrix.os }}" | awk -F- '{ print $1 }')
125+
126+
test_status=$([ '${{ steps.tests.outcome }}' == 'success' ] && \
127+
echo 'true' || echo 'false')
128+
129+
build_status=$([ '${{ steps.build-and-install.outcome }}' == 'success' ] && \
130+
echo 'true' || echo 'false')
131+
132+
binary_status=$([ '${{ steps.create-artifact.outcome }}' == 'success' ] && \
133+
[ '${{ steps.install-artifact.outcome }}' == 'success' ] && \
134+
[ '${{ steps.sanitize.outcome }}' == 'success' ] && \
135+
echo 'true' || echo 'false')
136+
137+
138+
curl -X POST -H "X-API-KEY: $DASH_AUTH" -H "Content-Type: application/json" -d \
139+
"{\"id\":\"$(echo "${{ github.repository }}" | awk -F/ '{ print $2 }')\",\
140+
\"github_ref\":\"${{ github.sha }}\",\
141+
\"url\":\"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\",\
142+
\"os\":\"$os\",\
143+
\"build\":$build_status,\
144+
\"tests\":$test_status,\
145+
\"binary\":$binary_status}"\
146+
https://sofa-framework.org:5000/api/v1/plugins
128147
129148
deploy:
130149
name: Deploy artifacts

0 commit comments

Comments
 (0)