From 6bc3fe9b17c3974e1ef50138499adab0077ec6ce Mon Sep 17 00:00:00 2001 From: Vaclav Petras Date: Wed, 19 Feb 2025 17:37:38 -0500 Subject: [PATCH 01/10] CI: Add workflow to build mkdocs in GHA Build core and addons, then create mkdocs site as an artifact. Ignore errors with addons. --- .github/workflows/mkdocs.yml | 116 +++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 .github/workflows/mkdocs.yml diff --git a/.github/workflows/mkdocs.yml b/.github/workflows/mkdocs.yml new file mode 100644 index 00000000000..06b1c5781da --- /dev/null +++ b/.github/workflows/mkdocs.yml @@ -0,0 +1,116 @@ +--- +name: Ubuntu + +# Build documentation + +on: + push: + branches: + - main + - releasebranch_* + pull_request: + +permissions: {} + +jobs: + ubuntu: + concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + + runs-on: ubuntu-22.04 + env: + PYTHONWARNINGS: always + + steps: + - name: Checkout core + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + repository: OSGeo/grass + ref: ${{ matrix.grass-version }} + path: grass + + - name: Checkout addons + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + path: grass-addons + + - name: Get dependencies + run: | + sudo apt-get update -y + sudo apt-get install -y wget git gawk findutils + xargs -a <(awk '! /^ *(#|$)/' "grass/.github/workflows/apt.txt") -r -- \ + sudo apt-get install -y --no-install-recommends --no-install-suggests + + - name: Create installation directory + run: | + mkdir "$HOME/install" + + - name: Set number of cores for compilation + run: | + echo "MAKEFLAGS=-j$(nproc)" >> "$GITHUB_ENV" + + - name: Set LD_LIBRARY_PATH for compilation + run: | + echo "LD_LIBRARY_PATH=$HOME/install/lib" >> "$GITHUB_ENV" + + - name: Build core + run: | + cd grass + ../grass/.github/workflows/build_ubuntu-22.04.sh "$HOME/install" + + - name: Add the bin directory to PATH + run: | + echo "$HOME/install/bin" >> "$GITHUB_PATH" + + - name: Print installed versions + if: always() + run: .github/workflows/print_versions.sh + + - name: Test executing of the grass command + run: .github/workflows/test_simple.sh + + - name: Compile addons + continue-on-error: true + run: | + cd grass + eval $(./utils/update_version.py status --bash) + cd .. + ./grass-addons/utils/cronjobs_osgeo_lxd/compile_addons_git.sh \ + "$MAJOR" \ + "$MINOR" \ + $(pwd)/grass-addons/src \ + $(grass --config path) \ + $(pwd)/addons-build-dir \ + grass + + - name: Create env variable + run: | + echo "echo MKDOCS_DIR=$(grass --config path)/docs/mkdocs" >> "$GITHUB_ENV" + + - name: Compile addons + continue-on-error: true + run: | + mkdir -p "$MKDOCS_DIR/source/addons" + mv addons-build-dir/docs/md/source/* "$MKDOCS_DIR/source/addons" + + - name: Get mkdocs + run: | + pip install -r "grass/man/mkdocs/requirements.txt" + + - name: Run mkdocs + run: | + cd grass + eval $(./utils/update_version.py status --bash) + cd .. + export SITE_NAME="GRASS GIS $(VERSION) Reference Manual" + export COPYRIGHT="© 2003-$(YEAR) GRASS Development Team, GRASS GIS $(VERSION) Reference Manual" + cd $MKDOCS_DIR + mkdocs build + + - name: Make HTML test report available + uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 + with: + name: mkdocs-site-${{ matrix.os }}-${{ matrix.config }}-${{ matrix.extra-include }} + path: ${{ env.MKDOCS_DIR }}/site + retention-days: 3 From 97b638a69a0a696978733cb415448cd0aa3a3c96 Mon Sep 17 00:00:00 2001 From: Vaclav Petras Date: Wed, 19 Feb 2025 19:43:35 -0500 Subject: [PATCH 02/10] Fix paths to aux scripts --- .github/workflows/mkdocs.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/mkdocs.yml b/.github/workflows/mkdocs.yml index 06b1c5781da..97ca899e577 100644 --- a/.github/workflows/mkdocs.yml +++ b/.github/workflows/mkdocs.yml @@ -65,10 +65,10 @@ jobs: - name: Print installed versions if: always() - run: .github/workflows/print_versions.sh + run: ./grass/.github/workflows/print_versions.sh - name: Test executing of the grass command - run: .github/workflows/test_simple.sh + run: ./grass/.github/workflows/test_simple.sh - name: Compile addons continue-on-error: true @@ -108,7 +108,7 @@ jobs: cd $MKDOCS_DIR mkdocs build - - name: Make HTML test report available + - name: Make the result available uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 with: name: mkdocs-site-${{ matrix.os }}-${{ matrix.config }}-${{ matrix.extra-include }} From 7ef7e948935d5aa7c8648bd01b185f753e38592f Mon Sep 17 00:00:00 2001 From: Vaclav Petras Date: Wed, 19 Feb 2025 20:19:10 -0500 Subject: [PATCH 03/10] Fix vars, dir, name --- .github/workflows/mkdocs.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/mkdocs.yml b/.github/workflows/mkdocs.yml index 97ca899e577..27612dca592 100644 --- a/.github/workflows/mkdocs.yml +++ b/.github/workflows/mkdocs.yml @@ -1,5 +1,5 @@ --- -name: Ubuntu +name: Documentation # Build documentation @@ -86,7 +86,7 @@ jobs: - name: Create env variable run: | - echo "echo MKDOCS_DIR=$(grass --config path)/docs/mkdocs" >> "$GITHUB_ENV" + echo MKDOCS_DIR="$(grass --config path)/docs/mkdocs" >> "$GITHUB_ENV" - name: Compile addons continue-on-error: true @@ -103,8 +103,8 @@ jobs: cd grass eval $(./utils/update_version.py status --bash) cd .. - export SITE_NAME="GRASS GIS $(VERSION) Reference Manual" - export COPYRIGHT="© 2003-$(YEAR) GRASS Development Team, GRASS GIS $(VERSION) Reference Manual" + export SITE_NAME="GRASS GIS $VERSION Reference Manual" + export COPYRIGHT="© 2003-$YEAR GRASS Development Team, GRASS GIS $VERSION Reference Manual" cd $MKDOCS_DIR mkdocs build From 4bf32ad3213714adda7685fb8dc150e100656406 Mon Sep 17 00:00:00 2001 From: Vaclav Petras Date: Wed, 19 Feb 2025 22:17:20 -0500 Subject: [PATCH 04/10] Get the right repo, fix artifact name --- .github/workflows/mkdocs.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/mkdocs.yml b/.github/workflows/mkdocs.yml index 27612dca592..4e9682e281b 100644 --- a/.github/workflows/mkdocs.yml +++ b/.github/workflows/mkdocs.yml @@ -27,12 +27,14 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: repository: OSGeo/grass - ref: ${{ matrix.grass-version }} path: grass - name: Checkout addons uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: + repository: OSGeo/grass-addons + # This could be taken from the source code by the utils script. + ref: grass8 path: grass-addons - name: Get dependencies @@ -111,6 +113,6 @@ jobs: - name: Make the result available uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 with: - name: mkdocs-site-${{ matrix.os }}-${{ matrix.config }}-${{ matrix.extra-include }} + name: mkdocs-site path: ${{ env.MKDOCS_DIR }}/site retention-days: 3 From f03a23cebe1821525846d88bca0a01206f53593d Mon Sep 17 00:00:00 2001 From: Vaclav Petras Date: Thu, 20 Feb 2025 00:03:44 -0500 Subject: [PATCH 05/10] Get addons according to the version (breaks for major version transitions when addons branch may not exist), rebuild keywords, rename file --- .../{mkdocs.yml => documentation.yml} | 47 +++++++++++++------ 1 file changed, 33 insertions(+), 14 deletions(-) rename .github/workflows/{mkdocs.yml => documentation.yml} (77%) diff --git a/.github/workflows/mkdocs.yml b/.github/workflows/documentation.yml similarity index 77% rename from .github/workflows/mkdocs.yml rename to .github/workflows/documentation.yml index 4e9682e281b..e884082db28 100644 --- a/.github/workflows/mkdocs.yml +++ b/.github/workflows/documentation.yml @@ -1,7 +1,7 @@ --- name: Documentation -# Build documentation +# Builds Markdown documentation for core and addons. on: push: @@ -29,14 +29,6 @@ jobs: repository: OSGeo/grass path: grass - - name: Checkout addons - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - repository: OSGeo/grass-addons - # This could be taken from the source code by the utils script. - ref: grass8 - path: grass-addons - - name: Get dependencies run: | sudo apt-get update -y @@ -44,6 +36,12 @@ jobs: xargs -a <(awk '! /^ *(#|$)/' "grass/.github/workflows/apt.txt") -r -- \ sudo apt-get install -y --no-install-recommends --no-install-suggests + - name: Set up Python + uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 + with: + python-version: 3.12 + cache: pip + - name: Create installation directory run: | mkdir "$HOME/install" @@ -72,12 +70,25 @@ jobs: - name: Test executing of the grass command run: ./grass/.github/workflows/test_simple.sh - - name: Compile addons - continue-on-error: true + - name: Set version variables run: | cd grass eval $(./utils/update_version.py status --bash) - cd .. + echo "MAJOR=$MAJOR" >> $GITHUB_ENV + echo "MINOR=$MINOR" >> $GITHUB_ENV + echo "VERSION=$VERSION" >> $GITHUB_ENV + echo "YEAR=$YEAR" >> $GITHUB_ENV + + - name: Checkout addons + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + repository: OSGeo/grass-addons + ref: grass${{ env.MAJOR }} + path: grass-addons + + - name: Compile addons + continue-on-error: true + run: | ./grass-addons/utils/cronjobs_osgeo_lxd/compile_addons_git.sh \ "$MAJOR" \ "$MINOR" \ @@ -86,16 +97,24 @@ jobs: $(pwd)/addons-build-dir \ grass - - name: Create env variable + - name: Get target path for Markdown files run: | echo MKDOCS_DIR="$(grass --config path)/docs/mkdocs" >> "$GITHUB_ENV" - - name: Compile addons + - name: Move from build to target directory continue-on-error: true run: | mkdir -p "$MKDOCS_DIR/source/addons" mv addons-build-dir/docs/md/source/* "$MKDOCS_DIR/source/addons" + - name: Rebuild keywords + continue-on-error: true + run: | + export ARCH_DISTDIR="$(grass --config path)" + export TOP_DOCS_DIR="${ARCH_DISTDIR}/docs" + export VERSION_NUMBER="$VERSION" + grass --tmp-project XY --exec python grass/man/build_keywords.py "$TOP_DOCS_DIR" "$MKDOCS_DIR/source/addons" + - name: Get mkdocs run: | pip install -r "grass/man/mkdocs/requirements.txt" From 48bb113b05d9181866453bf05e79415bd56eddf3 Mon Sep 17 00:00:00 2001 From: Vaclav Petras Date: Thu, 20 Feb 2025 00:39:16 -0500 Subject: [PATCH 06/10] ARCH needs to be defined (any value should do), make addon build logs available --- .github/workflows/documentation.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index e884082db28..8692593f014 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -39,7 +39,7 @@ jobs: - name: Set up Python uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 with: - python-version: 3.12 + python-version: "3.12" cache: pip - name: Create installation directory @@ -110,6 +110,7 @@ jobs: - name: Rebuild keywords continue-on-error: true run: | + export ARCH="linux" export ARCH_DISTDIR="$(grass --config path)" export TOP_DOCS_DIR="${ARCH_DISTDIR}/docs" export VERSION_NUMBER="$VERSION" @@ -135,3 +136,11 @@ jobs: name: mkdocs-site path: ${{ env.MKDOCS_DIR }}/site retention-days: 3 + + - name: Make logs available + uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 + continue-on-error: true + with: + name: grass-addon-build-logs + path: mv addons-build-dir/docs/logs + retention-days: 3 From 3aff270afd73138c87b07a8535d247600cb0e79b Mon Sep 17 00:00:00 2001 From: Vaclav Petras Date: Sat, 22 Feb 2025 21:48:58 -0500 Subject: [PATCH 07/10] Use if-no-files-found, renovate, fix mv typo --- .github/workflows/documentation.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 8692593f014..e2064c88321 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -21,6 +21,8 @@ jobs: runs-on: ubuntu-22.04 env: PYTHONWARNINGS: always + # renovate: datasource=python-version depName=python + PYTHON_VERSION: "3.12" steps: - name: Checkout core @@ -39,7 +41,7 @@ jobs: - name: Set up Python uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 with: - python-version: "3.12" + python-version: ${{ env.PYTHON_VERSION }} cache: pip - name: Create installation directory @@ -134,13 +136,14 @@ jobs: uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 with: name: mkdocs-site + if-no-files-found: warn path: ${{ env.MKDOCS_DIR }}/site retention-days: 3 - name: Make logs available uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 - continue-on-error: true + if-no-files-found: warn with: name: grass-addon-build-logs - path: mv addons-build-dir/docs/logs + path: addons-build-dir/docs/logs retention-days: 3 From 15c46812dbddf0b958eb11083818e5cf86468dbd Mon Sep 17 00:00:00 2001 From: Vaclav Petras Date: Sat, 22 Feb 2025 21:56:23 -0500 Subject: [PATCH 08/10] Correct place for if-no-files-found: warn --- .github/workflows/documentation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index e2064c88321..69c467769f7 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -142,8 +142,8 @@ jobs: - name: Make logs available uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 - if-no-files-found: warn with: name: grass-addon-build-logs + if-no-files-found: warn path: addons-build-dir/docs/logs retention-days: 3 From 32a6ae7c137c59337fdee8611594516c38d19823 Mon Sep 17 00:00:00 2001 From: Vaclav Petras Date: Sat, 22 Feb 2025 22:31:28 -0500 Subject: [PATCH 09/10] Remove copy-pased trailing whitespace --- .github/workflows/documentation.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 69c467769f7..062637646e4 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -21,8 +21,8 @@ jobs: runs-on: ubuntu-22.04 env: PYTHONWARNINGS: always - # renovate: datasource=python-version depName=python - PYTHON_VERSION: "3.12" + # renovate: datasource=python-version depName=python + PYTHON_VERSION: "3.12" steps: - name: Checkout core From b68bda9ad61005e09e544880bf9d3941971024c6 Mon Sep 17 00:00:00 2001 From: Vaclav Petras Date: Sat, 22 Feb 2025 23:16:15 -0500 Subject: [PATCH 10/10] Add workflow trigger, get the logs before the docs, fails if no docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Edouard Choinière <27212526+echoix@users.noreply.github.com> --- .github/workflows/documentation.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 062637646e4..536b0d1791f 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -9,6 +9,7 @@ on: - main - releasebranch_* pull_request: + workflow_dispatch: permissions: {} @@ -132,18 +133,18 @@ jobs: cd $MKDOCS_DIR mkdocs build - - name: Make the result available + - name: Make logs available uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 with: - name: mkdocs-site + name: grass-addon-build-logs if-no-files-found: warn - path: ${{ env.MKDOCS_DIR }}/site + path: addons-build-dir/docs/logs retention-days: 3 - - name: Make logs available + - name: Make the result available uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 with: - name: grass-addon-build-logs - if-no-files-found: warn - path: addons-build-dir/docs/logs + name: mkdocs-site + if-no-files-found: error + path: ${{ env.MKDOCS_DIR }}/site retention-days: 3