Skip to content

Commit 80ceb0c

Browse files
authored
[CI] Add sofa-test-action (#22)
* Add sofa-test-action * Fix typo * Update ci.yml
1 parent 7a6475a commit 80ceb0c

File tree

1 file changed

+16
-31
lines changed

1 file changed

+16
-31
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ jobs:
5252
-DCMAKE_PREFIX_PATH="$SOFA_ROOT/lib/cmake" \
5353
-DCMAKE_BUILD_TYPE=Release \
5454
-DCMAKE_INSTALL_PREFIX="$WORKSPACE_INSTALL_PATH" \
55+
-DPLUGINEXAMPLE_BUILD_TESTS=ON \
5556
../src \
5657
&& ninja -v install"
5758
else
@@ -64,6 +65,7 @@ jobs:
6465
-DCMAKE_PREFIX_PATH=$SOFA_ROOT/lib/cmake \
6566
-DCMAKE_BUILD_TYPE=Release \
6667
-DCMAKE_INSTALL_PREFIX="$WORKSPACE_INSTALL_PATH" \
68+
-DPLUGINEXAMPLE_BUILD_TESTS=ON \
6769
../src
6870
ninja -v install
6971
echo ${CCACHE_BASEDIR}
@@ -96,39 +98,22 @@ jobs:
9698
name: ${{ steps.sanitize.outputs.artifact_name }}
9799
path: ${{ env.WORKSPACE_ARTIFACT_PATH }}
98100

99-
- name: Set env vars for tests
101+
- name: Pepare python environement for tests
100102
shell: bash
101103
run: |
102-
# Set env vars for tests
103-
if [[ "$RUNNER_OS" == "Windows" ]]; then
104-
echo "$(cd $WORKSPACE_ARTIFACT_PATH/lib && pwd -W)" >> $GITHUB_PATH
105-
echo "$(cd $WORKSPACE_ARTIFACT_PATH/bin && pwd -W)" >> $GITHUB_PATH
106-
elif [[ "$RUNNER_OS" == "macOS" ]]; then
107-
echo "DYLD_LIBRARY_PATH=$WORKSPACE_ARTIFACT_PATH/lib:$SOFA_ROOT/lib:$DYLD_LIBRARY_PATH" | tee -a $GITHUB_ENV
108-
fi
109-
echo "LD_LIBRARY_PATH=$WORKSPACE_ARTIFACT_PATH/lib:$SOFA_ROOT/lib:$LD_LIBRARY_PATH" | tee -a $GITHUB_ENV
110-
# Add execution right on the tests
111-
chmod +x $WORKSPACE_BUILD_PATH/PluginExample_test/PluginExample_test${{ steps.sofa.outputs.exe }}
112-
113-
- name: Check environment for tests
114-
shell: bash
115-
run: |
116-
echo '------ ls -la "$WORKSPACE_SRC_PATH" ------'
117-
ls -la "$WORKSPACE_SRC_PATH"
118-
echo '------ ls -la "$WORKSPACE_BUILD_PATH" ------'
119-
ls -la "$WORKSPACE_BUILD_PATH"
120-
echo '------ ls -la "$WORKSPACE_INSTALL_PATH" ------'
121-
ls -la "$WORKSPACE_INSTALL_PATH"
122-
echo '------ ls -la "$WORKSPACE_ARTIFACT_PATH" ------'
123-
ls -la "$WORKSPACE_ARTIFACT_PATH"
104+
${{ steps.sofa.outputs.python_exe }} -m pip install matplotlib
124105
125-
- name: Run test PluginExample_test
126-
id: unit-tests
127-
if: always()
128-
shell: bash
129-
run: |
130-
cd $WORKSPACE_BUILD_PATH
131-
./PluginExample_test/PluginExample_test${{ steps.sofa.outputs.exe }}
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'
132117

133118
- name: Notify dashboard
134119
if: always() && startsWith(github.repository, 'sofa-framework') && startsWith(github.ref, 'refs/heads/master') # we are not on a fork and on master
@@ -138,7 +123,7 @@ jobs:
138123
run: |
139124
os=$(echo "${{ matrix.os }}" | awk -F- '{ print $1 }')
140125
141-
test_status=$([ '${{ steps.unit-tests.outcome }}' == 'success' ] && \
126+
test_status=$([ '${{ steps.tests.outcome }}' == 'success' ] && \
142127
echo 'true' || echo 'false')
143128
144129
build_status=$([ '${{ steps.build-and-install.outcome }}' == 'success' ] && \

0 commit comments

Comments
 (0)