|
| 1 | +--- |
| 2 | +name: Documentation |
| 3 | + |
| 4 | +# Builds Markdown documentation for core and addons. |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: |
| 9 | + - main |
| 10 | + - releasebranch_* |
| 11 | + pull_request: |
| 12 | + workflow_dispatch: |
| 13 | + |
| 14 | +permissions: {} |
| 15 | + |
| 16 | +jobs: |
| 17 | + ubuntu: |
| 18 | + concurrency: |
| 19 | + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} |
| 20 | + cancel-in-progress: true |
| 21 | + |
| 22 | + runs-on: ubuntu-22.04 |
| 23 | + env: |
| 24 | + PYTHONWARNINGS: always |
| 25 | + # renovate: datasource=python-version depName=python |
| 26 | + PYTHON_VERSION: "3.12" |
| 27 | + |
| 28 | + steps: |
| 29 | + - name: Checkout core |
| 30 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 31 | + with: |
| 32 | + repository: OSGeo/grass |
| 33 | + path: grass |
| 34 | + |
| 35 | + - name: Get dependencies |
| 36 | + run: | |
| 37 | + sudo apt-get update -y |
| 38 | + sudo apt-get install -y wget git gawk findutils |
| 39 | + xargs -a <(awk '! /^ *(#|$)/' "grass/.github/workflows/apt.txt") -r -- \ |
| 40 | + sudo apt-get install -y --no-install-recommends --no-install-suggests |
| 41 | +
|
| 42 | + - name: Set up Python |
| 43 | + uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 |
| 44 | + with: |
| 45 | + python-version: ${{ env.PYTHON_VERSION }} |
| 46 | + cache: pip |
| 47 | + |
| 48 | + - name: Create installation directory |
| 49 | + run: | |
| 50 | + mkdir "$HOME/install" |
| 51 | +
|
| 52 | + - name: Set number of cores for compilation |
| 53 | + run: | |
| 54 | + echo "MAKEFLAGS=-j$(nproc)" >> "$GITHUB_ENV" |
| 55 | +
|
| 56 | + - name: Set LD_LIBRARY_PATH for compilation |
| 57 | + run: | |
| 58 | + echo "LD_LIBRARY_PATH=$HOME/install/lib" >> "$GITHUB_ENV" |
| 59 | +
|
| 60 | + - name: Build core |
| 61 | + run: | |
| 62 | + cd grass |
| 63 | + ../grass/.github/workflows/build_ubuntu-22.04.sh "$HOME/install" |
| 64 | +
|
| 65 | + - name: Add the bin directory to PATH |
| 66 | + run: | |
| 67 | + echo "$HOME/install/bin" >> "$GITHUB_PATH" |
| 68 | +
|
| 69 | + - name: Print installed versions |
| 70 | + if: always() |
| 71 | + run: ./grass/.github/workflows/print_versions.sh |
| 72 | + |
| 73 | + - name: Test executing of the grass command |
| 74 | + run: ./grass/.github/workflows/test_simple.sh |
| 75 | + |
| 76 | + - name: Set version variables |
| 77 | + run: | |
| 78 | + cd grass |
| 79 | + eval $(./utils/update_version.py status --bash) |
| 80 | + echo "MAJOR=$MAJOR" >> $GITHUB_ENV |
| 81 | + echo "MINOR=$MINOR" >> $GITHUB_ENV |
| 82 | + echo "VERSION=$VERSION" >> $GITHUB_ENV |
| 83 | + echo "YEAR=$YEAR" >> $GITHUB_ENV |
| 84 | +
|
| 85 | + - name: Checkout addons |
| 86 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 87 | + with: |
| 88 | + repository: OSGeo/grass-addons |
| 89 | + ref: grass${{ env.MAJOR }} |
| 90 | + path: grass-addons |
| 91 | + |
| 92 | + - name: Compile addons |
| 93 | + continue-on-error: true |
| 94 | + run: | |
| 95 | + ./grass-addons/utils/cronjobs_osgeo_lxd/compile_addons_git.sh \ |
| 96 | + "$MAJOR" \ |
| 97 | + "$MINOR" \ |
| 98 | + $(pwd)/grass-addons/src \ |
| 99 | + $(grass --config path) \ |
| 100 | + $(pwd)/addons-build-dir \ |
| 101 | + grass |
| 102 | +
|
| 103 | + - name: Get target path for Markdown files |
| 104 | + run: | |
| 105 | + echo MKDOCS_DIR="$(grass --config path)/docs/mkdocs" >> "$GITHUB_ENV" |
| 106 | +
|
| 107 | + - name: Move from build to target directory |
| 108 | + continue-on-error: true |
| 109 | + run: | |
| 110 | + mkdir -p "$MKDOCS_DIR/source/addons" |
| 111 | + mv addons-build-dir/docs/md/source/* "$MKDOCS_DIR/source/addons" |
| 112 | +
|
| 113 | + - name: Rebuild keywords |
| 114 | + continue-on-error: true |
| 115 | + run: | |
| 116 | + export ARCH="linux" |
| 117 | + export ARCH_DISTDIR="$(grass --config path)" |
| 118 | + export TOP_DOCS_DIR="${ARCH_DISTDIR}/docs" |
| 119 | + export VERSION_NUMBER="$VERSION" |
| 120 | + grass --tmp-project XY --exec python grass/man/build_keywords.py "$TOP_DOCS_DIR" "$MKDOCS_DIR/source/addons" |
| 121 | +
|
| 122 | + - name: Get mkdocs |
| 123 | + run: | |
| 124 | + pip install -r "grass/man/mkdocs/requirements.txt" |
| 125 | +
|
| 126 | + - name: Run mkdocs |
| 127 | + run: | |
| 128 | + cd grass |
| 129 | + eval $(./utils/update_version.py status --bash) |
| 130 | + cd .. |
| 131 | + export SITE_NAME="GRASS GIS $VERSION Reference Manual" |
| 132 | + export COPYRIGHT="© 2003-$YEAR GRASS Development Team, GRASS GIS $VERSION Reference Manual" |
| 133 | + cd $MKDOCS_DIR |
| 134 | + mkdocs build |
| 135 | +
|
| 136 | + - name: Make logs available |
| 137 | + uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 |
| 138 | + with: |
| 139 | + name: grass-addon-build-logs |
| 140 | + if-no-files-found: warn |
| 141 | + path: addons-build-dir/docs/logs |
| 142 | + retention-days: 3 |
| 143 | + |
| 144 | + - name: Make the result available |
| 145 | + uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 |
| 146 | + with: |
| 147 | + name: mkdocs-site |
| 148 | + if-no-files-found: error |
| 149 | + path: ${{ env.MKDOCS_DIR }}/site |
| 150 | + retention-days: 3 |
0 commit comments