Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refresh v24.12 #153

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ jobs:
&& ccache -s

- name: Archive production
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4.4.0
with:
name: caribou_macos_${{ matrix.sofa_version }}
path: SofaCaribou.tar.gz
220 changes: 65 additions & 155 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,209 +10,119 @@ on:

jobs:
build:
name: Building with ${{ matrix.sofa_version }}
runs-on: ubuntu-20.04
container: ${{ matrix.CONTAINER }}
name: Run on ${{ matrix.os }} with SOFA ${{ matrix.sofa_branch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
sofa_version: [ master ]
include:
- sofa_version: master
SOFA_VERSION_I: 999999
CONTAINER: jnbrunet/caribou-ubuntu-2004-builder:latest
PYTHON_VERSION: 3.8
PYBIND11_VERSION: 2.6
env:
SOFA_VERSION: ${{ matrix.sofa_version }}
SOFA_ROOT: /opt/sofa
PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }}
os: [ubuntu-22.04]
sofa_branch: [master]

steps:
- uses: actions/checkout@v2
- name: Setup SOFA and environment
id: sofa
uses: sofa-framework/sofa-setup-action@v5
with:
fetch-depth: 0

- run: |
git config --global user.email "caribou@github.com"
git config --global user.name "Caribou Github"
git fetch origin
git rebase origin/master

- name: Install pybind11
if: ${{ matrix.PYBIND11_VERSION != '2.4' }}
run: |
git clone --depth 1 -b v${{ matrix.PYBIND11_VERSION }} https://github.com/pybind/pybind11.git /tmp/pybind11
cmake -GNinja -S/tmp/pybind11 -B/tmp/pybind11/build -DPYBIND11_TEST=OFF -DCMAKE_BUILD_TYPE=Release
cmake --install /tmp/pybind11/build
rm -rf /tmp/pybind11

- name: Download SOFA Release
run: |
if [ "$SOFA_VERSION" = "master" ]; then
curl --output sofa.zip -L "https://ci.inria.fr/sofa-ci-dev/job/nightly-generate-binaries/lastStableBuild/CI_BRANCH=master,CI_SCOPE=standard/artifact/Linux/*zip*/Linux.zip"
unzip sofa.zip -d temp
mv temp/Linux/`ls temp/Linux` sofa.zip
rm -rf temp
unzip sofa.zip -d temp
mv temp/`ls temp` $SOFA_ROOT
else
curl --output sofa.zip -L "https://github.com/sofa-framework/sofa/releases/download/$SOFA_VERSION/SOFA_"$SOFA_VERSION"_Linux.zip"
unzip sofa.zip -d temp
mv temp/`ls temp` $SOFA_ROOT
fi

- name: Get Time
id: time
uses: nanzm/get-time-action@v1.0
sofa_root: ${{ github.workspace }}/sofa
sofa_version: ${{ matrix.sofa_branch }}
sofa_scope: 'standard'
- name: Checkout source code
uses: actions/checkout@v2
with:
timeZone: 8
format: 'YYYY-MM-DD-HH-mm-ss'

- name: ccache cache files
uses: actions/cache@v2
if: ${{ always() }}
with:
path: .ccache
key: ubuntu-ccache-${{ steps.time.outputs.time }}
restore-keys: |
ubuntu-ccache-
path: ${{ env.WORKSPACE_SRC_PATH }}

- name: Build caribou
env:
CCACHE_COMPRESS: true
CCACHE_COMPRESSLEVEL: 6
CCACHE_MAXSIZE: "500M"
PYTHONEXE: ${{ format('/usr/bin/python{0}', matrix.PYTHON_VERSION) }}
run:
export CCACHE_BASEDIR=$GITHUB_WORKSPACE &&
export CCACHE_DIR=$GITHUB_WORKSPACE/.ccache &&
ccache -z &&
cmake
-GNinja
-DPYTHON_EXECUTABLE=$PYTHONEXE
-DCMAKE_C_COMPILER_LAUNCHER=ccache
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-DCARIBOU_BUILD_TESTS=ON
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX=SofaCaribou
.
&& cmake --build . && cmake --install .
&& tar czvf SofaCaribou.tar.gz SofaCaribou
&& echo ${CCACHE_BASEDIR}
&& ccache -s

