From ffa868f188b266c610de96aecf0282822b7ab16f Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Mon, 9 Mar 2026 17:55:08 +0100 Subject: [PATCH 1/6] Add sofa-test-action --- .github/workflows/ci.yml | 59 ++++++++++------------------------------ 1 file changed, 14 insertions(+), 45 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a86fe2..c1aac08 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -111,53 +111,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 - echo "$(cd $SoftRobots_ROOT/bin && pwd -W)" >> $GITHUB_PATH - echo "SOFA_PLUGIN_PATH=$SoftRobots_ROOT/lib;$WORKSPACE_ARTIFACT_PATH/lib" | tee -a $GITHUB_ENV - - else - echo "LD_LIBRARY_PATH=$SoftRobots_ROOT/lib:$WORKSPACE_ARTIFACT_PATH/lib:$SOFA_ROOT/lib:$LD_LIBRARY_PATH" | tee -a $GITHUB_ENV - echo "SOFA_PLUGIN_PATH=$SoftRobots_ROOT/lib:$WORKSPACE_ARTIFACT_PATH/lib" | tee -a $GITHUB_ENV - - if [[ "$RUNNER_OS" == "macOS" ]]; then - echo "DYLD_LIBRARY_PATH=$WORKSPACE_ARTIFACT_PATH/lib:$SOFA_ROOT/lib:$DYLD_LIBRARY_PATH" | tee -a $GITHUB_ENV - fi - fi + ${{ steps.sofa.outputs.python_exe }} -m pip install matplotlib - # Add execution right on the tests - chmod +x $WORKSPACE_BUILD_PATH/bin/*_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_BUILD_PATH/bin" ------' - ls -la "$WORKSPACE_BUILD_PATH"/bin - echo '------ ls -la "$WORKSPACE_INSTALL_PATH" ------' - ls -la "$WORKSPACE_INSTALL_PATH" - echo '------ ls -la "$WORKSPACE_ARTIFACT_PATH" ------' - ls -la "$WORKSPACE_ARTIFACT_PATH" - echo '----------------------' - echo "SOFA_ROOT = $SOFA_ROOT"= - echo '----------------------' - python -c "import sys; print('sys.version = ' + str(sys.version)); print('sys.path = ' + str(sys.path))" - - - name: Run tests - id: unit-tests - if: always() - shell: bash - run: | - cd $WORKSPACE_BUILD_PATH - ./bin/SoftRobots.Inverse_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, 'SofaDefrost') && startsWith(github.ref, 'refs/heads/main') # we are not on a fork and on main @@ -167,7 +136,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 368f3a763d7f942b0a040340d5577271d440bc62 Mon Sep 17 00:00:00 2001 From: Paul Baksic <30337881+bakpaul@users.noreply.github.com> Date: Tue, 10 Mar 2026 09:42:37 +0100 Subject: [PATCH 2/6] Download STLIB --- .github/workflows/ci.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c1aac08..34b7129 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -111,10 +111,21 @@ jobs: name: ${{ steps.sanitize.outputs.artifact_name }} path: ${{ env.WORKSPACE_ARTIFACT_PATH }} + + - name: Checkout STLIB + uses: actions/checkout@v4 + with: + repository: SofaDefrost/STLIB + ref: ${{ steps.sofa.outputs.sofa_version }} + path: STLIB # Replace with your desired target directory + + - name: Pepare python environement for tests shell: bash run: | ${{ steps.sofa.outputs.python_exe }} -m pip install matplotlib + echo "PYTHONPATH=${{ github.workspace }}/python3/src" | tee -a $GITHUB_ENV + - name: Launch test id: tests From 0528d3e2fb116ec6dc404473e3ddec9e33c4d06f Mon Sep 17 00:00:00 2001 From: Paul Baksic <30337881+bakpaul@users.noreply.github.com> Date: Tue, 10 Mar 2026 09:49:22 +0100 Subject: [PATCH 3/6] FIX STLIB in python path --- .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 34b7129..7797eba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -124,7 +124,7 @@ jobs: shell: bash run: | ${{ steps.sofa.outputs.python_exe }} -m pip install matplotlib - echo "PYTHONPATH=${{ github.workspace }}/python3/src" | tee -a $GITHUB_ENV + echo "PYTHONPATH=${{ github.workspace }}/STLIB/python3/src" | tee -a $GITHUB_ENV - name: Launch test From 23daab202ce158a4763761e25dd52cbff6bbb7d5 Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Tue, 10 Mar 2026 10:51:07 +0100 Subject: [PATCH 4/6] Prepare environmeent properly --- .github/workflows/ci.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7797eba..a19a698 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -124,7 +124,17 @@ jobs: shell: bash run: | ${{ steps.sofa.outputs.python_exe }} -m pip install matplotlib - echo "PYTHONPATH=${{ github.workspace }}/STLIB/python3/src" | tee -a $GITHUB_ENV + + ## Copy SoftRobots lib into a folder known by SOFA so the plugin can be found + if [[ "$RUNNER_OS" == "Windows" ]]; then + cp $SoftRobots_ROOT/bin/*.dll $SOFA_ROOT/bin/ + echo "PYTHONPATH=${{ github.workspace }}/STLIB/python3/src;$SoftRobots_ROOT/lib/python3/site-packages" | tee -a $GITHUB_ENV + + else + cp $SoftRobots_ROOT/lib/lib* $SOFA_ROOT/lib/ + echo "PYTHONPATH=${{ github.workspace }}/STLIB/python3/src:$SoftRobots_ROOT/lib/python3/site-packages" | tee -a $GITHUB_ENV + + fi - name: Launch test From 9cb73fc1d9d85a501bc84745aba635f9b9c15f59 Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Tue, 10 Mar 2026 10:56:50 +0100 Subject: [PATCH 5/6] Fix scene tests --- .github/workflows/ci.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a19a698..6138a19 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -129,13 +129,22 @@ jobs: if [[ "$RUNNER_OS" == "Windows" ]]; then cp $SoftRobots_ROOT/bin/*.dll $SOFA_ROOT/bin/ echo "PYTHONPATH=${{ github.workspace }}/STLIB/python3/src;$SoftRobots_ROOT/lib/python3/site-packages" | tee -a $GITHUB_ENV - else cp $SoftRobots_ROOT/lib/lib* $SOFA_ROOT/lib/ echo "PYTHONPATH=${{ github.workspace }}/STLIB/python3/src:$SoftRobots_ROOT/lib/python3/site-packages" | tee -a $GITHUB_ENV - fi + ### Deactivate some tests because the use of prefabs doesn't allow the scene test script to identify missing plugins before hands + + # Missing ArticulatedSystemPlugin + echo "ignore \"sofapython3/component/constraint/JointActuator/JointActuator.py\"" >> ${{ env.WORKSPACE_SRC_PATH }}/examples/.scene-tests + + # Missing BeamAdapter + echo "ignore \"sofapython3/component/constraint/BarycentricCenterEffector/BarycentricCenterEffector_Rigid.py\"" >> ${{ env.WORKSPACE_SRC_PATH }}/examples/.scene-tests + echo "ignore \"sofapython3/component/constraint/SlidingActuator/actuatedBeam.py\"" >> ${{ env.WORKSPACE_SRC_PATH }}/examples/.scene-tests + + + - name: Launch test id: tests From 5261e885bfc8b29502701f7cf99496c1dc83cf46 Mon Sep 17 00:00:00 2001 From: Hugo Date: Thu, 26 Mar 2026 09:54:41 +0100 Subject: [PATCH 6/6] Apply suggestions from code review Co-authored-by: Hugo --- .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 6138a19..a3d70bb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -120,7 +120,7 @@ jobs: path: STLIB # Replace with your desired target directory - - name: Pepare python environement for tests + - name: Prepare Python environment for tests shell: bash run: | ${{ steps.sofa.outputs.python_exe }} -m pip install matplotlib