Skip to content

Commit 913ee91

Browse files
authored
Use sofa-test-action in github action (#599)
* Use sofa-test-action in github action * Update ci.yml
1 parent 12ef8b7 commit 913ee91

1 file changed

Lines changed: 17 additions & 69 deletions

File tree

.github/workflows/ci.yml

Lines changed: 17 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -136,85 +136,33 @@ jobs:
136136
name: ${{ env.ARTIFACT_NAME }}
137137
path: ${{ env.WORKSPACE_ARTIFACT_PATH }}
138138

139-
- name: Set env vars for tests
139+
- name: Pepare python environement for tests
140140
shell: bash
141141
run: |
142-
# Set env vars for tests
143-
if [[ "$RUNNER_OS" == "Windows" ]]; then
144-
echo "$WORKSPACE_ARTIFACT_PATH/lib" >> $GITHUB_PATH
145-
echo "$WORKSPACE_ARTIFACT_PATH/bin" >> $GITHUB_PATH
146-
elif [[ "$RUNNER_OS" == "macOS" ]]; then
147-
echo "SOFA_PLUGIN_PATH=$WORKSPACE_ARTIFACT_PATH/lib" | tee -a $GITHUB_ENV
148-
echo "DYLD_LIBRARY_PATH=$WORKSPACE_ARTIFACT_PATH/lib:$SOFA_ROOT/lib:$DYLD_LIBRARY_PATH" | tee -a $GITHUB_ENV
149-
else # Linux
150-
echo "SOFA_PLUGIN_PATH=$WORKSPACE_ARTIFACT_PATH/lib" | tee -a $GITHUB_ENV
151-
echo "LD_LIBRARY_PATH=$WORKSPACE_ARTIFACT_PATH/lib:$SOFA_ROOT/lib:$LD_LIBRARY_PATH" | tee -a $GITHUB_ENV
152-
fi
153-
echo "PYTHONPATH=$WORKSPACE_ARTIFACT_PATH/lib/python3/site-packages" | tee -a $GITHUB_ENV
154-
# Add execution right on the tests
155-
chmod +x $WORKSPACE_ARTIFACT_PATH/bin/*.Tests${{ steps.sofa.outputs.exe }}
156-
157-
- name: Check environment for tests
158-
shell: bash
159-
run: |
160-
echo '------ ls -la "$WORKSPACE_SRC_PATH" ------'
161-
ls -la "$WORKSPACE_SRC_PATH"
162-
echo '------ ls -la "$WORKSPACE_BUILD_PATH" ------'
163-
ls -la "$WORKSPACE_BUILD_PATH"
164-
echo '------ ls -la "$WORKSPACE_INSTALL_PATH" ------'
165-
ls -la "$WORKSPACE_INSTALL_PATH"
166-
echo '------ ls -la "$WORKSPACE_ARTIFACT_PATH" ------'
167-
ls -la "$WORKSPACE_ARTIFACT_PATH"
168-
echo '----------------------'
169-
echo "SOFA_ROOT = $SOFA_ROOT"
170-
echo "PYTHONPATH = $PYTHONPATH"
171-
echo '----------------------'
172-
echo "PATH = $PATH"
173-
echo '----------------------'
174-
python -c "import sys; print('sys.version = ' + str(sys.version)); print('sys.path = ' + str(sys.path))"
142+
${{ steps.sofa.outputs.python_exe }} -m pip install rpyc matplotlib
143+
144+
echo "PYTHONPATH=${{ env.WORKSPACE_BUILD_PATH }}/lib/python3/site-packages" | tee -a $GITHUB_ENV
175145
176-
- name: Run test Binding.Sofa.Tests
177-
id: test-sofa
178-
if: always()
179-
shell: bash
180-
run: |
181-
cd $WORKSPACE_ARTIFACT_PATH
182-
./bin/Bindings.Sofa.Tests${{ steps.sofa.outputs.exe }}
183-
184-
- name: Run test Bindings.SofaRuntime.Tests
185-
id: test-sofaruntime
186-
if: always()
187-
shell: bash
188-
run: |
189-
cd $WORKSPACE_ARTIFACT_PATH
190-
./bin/Bindings.SofaRuntime.Tests${{ steps.sofa.outputs.exe }}
191-
192-
- name: Run test Bindings.SofaTypes.Tests
193-
id: test-sofatypes
194-
if: always()
195-
shell: bash
196-
run: |
197-
cd $WORKSPACE_ARTIFACT_PATH
198-
./bin/Bindings.SofaTypes.Tests${{ steps.sofa.outputs.exe }}
199-
200-
- name: Run test Bindings.Modules.Tests
201-
id: test-sofamodules
202-
if: always()
203-
shell: bash
204-
run: |
205-
cd $WORKSPACE_ARTIFACT_PATH
206-
./bin/Bindings.Modules.Tests${{ steps.sofa.outputs.exe }}
146+
147+
- name: Launch test
148+
id: tests
149+
uses: sofa-framework/sofa-test-action@v1.0
150+
with:
151+
sofa_root: ${{ github.workspace }}/sofa
152+
sofa_version: ${{ steps.sofa.outputs.sofa_version }}
153+
src_dir: ${{ env.WORKSPACE_SRC_PATH }}
154+
build_dir: ${{ env.WORKSPACE_BUILD_PATH }}
155+
python_exe: ${{ steps.sofa.outputs.python_exe }}
156+
output_dir: ${{ github.workspace }}/tests-results_dir
157+
nb_parallel_threads: '4'
207158

208159
- name: Notify dashboard
209160
if: always() && startsWith(github.repository, 'sofa-framework') && startsWith(github.ref, 'refs/heads/master') # we are not on a fork and on master
210161
env:
211162
DASH_AUTH: ${{ secrets.PLUGIN_DASH }}
212163
shell: bash
213164
run: |
214-
test_status=$([ '${{ steps.test-sofa.outcome }}' == 'success' ] && \
215-
[ '${{ steps.test-sofaruntime.outcome }}' == 'success' ] && \
216-
[ '${{ steps.test-sofatypes.outcome }}' == 'success' ] && \
217-
[ '${{ steps.test-sofamodules.outcome }}' == 'success' ] && \
165+
test_status=$([ '${{ steps.tests }}' == 'success' ] && \
218166
echo 'true' || echo 'false')
219167
220168
build_status=$([ '${{ steps.build-install.outcome }}' == 'success' ] && \

0 commit comments

Comments
 (0)