From b54368c2819bdfb6c886926093caf52a1d58688b Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Mon, 9 Mar 2026 18:04:08 +0100 Subject: [PATCH 1/3] Add sofa-test-action --- .github/workflows/ci.yml | 45 +++++++++++++--------------------------- 1 file changed, 14 insertions(+), 31 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e49925f..c85d5f3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -96,39 +96,22 @@ jobs: name: ${{ steps.sanitize.outputs.artifact_name }} path: ${{ env.WORKSPACE_ARTIFACT_PATH }} - - name: Set env vars for tests + - name: Pepare python environement for tests shell: bash run: | - # Set env vars for tests - if [[ "$RUNNER_OS" == "Windows" ]]; then - echo "$(cd $WORKSPACE_ARTIFACT_PATH/lib && pwd -W)" >> $GITHUB_PATH - echo "$(cd $WORKSPACE_ARTIFACT_PATH/bin && pwd -W)" >> $GITHUB_PATH - elif [[ "$RUNNER_OS" == "macOS" ]]; then - echo "DYLD_LIBRARY_PATH=$WORKSPACE_ARTIFACT_PATH/lib:$SOFA_ROOT/lib:$DYLD_LIBRARY_PATH" | tee -a $GITHUB_ENV - fi - echo "LD_LIBRARY_PATH=$WORKSPACE_ARTIFACT_PATH/lib:$SOFA_ROOT/lib:$LD_LIBRARY_PATH" | tee -a $GITHUB_ENV - # Add execution right on the tests - chmod +x $WORKSPACE_BUILD_PATH/PluginExample_test/PluginExample_test${{ steps.sofa.outputs.exe }} - - - name: Check environment for tests - shell: bash - run: | - echo '------ ls -la "$WORKSPACE_SRC_PATH" ------' - ls -la "$WORKSPACE_SRC_PATH" - echo '------ ls -la "$WORKSPACE_BUILD_PATH" ------' - ls -la "$WORKSPACE_BUILD_PATH" - echo '------ ls -la "$WORKSPACE_INSTALL_PATH" ------' - ls -la "$WORKSPACE_INSTALL_PATH" - echo '------ ls -la "$WORKSPACE_ARTIFACT_PATH" ------' - ls -la "$WORKSPACE_ARTIFACT_PATH" + ${{ steps.sofa.outputs.python_exe }} -m pip install matplotlib - - name: Run test PluginExample_test - id: unit-tests - if: always() - shell: bash - run: | - cd $WORKSPACE_BUILD_PATH - ./PluginExample_test/PluginExample_test${{ steps.sofa.outputs.exe }} + - name: Launch test + id: tests + uses: sofa-framework/sofa-test-action@v1.0 + with: + sofa_root: ${{ github.workspace }}/sofa + sofa_version: ${{ steps.sofa.outputs.sofa_version }} + src_dir: ${{ env.WORKSPACE_SRC_PATH }} + build_dir: ${{ env.WORKSPACE_BUILD_PATH }} + python_exe: ${{ steps.sofa.outputs.python_exe }} + output_dir: ${{ github.workspace }}/tests-results_dir + nb_parallel_threads: '4'} - name: Notify dashboard if: always() && startsWith(github.repository, 'sofa-framework') && startsWith(github.ref, 'refs/heads/master') # we are not on a fork and on master @@ -138,7 +121,7 @@ jobs: run: | os=$(echo "${{ matrix.os }}" | awk -F- '{ print $1 }') - test_status=$([ '${{ steps.unit-tests.outcome }}' == 'success' ] && \ + test_status=$([ '${{ steps.tests.outcome }}' == 'success' ] && \ echo 'true' || echo 'false') build_status=$([ '${{ steps.build-and-install.outcome }}' == 'success' ] && \ From c4b24da48b7716a636fd843c0de7b2fd904135d6 Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Mon, 9 Mar 2026 18:05:40 +0100 Subject: [PATCH 2/3] Fix typo --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c85d5f3..09e56de 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -111,7 +111,7 @@ jobs: build_dir: ${{ env.WORKSPACE_BUILD_PATH }} python_exe: ${{ steps.sofa.outputs.python_exe }} output_dir: ${{ github.workspace }}/tests-results_dir - nb_parallel_threads: '4'} + nb_parallel_threads: '4' - name: Notify dashboard if: always() && startsWith(github.repository, 'sofa-framework') && startsWith(github.ref, 'refs/heads/master') # we are not on a fork and on master From ae1a2c6e21b996621767c53c036303464116ef4d Mon Sep 17 00:00:00 2001 From: Paul Baksic <30337881+bakpaul@users.noreply.github.com> Date: Tue, 10 Mar 2026 09:58:35 +0100 Subject: [PATCH 3/3] Update ci.yml --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 09e56de..fca5087 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,6 +52,7 @@ jobs: -DCMAKE_PREFIX_PATH="$SOFA_ROOT/lib/cmake" \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX="$WORKSPACE_INSTALL_PATH" \ + -DPLUGINEXAMPLE_BUILD_TESTS=ON \ ../src \ && ninja -v install" else @@ -64,6 +65,7 @@ jobs: -DCMAKE_PREFIX_PATH=$SOFA_ROOT/lib/cmake \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX="$WORKSPACE_INSTALL_PATH" \ + -DPLUGINEXAMPLE_BUILD_TESTS=ON \ ../src ninja -v install echo ${CCACHE_BASEDIR}