[gym/common] Add safety limits termination condition. #3434
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Ubuntu CI (Easy install dependencies) | |
on: | |
# Trigger the workflow on push on the master branch, or for any pull request | |
push: | |
branches: | |
- master | |
pull_request: | |
jobs: | |
build-test-and-deploy-doc-ubuntu: | |
name: >- | |
(${{ matrix.OS }}) (${{ matrix.BUILD_TYPE }}) (${{ matrix.COMPILER }}, ${{ matrix.GENERATOR }}) | |
Easy install the dependencies. Build the project and run the unit tests. Generate and deploy the documentation. | |
strategy: | |
matrix: | |
OS: ['ubuntu-20.04', 'ubuntu-22.04'] | |
GENERATOR: ['Unix Makefiles'] | |
COMPILER: ['gcc'] | |
BUILD_TYPE: ['Release'] | |
include: | |
- OS: 'ubuntu-20.04' | |
GENERATOR: 'Unix Makefiles' | |
COMPILER: 'gcc' | |
BUILD_TYPE: 'Debug' | |
- OS: 'ubuntu-20.04' # For some reason, importing 'jiminy_py' causes segfault on ubuntu-22.04 | |
GENERATOR: 'Ninja' | |
COMPILER: 'clang' | |
LINKER_FLAGS: '-fuse-ld=gold' | |
BUILD_TYPE: 'Release' | |
runs-on: ${{ matrix.OS }} | |
defaults: | |
run: | |
# Using bash with automatic sourcing `.bashrc` and fail-fast behavior enabled | |
shell: bash -ieo pipefail {0} | |
##################################################################################### | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@v4 | |
- name: Free Disk Space | |
uses: jlumbroso/free-disk-space@v1.3.1 | |
with: | |
tool-cache: false | |
android: true | |
dotnet: true | |
haskell: true | |
large-packages: false | |
swap-storage: false | |
##################################################################################### | |
- name: Define environment variables | |
run: | | |
echo "CMAKE_C_COMPILER=/usr/bin/${{ matrix.COMPILER }}" >> $GITHUB_ENV | |
if [[ "${{ matrix.COMPILER }}" == 'gcc' ]] ; then | |
echo "CMAKE_CXX_COMPILER=/usr/bin/g++" >> $GITHUB_ENV | |
else | |
echo "CMAKE_CXX_COMPILER=/usr/bin/${{ matrix.COMPILER }}++" >> $GITHUB_ENV | |
fi | |
echo "PYTHON_EXECUTABLE=/usr/bin/python3" >> $GITHUB_ENV | |
echo "RootDir=${GITHUB_WORKSPACE}" >> $GITHUB_ENV | |
echo "InstallDir=${GITHUB_WORKSPACE}/install" >> $GITHUB_ENV | |
echo "/home/runner/.local/bin" >> $GITHUB_PATH | |
- name: Install pre-compiled project dependencies | |
run: | | |
sudo env "PATH=$PATH" "${RootDir}/build_tools/easy_install_deps_ubuntu.sh" | |
if [[ "${{ matrix.GENERATOR }}" == 'Ninja' ]] ; then | |
sudo apt install ninja-build | |
fi | |
"${PYTHON_EXECUTABLE}" -m pip install "torch" -f https://download.pytorch.org/whl/torch | |
"${PYTHON_EXECUTABLE}" -m pip install "gymnasium>=0.28,<1.0" "stable_baselines3>=2.0" | |
##################################################################################### | |
- name: PEP8 Code Style Check | |
if: matrix.OS == 'ubuntu-20.04' && matrix.BUILD_TYPE != 'Debug' && matrix.COMPILER == 'gcc' | |
run: | | |
"${PYTHON_EXECUTABLE}" -m pip install flake8 | |
flake8 --ignore=E121,E126,E123,E226,E241,E266,E402,E741,F405,W504 \ | |
--count --show-source --statistics --exclude unit_py,examples "${RootDir}/python/" | |
##################################################################################### | |
- name: Build and install Jiminy | |
run: | | |
mkdir "${RootDir}/build" "${InstallDir}" | |
cd "${RootDir}/build" | |
cmake "${RootDir}" -Wdev -G "${{ matrix.GENERATOR }}" \ | |
-DCMAKE_EXE_LINKER_FLAGS="${{ matrix.LINKER_FLAGS }}" \ | |
-DCMAKE_SHARED_LINKER_FLAGS="${{ matrix.LINKER_FLAGS }}" \ | |
-DCMAKE_C_COMPILER="${CMAKE_C_COMPILER}" -DCMAKE_CXX_COMPILER="${CMAKE_CXX_COMPILER}" \ | |
-DCMAKE_PREFIX_PATH="/opt/openrobots/" -DCMAKE_INSTALL_PREFIX="${InstallDir}" \ | |
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=${{ (matrix.BUILD_TYPE == 'Debug' && 'OFF') || 'ON' }} \ | |
-DBoost_NO_SYSTEM_PATHS=OFF -DPYTHON_EXECUTABLE="${PYTHON_EXECUTABLE}" \ | |
-DBUILD_TESTING=ON -DBUILD_EXAMPLES=ON -DBUILD_PYTHON_INTERFACE=ON \ | |
-DCMAKE_BUILD_TYPE="${{ matrix.BUILD_TYPE }}" | |
if [[ "${{ matrix.GENERATOR }}" == 'Ninja' ]] ; then | |
ninja install -j2 | |
else | |
make install -j2 | |
fi | |
##################################################################################### | |
- name: Build extension module | |
run: | | |
"${InstallDir}/bin/jiminy_double_pendulum" | |
# Make sure that jiminy_py Python module can be imported | |
# export LD_LIBRARY_PATH="$InstallDir/lib" | |
"${PYTHON_EXECUTABLE}" -c "import jiminy_py; print(jiminy_py.get_libraries())" | |
RootDir="${RootDir}/core/examples/external_project/" | |
mkdir -p "${RootDir}/build" | |
cd "${RootDir}/build" | |
cmake "${RootDir}" -G "${{ matrix.GENERATOR }}" \ | |
-DCMAKE_EXE_LINKER_FLAGS="${{ matrix.LINKER_FLAGS }}" \ | |
-DCMAKE_SHARED_LINKER_FLAGS="${{ matrix.LINKER_FLAGS }}" \ | |
-DCMAKE_C_COMPILER="${CMAKE_C_COMPILER}" -DCMAKE_CXX_COMPILER="${CMAKE_CXX_COMPILER}" \ | |
-DCMAKE_PREFIX_PATH="/opt/openrobots/" -DCMAKE_INSTALL_PREFIX="${InstallDir}" \ | |
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=${{ (matrix.BUILD_TYPE == 'Debug' && 'OFF') || 'ON' }} \ | |
-DPYTHON_EXECUTABLE="${PYTHON_EXECUTABLE}" -DCMAKE_BUILD_TYPE="${{ matrix.BUILD_TYPE }}" | |
if [[ "${{ matrix.GENERATOR }}" == 'Ninja' ]] ; then | |
ninja install | |
else | |
make install | |
fi | |
"${InstallDir}/bin/pip_double_pendulum" | |
- name: Run unit tests for jiminy | |
run: | | |
ctest --output-on-failure --test-dir "${RootDir}/build/core/unit" | |
"${PYTHON_EXECUTABLE}" -m unittest discover -s "${RootDir}/python/jiminy_py/unit_py" -v | |
- name: Run unit tests for gym jiminy base module | |
run: | | |
if [[ "${{ matrix.BUILD_TYPE }}" == 'Debug' ]] ; then | |
export JIMINY_BUILD_DEBUG= | |
fi | |
"${PYTHON_EXECUTABLE}" -m unittest discover -s "${RootDir}/python/gym_jiminy/unit_py" -v | |
- name: Run examples for gym jiminy add-on modules | |
if: matrix.BUILD_TYPE != 'Debug' | |
run: | | |
cd "${RootDir}/python/gym_jiminy/examples/rllib" | |
"${PYTHON_EXECUTABLE}" acrobot_ppo.py | |
##################################################################################### | |
- name: Python linter | |
if: matrix.OS == 'ubuntu-20.04' && matrix.BUILD_TYPE != 'Debug' && matrix.COMPILER == 'gcc' | |
run: | | |
cd "${RootDir}/python/jiminy_py/" | |
pylint --rcfile="${RootDir}/.pylintrc" "src/" | |
for name in "common" "toolbox" "rllib"; do | |
cd "${RootDir}/python/gym_jiminy/$name" | |
pylint --rcfile="${RootDir}/.pylintrc" "gym_jiminy/" | |
done | |
##################################################################################### | |
- name: Generate and install Doxygen documentation | |
run: | | |
cd build | |
cmake . # Reconfigure cmake since sphinx has been installed in the meantime | |
cmake . -DCOMPONENT=docs -P ./cmake_install.cmake | |
- name: Deploy to GitHub Pages | |
if: >- | |
matrix.OS == 'ubuntu-22.04' && success() && | |
github.repository == 'duburcqa/jiminy' && github.event_name == 'push' && github.ref == 'refs/heads/master' | |
uses: crazy-max/ghaction-github-pages@v4 | |
with: | |
target_branch: gh-pages | |
build_dir: docs/html | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_DEPLOY }} |