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

GHA checking CMake minimal version test #12118

Merged
48 changes: 48 additions & 0 deletions .github/workflows/CMake-minimal-version.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: CMake minimal version
# The aim of this test derminate minimal supported CMake version for LibRS project
# and check if it equlas to expected minimal CMAke version

on:
push:
pull_request:

env:
EXPECTED_CMAKE_VERSION: "VERSION 3.8.0"

jobs:
test_downloader:
name: "Test cmake_downloader.py"
Nir-Az marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3

- name: "Get current CMake version"
id: cmake_version
run: |
sudo apt-get install xorg-dev libglu1-mesa-dev

cd ..
Nir-Az marked this conversation as resolved.
Show resolved Hide resolved
git clone https://github.com/nlohmann/cmake_min_version.git --depth 1
Nir-Az marked this conversation as resolved.
Show resolved Hide resolved
cd cmake_min_version

python3 -mvenv venv
venv/bin/pip3 install -r requirements.txt
venv/bin/python3 cmake_downloader.py --first_minor
output=$(venv/bin/python3 cmake_min_version.py /home/runner/work/librealsense/librealsense/)
Nir-Az marked this conversation as resolved.
Show resolved Hide resolved

# A next line cut last line from an output and cut CMAke version from parentheses.
Nir-Az marked this conversation as resolved.
Show resolved Hide resolved
current_cmake_version=$(echo ${output: -30} | cut -d'(' -f 2 | head -c -2)
# Saving cmake minimal version string in GitHub output
echo "current_cmake_version=$current_cmake_version" >> $GITHUB_OUTPUT

- name: "Check minimal CMake version"
run: |
if [ "${{steps.cmake_version.outputs.current_cmake_version}}" != "${EXPECTED_CMAKE_VERSION}" ]
Nir-Az marked this conversation as resolved.
Show resolved Hide resolved
then
echo "Error - LibRS minimal CMake version require is ${EXPECTED_CMAKE_VERSION} but on this build the minimal is ${{steps.cmake_version.outputs.current_cmake_version}}"
exit 1
else
echo "The test PASSED, CMake ${{steps.cmake_version.outputs.current_cmake_version}} found same as expecting ${EXPECTED_CMAKE_VERSION}"
exit 0
fi
Loading