From 1624d7cebc8a234bcc004c31b3140fcb27eb22cd Mon Sep 17 00:00:00 2001 From: Matthijs van der Burgh Date: Fri, 10 Sep 2021 13:02:22 +0200 Subject: [PATCH] (actions) Run multiple python versions (#354) * (actions) run on ubuntu-20.04 Only one python2 job * (actions) run also python 3.9 and 3.10 * (actions) convert python version to string * (actions) update LD_LIBRARY_PATH * (actions) just use python exec * (actions) which python * (actions) change order of LD_LIBRARY_PATH * (actions) empty LD_LIBRARY_PATH * (actions) env * (actions) empty LD_LIBRARY_PATH env * (actions) sudo ldconfig -v * (actions) print sys.path * (actions) print get_python_lib path * (actions) add library path to PYTHONPATH Needed to use setup-python * (actions) typo * (actions) print sys.path * (actions) export pythonpath * (actions) export normal sys.path to PYTHONPATH * (actions) pythonpath * (actions) pythonpath * Update main.yml * (actions) install python packages by pip * (actions) cleanup * (actions) remove unused python variable * (actions) no need to extend LD_LIBRARY_PATH --- .github/workflows/main.yml | 52 ++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 61321180..97a79b8e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,22 +8,38 @@ env: jobs: build: name: Build - runs-on: ubuntu-18.04 + runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: + os: [ubuntu-20.04] orocos_build_type: [Debug, Release] compiler: [gcc, clang] + python_version: ['3.8'] + include: + - os: ubuntu-18.04 + orocos_build_type: Release + compiler: gcc + python_version: '2' + - os: ubuntu-20.04 + orocos_build_type: Release + compiler: gcc + python_version: '3.9' env: CC: ${{ matrix.compiler }} OROCOS_BUILD_TYPE: ${{ matrix.orocos_build_type }} + ROS_PYTHON_VERSION: ${{ matrix.python_version }} steps: - uses: actions/checkout@v2 with: submodules: recursive + - uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python_version }} - name: Install run: | - sudo apt-get install libeigen3-dev libcppunit-dev python-psutil python3-psutil python-future python3-future + sudo apt-get install libeigen3-dev libcppunit-dev + pip install psutil future - name: Build orocos_kdl run: | cd orocos_kdl @@ -32,40 +48,26 @@ jobs: cmake -DENABLE_TESTS:BOOL=ON -DCMAKE_BUILD_TYPE=${OROCOS_KDL_BUILD_TYPE} ./.. make sudo make install - - name: Build PyKDL Python 2 - run: | - cd python_orocos_kdl - mkdir build2 - cd build2 - export ROS_PYTHON_VERSION=2 - cmake -DCMAKE_BUILD_TYPE=${OROCOS_KDL_BUILD_TYPE} ./.. - make - sudo make install - - name: Build PyKDL Python 3 + - name: Build PyKDL run: | cd python_orocos_kdl - mkdir build3 - cd build3 - export ROS_PYTHON_VERSION=3 + mkdir build + cd build cmake -DCMAKE_BUILD_TYPE=${OROCOS_KDL_BUILD_TYPE} ./.. make sudo make install - - name: Update LD_LIBRARY_PATH - run: | - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib - sudo ldconfig + - name: ldconfig + run: sudo ldconfig - name: Test orocos_kdl run: | cd orocos_kdl/build make check - - name: Test PyKDL Python 2 - run: | - cd python_orocos_kdl - python2 tests/PyKDLtest.py - - name: Test PyKDL Python 3 + - name: Test PyKDL run: | cd python_orocos_kdl - python3 tests/PyKDLtest.py + python_version_short=$(python -c "import sys; print('{}.{}'.format(sys.version_info[0], sys.version_info[1]))") + export PYTHONPATH=/usr/local/lib/python${python_version_short}/dist-packages${PYTHONPATH:+:${PYTHONPATH}} + python tests/PyKDLtest.py industrial_ci: name: Industrial CI - ${{ matrix.env.ROS_DISTRO }}