- name: Archive production
uses: actions/upload-artifact@v2
with:
name: caribou_${{ matrix.sofa_version }}
path: SofaCaribou.tar.gz

test:
name: Testing with ${{ matrix.sofa_version }}
needs: [build]
runs-on: ubuntu-20.04
container: ubuntu:20.04
strategy:
fail-fast: false
matrix:
sofa_version: [ master ]
include:
- sofa_version: master
PYTHON_VERSION: 3.8
sofa_version_int: 211200
env:
SOFA_VERSION: ${{ matrix.sofa_version }}
SOFA_ROOT: /opt/sofa
CARIBOU_ROOT: /opt/sofa/plugins/SofaCaribou

steps:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.PYTHON_VERSION }}

- name: Install dependencies
run: |
apt-get update
apt-get -qq --no-install-recommends install \
libgl1-mesa-glx libglib2.0-0 libglx0 libopengl0 libharfbuzz0b libgomp1 curl ca-certificates unzip
python -m pip install numpy meshio scipy

- name: Install SOFA
sudo apt install libeigen3-dev
cd "$WORKSPACE_BUILD_PATH"
cmake \
-GNinja \
-DCARIBOU_BUILD_TESTS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$WORKSPACE_INSTALL_PATH" \
-DCMAKE_PREFIX_PATH=$SOFA_ROOT/lib/cmake \
../src
cmake --build . && cmake --install .

- name: Sanitize artifact name
id: sanitize
# This step removes special characters from the artifact name to ensure compatibility with upload-artifact
# Characters removed: " : < > | * ? \r \n \ /
# Spaces are replaced with underscores
# This sanitization prevents errors in artifact creation and retrieval
shell: pwsh
run: |
if [ "$SOFA_VERSION" = "master" ]; then
curl --output sofa.zip -L "https://ci.inria.fr/sofa-ci-dev/job/nightly-generate-binaries/lastStableBuild/CI_BRANCH=master,CI_SCOPE=standard/artifact/Linux/*zip*/Linux.zip"
unzip sofa.zip -d temp
mv temp/Linux/`ls temp/Linux` sofa.zip
rm -rf temp
unzip sofa.zip -d temp
mv temp/`ls temp` $SOFA_ROOT
else
curl --output sofa.zip -L "https://github.com/sofa-framework/sofa/releases/download/$SOFA_VERSION/SOFA_"$SOFA_VERSION"_Linux.zip"
unzip sofa.zip -d temp
mv temp/`ls temp` $SOFA_ROOT
fi
$originalName = "Caribou_${{ steps.sofa.outputs.run_branch }}_for-SOFA-${{ steps.sofa.outputs.sofa_version }}_${{ runner.os }}"
$artifact_name = $originalName -replace '[":;<>|*?\r\n\\/]', '' -replace ' ', '_'
echo "artifact_name=$artifact_name" >> $env:GITHUB_OUTPUT

- name: Create artifact
uses: actions/upload-artifact@v4.4.0
with:
name: ${{ steps.sanitize.outputs.artifact_name }}
path: ${{ env.WORKSPACE_INSTALL_PATH }}

- name: Download caribou
- name: Install artifact
uses: actions/download-artifact@v4.1.7
with:
name: caribou_${{ matrix.sofa_version }}
path: /tmp
name: ${{ steps.sanitize.outputs.artifact_name }}
path: ${{ env.WORKSPACE_ARTIFACT_PATH }}

- name: Unpack caribou
run: tar xzf /tmp/SofaCaribou.tar.gz -C /opt/sofa/plugins
- name: Set env vars for tests
shell: bash
run: |
echo "LD_LIBRARY_PATH=$WORKSPACE_ARTIFACT_PATH/lib:$SOFA_ROOT/lib:$SOFA_ROOT/plugins/SofaPython3/lib:$LD_LIBRARY_PATH" | tee -a $GITHUB_ENV
# export PYTHONPATH=$PYTHONPATH:$CARIBOU_ROOT/lib/python3/site-packages

