From 21643abe90b84ca9bbf80e605746319c7acb1d78 Mon Sep 17 00:00:00 2001 From: LAGNEAU Romain Date: Wed, 8 Jan 2025 17:16:08 +0100 Subject: [PATCH] [TEST] Improved CI for Ogre --- .github/workflows/ubuntu-ogre-apt.yml | 2 +- .github/workflows/ubuntu-ogre-src.yml | 119 ++++++++++++++++++++++++++ 2 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ubuntu-ogre-src.yml diff --git a/.github/workflows/ubuntu-ogre-apt.yml b/.github/workflows/ubuntu-ogre-apt.yml index d4d828e44f..c2963d99e0 100644 --- a/.github/workflows/ubuntu-ogre-apt.yml +++ b/.github/workflows/ubuntu-ogre-apt.yml @@ -41,7 +41,7 @@ jobs: run: sudo apt-get update && sudo apt-get install -y libx11-dev libdc1394-dev libv4l-dev liblapack-dev libopenblas-dev libeigen3-dev libopencv-dev nlohmann-json3-dev - name: Install Ogre 1.9 - if: matrix.ogre == 'ogre-1.9' + if: matrix.ogre == 'ogre-1.9' && matrix.standard != '17' run: sudo apt-get update && sudo apt-get install -y libogre-1.9-dev - name: Install Ogre 1.12 diff --git a/.github/workflows/ubuntu-ogre-src.yml b/.github/workflows/ubuntu-ogre-src.yml new file mode 100644 index 0000000000..7cc942d931 --- /dev/null +++ b/.github/workflows/ubuntu-ogre-src.yml @@ -0,0 +1,119 @@ +name: Ubuntu-ogre-src + +# https://www.jeffgeerling.com/blog/2020/running-github-actions-workflow-on-schedule-and-other-events +on: + pull_request: + types: [opened, reopened, synchronize] + schedule: + - cron: '0 2 * * SUN' + +# https://stackoverflow.com/questions/66335225/how-to-cancel-previous-runs-in-the-pr-when-you-push-new-commitsupdate-the-curre#comment133398800_72408109 +# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency +concurrency: + group: ${{ github.workflow }}-${{ github.ref || github.run_id }} + cancel-in-progress: true + +env: + # Function to get the most recent tag of a remote repository without having to clone it, excluding tag with 'pr' as in Pre Release + FUNCTION_GET_LATEST: 'git -c "versionsort.suffix=-" ls-remote --exit-code --refs --sort="version:refname" --tags ${GIT_ADDRESS} "*.*.*" | cut --delimiter="/" --fields=3 | grep -v -e pr | tail --lines=1' + +jobs: + build-ubuntu-ogre-src: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-20.04, ubuntu-latest] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Print system information + run: lscpu + + - name: Print OS information + run: lsb_release -a + + - name: Install dependencies for ubuntu 20.04 + if: matrix.os == 'ubuntu-20.04' + run: | + sudo apt-get update && sudo apt-get install -y libdc1394-22-dev + + - name: Install common dependencies for ubuntu + run: | + sudo apt-get update + sudo apt-get install -y libx11-dev libv4l-dev gfortran liblapack-dev libeigen3-dev + sudo apt-get install -y libssl-dev libusb-1.0-0-dev pkg-config libgtk-3-dev libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev + sudo apt-get install -y mesa-common-dev mesa-utils freeglut3-dev libflann-dev libboost-all-dev + sudo apt-get install -y nlohmann-json3-dev + + - name: Install dependencies for ubuntu-latest + if: matrix.os == 'ubuntu-latest' + run: | + sudo apt-get update && sudo apt-get install -y libx11-dev libdc1394-dev libv4l-dev gfortran liblapack-dev libeigen3-dev + sudo apt-get update && sudo apt-get install -y libssl-dev libusb-1.0-0-dev pkg-config libgtk-3-dev libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev + + - name: Install Ogre dependencies + run: | + sudo apt-get update && sudo apt-get install -y libgles2-mesa-dev libvulkan-dev glslang-dev libxrandr-dev libxaw7-dev libx11-dev libzzip-dev libsdl2-dev + + - name: Build Ogre from source + run: | + pwd + GIT_ADDRESS="https://github.com/OGRECave/ogre" + LATEST_TAG=`eval ${FUNCTION_GET_LATEST}` + echo "Newest tag is ${LATEST_TAG}" + git clone --depth 1 --branch ${LATEST_TAG} ${GIT_ADDRESS} ${HOME}/ogre + cd ${HOME}/ogre + mkdir build && cd build && mkdir install + cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$(pwd)/install + make -j$(nproc) install + echo "OGRE_DIR=$(pwd)/install" >> $GITHUB_ENV + echo $OGRE_DIR + + - name: Clone visp-images + env: + BRANCH_NAME: ${{ github.head_ref || github.ref_name }} + # https://remarkablemark.org/blog/2022/09/25/check-git-branch-exists-in-remote-repository/ + run: | + git clone --depth 1 https://github.com/lagadic/visp-images ${HOME}/visp-images + echo "VISP_INPUT_IMAGE_PATH=$HOME/visp-images" >> $GITHUB_ENV + echo ${VISP_INPUT_IMAGE_PATH} + + - name: Configure CMake + run: | + pwd + mkdir build && cd build && mkdir install + cmake .. -DCMAKE_INSTALL_PREFIX=$(pwd)/install + cat ViSP-third-party.txt + + - name: Build visp-config script + working-directory: build + run: | + make -j$(nproc) developer_scripts + ./bin/visp-config --cflags + ./bin/visp-config --libs + + - name: Build and install ViSP + working-directory: build + run: | + make -j$(nproc) install + echo "VISP_DIR=$(pwd)/install" >> $GITHUB_ENV + echo $VISP_DIR + + - name: Run unit tests + working-directory: build + run: ctest -j$(nproc) --output-on-failure + + - name: Clone visp_started + run: | + git clone --depth 1 https://github.com/lagadic/visp_started ${HOME}/visp_started + + - name: Build visp_started with ViSP as 3rdparty + run: | + cd ${HOME}/visp_started + mkdir visp_started-build + cd visp_started-build + cmake .. + make -j$(nproc)