From d7310c535a6463ad132fd8667e9e19ba30badc54 Mon Sep 17 00:00:00 2001 From: Tamir Date: Tue, 26 Sep 2023 11:09:15 +0300 Subject: [PATCH 01/12] minimal_cmake_version_test --- .github/workflows/CMake-minimal-version.yaml | 48 ++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/CMake-minimal-version.yaml diff --git a/.github/workflows/CMake-minimal-version.yaml b/.github/workflows/CMake-minimal-version.yaml new file mode 100644 index 0000000000..9389b37d0f --- /dev/null +++ b/.github/workflows/CMake-minimal-version.yaml @@ -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" + 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 .. + git clone https://github.com/nlohmann/cmake_min_version.git --depth 1 + 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/) + + # A next line cut last line from an output and cut CMAke version from parentheses. + 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}" ] + 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 From 50053996ca6bdcab17a23e63203c1024cc14968e Mon Sep 17 00:00:00 2001 From: Tamir Date: Tue, 26 Sep 2023 19:51:32 +0300 Subject: [PATCH 02/12] Small fixes Checkout specific commit Job renamed Comments added --- .github/workflows/CMake-minimal-version.yaml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CMake-minimal-version.yaml b/.github/workflows/CMake-minimal-version.yaml index 9389b37d0f..85937480f5 100644 --- a/.github/workflows/CMake-minimal-version.yaml +++ b/.github/workflows/CMake-minimal-version.yaml @@ -11,7 +11,7 @@ env: jobs: test_downloader: - name: "Test cmake_downloader.py" + name: "Run CMake compatibility tool" runs-on: ubuntu-22.04 steps: - name: Checkout @@ -22,16 +22,21 @@ jobs: run: | sudo apt-get install xorg-dev libglu1-mesa-dev + # Go back from RealSense directory to parent directory cd .. + git clone https://github.com/nlohmann/cmake_min_version.git --depth 1 + # Go to specific last commit to porpose avoid using breacking changes in the repo. + git checkout 687dc56e1cf52c865cebf6ac94ad67906d6e1369 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/) + echo "$(output)" - # A next line cut last line from an output and cut CMAke version from parentheses. + # Retrieve CMake minimal version from the last line of the tool output. 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 From 843fd4a866a22afd9883028c73803466b1f274bf Mon Sep 17 00:00:00 2001 From: Tamir Date: Tue, 26 Sep 2023 20:07:41 +0300 Subject: [PATCH 03/12] sequence changed --- .github/workflows/CMake-minimal-version.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CMake-minimal-version.yaml b/.github/workflows/CMake-minimal-version.yaml index 85937480f5..d952a1e49e 100644 --- a/.github/workflows/CMake-minimal-version.yaml +++ b/.github/workflows/CMake-minimal-version.yaml @@ -26,9 +26,9 @@ jobs: cd .. git clone https://github.com/nlohmann/cmake_min_version.git --depth 1 + cd cmake_min_version # Go to specific last commit to porpose avoid using breacking changes in the repo. git checkout 687dc56e1cf52c865cebf6ac94ad67906d6e1369 - cd cmake_min_version python3 -mvenv venv venv/bin/pip3 install -r requirements.txt From 8b863fad38fa2ceaf69b94d0d42240003c8154ee Mon Sep 17 00:00:00 2001 From: Tamir Date: Tue, 26 Sep 2023 20:21:25 +0300 Subject: [PATCH 04/12] depth parameter removed from cloning --- .github/workflows/CMake-minimal-version.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CMake-minimal-version.yaml b/.github/workflows/CMake-minimal-version.yaml index d952a1e49e..0734a4d64f 100644 --- a/.github/workflows/CMake-minimal-version.yaml +++ b/.github/workflows/CMake-minimal-version.yaml @@ -25,7 +25,7 @@ jobs: # Go back from RealSense directory to parent directory cd .. - git clone https://github.com/nlohmann/cmake_min_version.git --depth 1 + git clone https://github.com/nlohmann/cmake_min_version.git cd cmake_min_version # Go to specific last commit to porpose avoid using breacking changes in the repo. git checkout 687dc56e1cf52c865cebf6ac94ad67906d6e1369 @@ -34,7 +34,7 @@ jobs: 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/) - echo "$(output)" + echo $(output) # Retrieve CMake minimal version from the last line of the tool output. current_cmake_version=$(echo ${output: -30} | cut -d'(' -f 2 | head -c -2) From 46159543a443792f570b76809a16bedb8cd0f31e Mon Sep 17 00:00:00 2001 From: Tamir Date: Tue, 26 Sep 2023 20:31:14 +0300 Subject: [PATCH 05/12] >= added between strings --- .github/workflows/CMake-minimal-version.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CMake-minimal-version.yaml b/.github/workflows/CMake-minimal-version.yaml index 0734a4d64f..fb5e83acb0 100644 --- a/.github/workflows/CMake-minimal-version.yaml +++ b/.github/workflows/CMake-minimal-version.yaml @@ -27,14 +27,14 @@ jobs: git clone https://github.com/nlohmann/cmake_min_version.git cd cmake_min_version - # Go to specific last commit to porpose avoid using breacking changes in the repo. + # We clone a specific commit which we tested the process as working git checkout 687dc56e1cf52c865cebf6ac94ad67906d6e1369 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/) - echo $(output) + echo $output # Retrieve CMake minimal version from the last line of the tool output. current_cmake_version=$(echo ${output: -30} | cut -d'(' -f 2 | head -c -2) @@ -43,7 +43,7 @@ jobs: - name: "Check minimal CMake version" run: | - if [ "${{steps.cmake_version.outputs.current_cmake_version}}" != "${EXPECTED_CMAKE_VERSION}" ] + if [ "${{steps.cmake_version.outputs.current_cmake_version}}" >= "${EXPECTED_CMAKE_VERSION}" ] 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 From 110e7edd10533d9a0cf36b8e43c6f3452ddde61e Mon Sep 17 00:00:00 2001 From: Tamir Date: Tue, 26 Sep 2023 21:04:16 +0300 Subject: [PATCH 06/12] test > sign with latest release --- .github/workflows/CMake-minimal-version.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CMake-minimal-version.yaml b/.github/workflows/CMake-minimal-version.yaml index fb5e83acb0..aa53e6c2f2 100644 --- a/.github/workflows/CMake-minimal-version.yaml +++ b/.github/workflows/CMake-minimal-version.yaml @@ -32,7 +32,7 @@ jobs: python3 -mvenv venv venv/bin/pip3 install -r requirements.txt - venv/bin/python3 cmake_downloader.py --first_minor + venv/bin/python3 cmake_downloader.py --latest_release output=$(venv/bin/python3 cmake_min_version.py /home/runner/work/librealsense/librealsense/) echo $output @@ -43,7 +43,7 @@ jobs: - name: "Check minimal CMake version" run: | - if [ "${{steps.cmake_version.outputs.current_cmake_version}}" >= "${EXPECTED_CMAKE_VERSION}" ] + if [ "${{steps.cmake_version.outputs.current_cmake_version}}" > "${EXPECTED_CMAKE_VERSION}" ] 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 From 44f5d9c8c569ae1a0824ae501f6d49a05865fc57 Mon Sep 17 00:00:00 2001 From: Tamir Date: Tue, 26 Sep 2023 21:07:39 +0300 Subject: [PATCH 07/12] first_minor flag returned --- .github/workflows/CMake-minimal-version.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CMake-minimal-version.yaml b/.github/workflows/CMake-minimal-version.yaml index aa53e6c2f2..4baabb7812 100644 --- a/.github/workflows/CMake-minimal-version.yaml +++ b/.github/workflows/CMake-minimal-version.yaml @@ -32,7 +32,7 @@ jobs: python3 -mvenv venv venv/bin/pip3 install -r requirements.txt - venv/bin/python3 cmake_downloader.py --latest_release + venv/bin/python3 cmake_downloader.py --first_minor output=$(venv/bin/python3 cmake_min_version.py /home/runner/work/librealsense/librealsense/) echo $output From abf62d322061f5bdbd3efd190c4bad9180f1f5ca Mon Sep 17 00:00:00 2001 From: Tamir Date: Wed, 27 Sep 2023 09:52:59 +0300 Subject: [PATCH 08/12] if logic changed --- .github/workflows/CMake-minimal-version.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/CMake-minimal-version.yaml b/.github/workflows/CMake-minimal-version.yaml index 4baabb7812..984cf70178 100644 --- a/.github/workflows/CMake-minimal-version.yaml +++ b/.github/workflows/CMake-minimal-version.yaml @@ -34,7 +34,7 @@ jobs: 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/) - echo $output + echo "Current CMake $output" # Retrieve CMake minimal version from the last line of the tool output. current_cmake_version=$(echo ${output: -30} | cut -d'(' -f 2 | head -c -2) @@ -43,11 +43,11 @@ jobs: - name: "Check minimal CMake version" run: | - if [ "${{steps.cmake_version.outputs.current_cmake_version}}" > "${EXPECTED_CMAKE_VERSION}" ] + if [ "${{steps.cmake_version.outputs.current_cmake_version}}" <= "${EXPECTED_CMAKE_VERSION}" ] 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 + else + 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 fi From de4aa642386453745e25ca077f6fee732787802b Mon Sep 17 00:00:00 2001 From: Tamir Date: Wed, 27 Sep 2023 10:53:47 +0300 Subject: [PATCH 09/12] string comparing changed We can't compare strings with '<=' (The 'else' statement run in case strings are equals). So I will separately check first '==' after '<' --- .github/workflows/CMake-minimal-version.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CMake-minimal-version.yaml b/.github/workflows/CMake-minimal-version.yaml index 984cf70178..07e9d292d8 100644 --- a/.github/workflows/CMake-minimal-version.yaml +++ b/.github/workflows/CMake-minimal-version.yaml @@ -43,7 +43,7 @@ jobs: - name: "Check minimal CMake version" run: | - if [ "${{steps.cmake_version.outputs.current_cmake_version}}" <= "${EXPECTED_CMAKE_VERSION}" ] + if [ "${{steps.cmake_version.outputs.current_cmake_version}}" == "${EXPECTED_CMAKE_VERSION}" || "${{steps.cmake_version.outputs.current_cmake_version}}" \< "${EXPECTED_CMAKE_VERSION}" ] then echo "The test PASSED, CMake ${{steps.cmake_version.outputs.current_cmake_version}} found same as expecting ${EXPECTED_CMAKE_VERSION}" exit 0 From f6a2b981c7afba72d1866ba7b7373c7faaf302eb Mon Sep 17 00:00:00 2001 From: Tamir Date: Wed, 27 Sep 2023 11:01:42 +0300 Subject: [PATCH 10/12] if fixed --- .github/workflows/CMake-minimal-version.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CMake-minimal-version.yaml b/.github/workflows/CMake-minimal-version.yaml index 07e9d292d8..fbe7bcdf31 100644 --- a/.github/workflows/CMake-minimal-version.yaml +++ b/.github/workflows/CMake-minimal-version.yaml @@ -43,7 +43,7 @@ jobs: - name: "Check minimal CMake version" run: | - if [ "${{steps.cmake_version.outputs.current_cmake_version}}" == "${EXPECTED_CMAKE_VERSION}" || "${{steps.cmake_version.outputs.current_cmake_version}}" \< "${EXPECTED_CMAKE_VERSION}" ] + if [ "${{steps.cmake_version.outputs.current_cmake_version}}" == "${EXPECTED_CMAKE_VERSION}" ] || [ "${{steps.cmake_version.outputs.current_cmake_version}}" \< "${EXPECTED_CMAKE_VERSION}" ] then echo "The test PASSED, CMake ${{steps.cmake_version.outputs.current_cmake_version}} found same as expecting ${EXPECTED_CMAKE_VERSION}" exit 0 From 7d05d1b9f4edea03aaa107d19fc08883c561ca2a Mon Sep 17 00:00:00 2001 From: Tamir Date: Mon, 2 Oct 2023 13:29:34 +0300 Subject: [PATCH 11/12] print changed --- .github/workflows/CMake-minimal-version.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CMake-minimal-version.yaml b/.github/workflows/CMake-minimal-version.yaml index fbe7bcdf31..a91c9f9ceb 100644 --- a/.github/workflows/CMake-minimal-version.yaml +++ b/.github/workflows/CMake-minimal-version.yaml @@ -45,7 +45,7 @@ jobs: run: | if [ "${{steps.cmake_version.outputs.current_cmake_version}}" == "${EXPECTED_CMAKE_VERSION}" ] || [ "${{steps.cmake_version.outputs.current_cmake_version}}" \< "${EXPECTED_CMAKE_VERSION}" ] then - echo "The test PASSED, CMake ${{steps.cmake_version.outputs.current_cmake_version}} found same as expecting ${EXPECTED_CMAKE_VERSION}" + echo "The test PASSED, current CMake version is ${{steps.cmake_version.outputs.current_cmake_version}} and it is not higher than ${EXPECTED_CMAKE_VERSION}" exit 0 else 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}}" From 472f41b190631ab219685dfa96a218f1ae07070e Mon Sep 17 00:00:00 2001 From: Tamir Date: Mon, 2 Oct 2023 16:05:38 +0300 Subject: [PATCH 12/12] print edited --- .github/workflows/CMake-minimal-version.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CMake-minimal-version.yaml b/.github/workflows/CMake-minimal-version.yaml index a91c9f9ceb..e6ffb04f5a 100644 --- a/.github/workflows/CMake-minimal-version.yaml +++ b/.github/workflows/CMake-minimal-version.yaml @@ -34,7 +34,7 @@ jobs: 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/) - echo "Current CMake $output" + echo "$output" # Retrieve CMake minimal version from the last line of the tool output. current_cmake_version=$(echo ${output: -30} | cut -d'(' -f 2 | head -c -2)