From 22868e8b4d853814fd07d2a301219558e60be580 Mon Sep 17 00:00:00 2001 From: boxanm Date: Tue, 7 May 2024 08:38:42 -0400 Subject: [PATCH 01/14] Read libnabo version from package.xml, instead of the header of nabo.h --- CMakeLists.txt | 16 +++++++++++----- nabo/nabo.h | 8 +------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7ba5fb7..d3bcdd4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,11 +11,17 @@ project("lib${LIB_NAME}") set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) -# Extract version from header -file(READ "nabo/nabo.h" NABO_HEADER_CONTENT) -string(REGEX MATCH "#define NABO_VERSION \"([0-9]+\.[0-9]+\.[0-9]+)\"" _ ${NABO_HEADER_CONTENT}) -set(PROJECT_VERSION ${CMAKE_MATCH_1}) -message(STATUS ${PROJECT_VERSION}) +## Extract version from package.xml +file(READ "package.xml" PACKAGE_XML_CONTENT) +string(REGEX MATCH "([^<]+)" VERSION_MATCH ${PACKAGE_XML_CONTENT}) +# Extract the matched version from the captured group +if(VERSION_MATCH) + # CMake variable ${CMAKE_MATCH_1} contains the matched version + set(PROJECT_VERSION ${CMAKE_MATCH_1}) + message(STATUS "Found package version: ${PROJECT_VERSION}") +else() + message(WARNING "Package version not found in package.xml") +endif() if (NOT CMAKE_BUILD_TYPE) message("-- No build type specified; defaulting to CMAKE_BUILD_TYPE=Release.") diff --git a/nabo/nabo.h b/nabo/nabo.h index 6f8a699..addb4a9 100644 --- a/nabo/nabo.h +++ b/nabo/nabo.h @@ -204,13 +204,7 @@ libnabo differs from \ref ANN on the following points: //! Namespace for Nabo namespace Nabo { - //! \defgroup public public interface - //@{ - - //! version of the Nabo library as string - #define NABO_VERSION "1.0.7" - //! version of the Nabo library as an int - #define NABO_VERSION_INT 10007 + //! \defgroup public public interface // TODO (c++14) Convert invalidIndex, invalidValue to constexpr templated variables. template From 94151aa31dc065ea2d281e6cc50c8ffeb6f7e789 Mon Sep 17 00:00:00 2001 From: boxanm Date: Tue, 7 May 2024 09:05:03 -0400 Subject: [PATCH 02/14] Add github action to update libnabo's documentation --- .github/workflows/update_documentation.yaml | 33 +++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/update_documentation.yaml diff --git a/.github/workflows/update_documentation.yaml b/.github/workflows/update_documentation.yaml new file mode 100644 index 0000000..9e60d5f --- /dev/null +++ b/.github/workflows/update_documentation.yaml @@ -0,0 +1,33 @@ +name: Generate and Deploy Doxygen Documentation + +on: + push: + branches: + - main # Modify this to match your main branch name + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Install Dependencies + run: | + sudo apt-get update + sudo apt-get install -y build-essential cmake doxygen graphviz libboost-all-dev libeigen3-dev + + - name: Configure and Build Project + run: | + mkdir build + cd build + cmake .. + make doc + + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./build/doc/html # Directory containing the HTML documentation + From e54e7e32da44bfccc2486c44f36434e5a8704d4a Mon Sep 17 00:00:00 2001 From: boxanm <47394922+boxanm@users.noreply.github.com> Date: Tue, 7 May 2024 09:08:49 -0400 Subject: [PATCH 03/14] Allow manual trigerring of update_documentation.yaml --- .github/workflows/update_documentation.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/update_documentation.yaml b/.github/workflows/update_documentation.yaml index 9e60d5f..1c96893 100644 --- a/.github/workflows/update_documentation.yaml +++ b/.github/workflows/update_documentation.yaml @@ -4,6 +4,8 @@ on: push: branches: - main # Modify this to match your main branch name + + workflow_dispatch: # Allow manual triggering jobs: build: From e71f61a2c9f917410c5b5026d632b5e7c0df816a Mon Sep 17 00:00:00 2001 From: boxanm Date: Tue, 7 May 2024 09:18:22 -0400 Subject: [PATCH 04/14] Update workflow branches --- .github/workflows/update_documentation.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/update_documentation.yaml b/.github/workflows/update_documentation.yaml index 1c96893..1b7afe2 100644 --- a/.github/workflows/update_documentation.yaml +++ b/.github/workflows/update_documentation.yaml @@ -3,7 +3,8 @@ name: Generate and Deploy Doxygen Documentation on: push: branches: - - main # Modify this to match your main branch name + - master + - github-action-api-docs # Modify this to match your master branch name workflow_dispatch: # Allow manual triggering From 91d16d0c254374e0347ad8cd9d1bbc55d520c36c Mon Sep 17 00:00:00 2001 From: boxanm Date: Tue, 7 May 2024 09:45:57 -0400 Subject: [PATCH 05/14] Deploy documentation page from a release folder --- .github/workflows/update_documentation.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/update_documentation.yaml b/.github/workflows/update_documentation.yaml index 1b7afe2..6fa8dee 100644 --- a/.github/workflows/update_documentation.yaml +++ b/.github/workflows/update_documentation.yaml @@ -8,6 +8,10 @@ on: workflow_dispatch: # Allow manual triggering + release: + types: + - published + jobs: build: runs-on: ubuntu-latest @@ -33,4 +37,9 @@ jobs: with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./build/doc/html # Directory containing the HTML documentation + if: ${{ github.event.release.tag_name }} + destination_dir: ./releases/${{ github.event.release.tag_name }} + keep_files: false + commit_message: Release ${{ github.event.release.tag_name }} + From 1b60e68e625882970958d897e4c849e31ca8b29b Mon Sep 17 00:00:00 2001 From: boxanm Date: Tue, 7 May 2024 10:43:52 -0400 Subject: [PATCH 06/14] Update documentation workflow --- .github/workflows/update_documentation.yaml | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/.github/workflows/update_documentation.yaml b/.github/workflows/update_documentation.yaml index 6fa8dee..7ac4683 100644 --- a/.github/workflows/update_documentation.yaml +++ b/.github/workflows/update_documentation.yaml @@ -33,13 +33,7 @@ jobs: make doc - name: Deploy to GitHub Pages - uses: peaceiris/actions-gh-pages@v3 + uses: JamesIves/github-pages-deploy-action@v4 with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./build/doc/html # Directory containing the HTML documentation - if: ${{ github.event.release.tag_name }} - destination_dir: ./releases/${{ github.event.release.tag_name }} - keep_files: false - commit_message: Release ${{ github.event.release.tag_name }} - - + folder: ./build/doc + branch: gh-pages From 4ed593ba9e9d89279ed73b5f94f4cae1987837ad Mon Sep 17 00:00:00 2001 From: boxanm <47394922+boxanm@users.noreply.github.com> Date: Tue, 7 May 2024 11:07:37 -0400 Subject: [PATCH 07/14] Update update_documentation.yaml --- .github/workflows/update_documentation.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update_documentation.yaml b/.github/workflows/update_documentation.yaml index 7ac4683..bac9731 100644 --- a/.github/workflows/update_documentation.yaml +++ b/.github/workflows/update_documentation.yaml @@ -13,7 +13,7 @@ on: - published jobs: - build: + build-and-deploy: runs-on: ubuntu-latest steps: From 04ad8e02367c1b0c599f1fd65df647b14ad22a65 Mon Sep 17 00:00:00 2001 From: boxanm Date: Tue, 7 May 2024 11:27:18 -0400 Subject: [PATCH 08/14] Update documentation workflow --- .github/workflows/update_documentation.yaml | 27 +++++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/.github/workflows/update_documentation.yaml b/.github/workflows/update_documentation.yaml index bac9731..935d3e6 100644 --- a/.github/workflows/update_documentation.yaml +++ b/.github/workflows/update_documentation.yaml @@ -13,7 +13,7 @@ on: - published jobs: - build-and-deploy: + build: runs-on: ubuntu-latest steps: @@ -32,8 +32,25 @@ jobs: cmake .. make doc - - name: Deploy to GitHub Pages - uses: JamesIves/github-pages-deploy-action@v4 + - name: Setup Pages + id: pages + uses: actions/configure-pages@v3 + - name: Build with Jekyll + uses: actions/jekyll-build-pages@v1 with: - folder: ./build/doc - branch: gh-pages + source: ./build/doc + destination: ./_site + - name: Upload artifact + uses: actions/upload-pages-artifact@v2 + + # Deployment job + deploy: + environment: + name: github-pages + url: ${{steps.deployment.outputs.page_url}} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2 \ No newline at end of file From 392969aafede06faced5c69527d70631da65910f Mon Sep 17 00:00:00 2001 From: boxanm Date: Tue, 7 May 2024 11:30:18 -0400 Subject: [PATCH 09/14] Add missing permissions --- .github/workflows/update_documentation.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/update_documentation.yaml b/.github/workflows/update_documentation.yaml index 935d3e6..4a5b78c 100644 --- a/.github/workflows/update_documentation.yaml +++ b/.github/workflows/update_documentation.yaml @@ -48,6 +48,10 @@ jobs: environment: name: github-pages url: ${{steps.deployment.outputs.page_url}} + permissions: + pages: write # to deploy to Pages + id-token: write # to verify the deployment originates from an appropriate source + runs-on: ubuntu-latest needs: build steps: From 5a0a7195c2858c2e47e978201cd9b6e792c55f3d Mon Sep 17 00:00:00 2001 From: boxanm Date: Tue, 7 May 2024 11:35:20 -0400 Subject: [PATCH 10/14] Fix documentation path --- .github/workflows/update_documentation.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update_documentation.yaml b/.github/workflows/update_documentation.yaml index 4a5b78c..ea9f07d 100644 --- a/.github/workflows/update_documentation.yaml +++ b/.github/workflows/update_documentation.yaml @@ -38,7 +38,7 @@ jobs: - name: Build with Jekyll uses: actions/jekyll-build-pages@v1 with: - source: ./build/doc + source: ./build/doc/html destination: ./_site - name: Upload artifact uses: actions/upload-pages-artifact@v2 From 30105844fb63808fafd062e6c7082bb6de052062 Mon Sep 17 00:00:00 2001 From: boxanm Date: Tue, 7 May 2024 11:39:02 -0400 Subject: [PATCH 11/14] Remove temporary action triggers --- .github/workflows/update_documentation.yaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/update_documentation.yaml b/.github/workflows/update_documentation.yaml index ea9f07d..2ab25dc 100644 --- a/.github/workflows/update_documentation.yaml +++ b/.github/workflows/update_documentation.yaml @@ -4,14 +4,9 @@ on: push: branches: - master - - github-action-api-docs # Modify this to match your master branch name workflow_dispatch: # Allow manual triggering - release: - types: - - published - jobs: build: runs-on: ubuntu-latest From ddb5c3bc9c776aee0f788972c70d58f9279f068a Mon Sep 17 00:00:00 2001 From: boxanm Date: Tue, 7 May 2024 11:42:13 -0400 Subject: [PATCH 12/14] Update README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 91ab9b1..a6b2647 100644 --- a/README.md +++ b/README.md @@ -158,10 +158,10 @@ libnabo provides the following compilation options, available through [CMake]: ### Documentation -You can generate the documentation by typing: - - make doc - +You can access on https://norlab-ulaval.github.io/libnabo/. Alternatively, you can generate it locally by typing: +```bash +make doc +``` Prerequisites ------------- From 6b005847ca996153abca6c39c0e68b35b70bde4b Mon Sep 17 00:00:00 2001 From: boxanm Date: Sat, 18 May 2024 13:17:09 -0400 Subject: [PATCH 13/14] Update NABO_VERSION --- nabo/nabo.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nabo/nabo.h b/nabo/nabo.h index addb4a9..9d6963b 100644 --- a/nabo/nabo.h +++ b/nabo/nabo.h @@ -205,6 +205,12 @@ libnabo differs from \ref ANN on the following points: namespace Nabo { //! \defgroup public public interface + //@{ + + //! version of the Nabo library as string + #define NABO_VERSION "1.1.1" + //! version of the Nabo library as an int + #define NABO_VERSION_INT 10101 // TODO (c++14) Convert invalidIndex, invalidValue to constexpr templated variables. template From f9c1f11c68da67dddc1c2c0af637e30b6ff946e8 Mon Sep 17 00:00:00 2001 From: boxanm Date: Sat, 18 May 2024 13:17:33 -0400 Subject: [PATCH 14/14] Throw error when version number in package.xml is not filled --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d3bcdd4..a5f0c44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,7 @@ if(VERSION_MATCH) set(PROJECT_VERSION ${CMAKE_MATCH_1}) message(STATUS "Found package version: ${PROJECT_VERSION}") else() - message(WARNING "Package version not found in package.xml") + message(SEND_ERROR "Package version not found in package.xml") endif() if (NOT CMAKE_BUILD_TYPE)