Skip to content

Run Tests

Run Tests #427

Workflow file for this run

name: Run Tests
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
schedule:
- cron: '0 3 * * *' # nightly job at 3 am UTC
env:
SOFA_ROOT: ${{ github.workspace }}/sofa-install
jobs:
build:
name: Build on ${{ matrix.os }} with SOFA branch ${{ matrix.sofa_branch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-14, windows-2022]
sofa_branch: [master]
steps:
- name: Checkout source code
uses: actions/checkout@v2
with:
path: ${{ env.WORKSPACE_SRC_PATH }}
- name: Download SOFA and plugins binaries
uses: SofaComplianceRobotics/emiolabs-sofa-download@v1
id: sofa-download
with:
sofa_root: $SOFA_ROOT
- name: Additional Install
shell: bash
run: |
if [[ "$RUNNER_OS" == "Linux" ]]; then
sudo apt install libopengl0
elif [[ "$RUNNER_OS" == "macOS" ]]; then
brew install glew
brew install glfw
brew install tinyxml2
fi
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Install python dependencies
shell: bash
run: |
python -m pip install -r requirements.txt
python -m pip install pytest
- name: Set env vars
shell: bash
env:
SOFTROBOTS_ROOT: ${{ steps.sofa-download.outputs.softrobots_root }}
SOFTROBOTSINVERSE_ROOT: ${{ steps.sofa-download.outputs.softrobotsinverse_root }}
SOFAGLFW_ROOT: ${{ steps.sofa-download.outputs.sofaglfw_root }}
run: |
if [[ "$RUNNER_OS" == "Windows" ]]; then
export WIN_SOFA_ROOT=$( echo "/$SOFA_ROOT" | sed -e 's/\\/\//g' -e 's/://' )
WIN_WORKSPACE=$( echo "/$GITHUB_WORKSPACE" | sed -e 's/\\/\//g' -e 's/://' )
echo "$(cd $WIN_SOFA_ROOT/bin && pwd -W)" >> $GITHUB_PATH
echo "PYTHONPATH=$WIN_SOFA_ROOT/plugins/SofaPython3/lib/python3/site-packages:$WIN_WORKSPACE:$PYTHONPATH" | tee -a $GITHUB_ENV
echo "LD_LIBRARY_PATH=$WIN_SOFA_ROOT/lib:$LD_LIBRARY_PATH" | tee -a $GITHUB_ENV
else
echo "PATH=$PATH:$SOFA_ROOT/bin" | tee -a $GITHUB_ENV
echo "PYTHONPATH=$SOFA_ROOT/lib/python3/site-packages:$SOFA_ROOT/plugins/SofaPython3/lib/python3/site-packages:$GITHUB_WORKSPACE:$PYTHONPATH" | tee -a $GITHUB_ENV
if [[ "$RUNNER_OS" == "macOS" ]]; then
echo "DYLD_FALLBACK_LIBRARY_PATH=$SOFA_ROOT/lib:$DYLD_FALLBACK_LIBRARY_PATH" | tee -a $GITHUB_ENV
else
echo "LD_LIBRARY_PATH=$SOFA_ROOT/lib:$LD_LIBRARY_PATH" | tee -a $GITHUB_ENV
fi
fi
- name: Run tests
shell: bash
run: |
cd ${GITHUB_WORKSPACE}
python -m pytest tests/