- name: Caribou.unittests.Geometry
if: ${{ always() }}
run: |
export LD_LIBRARY_PATH="$SOFA_ROOT/lib:$LD_LIBRARY_PATH"
$CARIBOU_ROOT/bin/Caribou.unittests.Geometry
cd $WORKSPACE_BUILD_PATH
./bin/Caribou.unittests.Geometry

- name: Caribou.Geometry.PyTest
if: ${{ always() }}
run: |
export PYTHONPATH=$PYTHONPATH:$CARIBOU_ROOT/lib/python3/site-packages
python $CARIBOU_ROOT/bin/pytest/Caribou_Geometry_Test.py

export PYTHONPATH=$PYTHONPATH:$WORKSPACE_INSTALL_PATH/lib/python3/site-packages:$WORKSPACE_INSTALL_PATH/plugins/SofaPython3/lib/python3/site-packages
cd "$WORKSPACE_BUILD_PATH"/../src
python3 src/Caribou/Python/Geometry/pytest/Caribou_Geometry_Test.py

- name: Caribou.unittests.Topology
if: ${{ always() }}
run: |
[ "$SOFA_VERSION" = "v20.06.01" ] && export LD_LIBRARY_PATH="$SOFA_ROOT/lib:$LD_LIBRARY_PATH"
$CARIBOU_ROOT/bin/Caribou.unittests.Topology
cd $WORKSPACE_BUILD_PATH
./bin/Caribou.unittests.Topology

- name: Caribou.Topology.PyTest
if: ${{ always() }}
run: |
export PYTHONPATH=$PYTHONPATH:$CARIBOU_ROOT/lib/python3/site-packages
python $CARIBOU_ROOT/bin/pytest/Caribou_Topology_Test.py
cd $${{ env.WORKSPACE_SRC_PATH }}
python3 src/Caribou/Python/Topology/pytest/Caribou_Topology_Test.py

- name: Caribou.unittests.Mechanics
if: ${{ always() }}
run: |
export LD_LIBRARY_PATH="$SOFA_ROOT/lib:$LD_LIBRARY_PATH"
$CARIBOU_ROOT/bin/Caribou.unittests.Mechanics
cd $WORKSPACE_BUILD_PATH
./bin/Caribou.unittests.Mechanics

- name: Caribou.unittests.SofaCaribou
if: ${{ always() }}
run: |
[ "$SOFA_VERSION" = "v20.06.01" ] && export LD_LIBRARY_PATH="$SOFA_ROOT/lib:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH="$SOFA_ROOT/collections/SofaBaseMechanics/lib:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH="$SOFA_ROOT/collections/SofaBaseUtils/lib:$LD_LIBRARY_PATH"
$CARIBOU_ROOT/bin/Caribou.unittests.SofaCaribou
cd $WORKSPACE_BUILD_PATH
./bin/Caribou.unittests.SofaCaribou

- name: SofaCaribou.PyTest
if: ${{ matrix.sofa_version_int >= '201200' }}
if: ${{ always() }}
run: |
cd $WORKSPACE_BUILD_PATH
export PYTHONPATH=$PYTHONPATH:$CARIBOU_ROOT/lib/python3/site-packages:$SOFA_ROOT/plugins/SofaPython3/lib/python3/site-packages
python $CARIBOU_ROOT/bin/pytest/SofaCaribou_Forcefield_HyperelasticForcefield.py
python3 src/SofaCaribou/Python/pytest/SofaCaribou_Forcefield_HyperelasticForcefield.py



deploy:
name: Deploy ${{ matrix.sofa_version }}
needs: [test]
needs: [build]
runs-on: ubuntu-20.04
if: github.event_name == 'schedule'
strategy:
Expand Down
Loading
Loading