Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
91 changes: 91 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Docs

# Builds every docs site in strict mode: the frame site (docs/mkdocs.yml) and one site per module
# (beratools/modules/<module>/docs/mkdocs.yml), and puts them together as one GitHub Pages site: the
# frame site at the root and each module's site under /<module>/ (tests/test_docs_sites.py keeps the
# site URLs in line). Only the public BERATool/beratools repository deploys it, on pushes to main and
# by hand; elsewhere, and on pull requests, the sites are only built.

on:
workflow_dispatch:
pull_request:
branches:
- main
paths:
- 'docs/**'
- 'beratools/**'
- 'pyproject.toml'
- 'pixi.toml'
- 'pixi.lock'
- '.github/workflows/docs.yml'
push:
branches:
- main
paths:
- 'docs/**'
- 'beratools/**'
- 'pyproject.toml'
- 'pixi.toml'
- 'pixi.lock'
- '.github/workflows/docs.yml'

concurrency:
group: docs-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build-docs:
# a push to main only matters where the sites are deployed
if: github.event_name != 'push' || github.repository == 'BERATool/beratools'
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: read
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
fetch-depth: 0
- name: Set up Pixi environment
uses: prefix-dev/[email protected]
with:
cache: false
- name: Build every docs site (strict)
run: |
status=0
for site in docs/mkdocs.yml beratools/modules/*/docs/mkdocs.yml; do
echo "::group::$site"
pixi run zensical build --strict --clean -f "$site" || { echo "::error file=$site::docs build failed"; status=1; }
echo "::endgroup::"
done
exit $status
- name: Put the sites together
run: |
mkdir _site
cp -r docs/site/. _site/
for docs in beratools/modules/*/docs; do
module=$(basename "$(dirname "$docs")")
cp -r "$docs/site" "_site/$module"
done
- name: Upload Pages artifact
if: github.repository == 'BERATool/beratools' && github.event_name != 'pull_request'
uses: actions/upload-pages-artifact@v3
with:
path: _site

deploy:
if: github.repository == 'BERATool/beratools' && github.event_name != 'pull_request'
needs: build-docs
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
66 changes: 0 additions & 66 deletions .github/workflows/mkdocs-gh-pages.yml

This file was deleted.

13 changes: 6 additions & 7 deletions .github/workflows/publish_to_anaconda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,11 @@ jobs:
RELEASE_TAG: ${{ steps.source.outputs.release_tag }}
run: |
set -euo pipefail
if [[ "$PUBLISH" == "true" ]]; then
version="$RELEASE_TAG"
else
version="$(pixi run python -c "from setuptools_scm import get_version; print(get_version(root='.'))")"
# the version is set in beratools/__init__.py; a release tag must match it
version="$(pixi run python -c "import beratools; print(beratools.__version__)")"
if [[ "$PUBLISH" == "true" && "$version" != "$RELEASE_TAG" ]]; then
echo "Release tag $RELEASE_TAG does not match __version__ $version in beratools/__init__.py." >&2
exit 1
fi

if [[ ! "$version" =~ ^[0-9][0-9A-Za-z.+_-]*$ ]]; then
Expand All @@ -93,14 +94,12 @@ jobs:

echo "version=$version" >> "$GITHUB_OUTPUT"
echo "VERSION=$version" >> "$GITHUB_ENV"
echo "SETUPTOOLS_SCM_PRETEND_VERSION=$version" >> "$GITHUB_ENV"
echo "Package version: $version"

- name: Build Conda package
working-directory: packaging
env:
VERSION: ${{ steps.package.outputs.version }}
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ steps.package.outputs.version }}
run: |
set -euo pipefail
echo "🏗️ Building version: $VERSION"
Expand Down Expand Up @@ -167,7 +166,7 @@ jobs:
micromamba run -n bera-conda-smoke beratools --help

echo "🧪 Running package integration test"
micromamba run -n bera-conda-smoke pytest tests/test_workflow.py --maxfail=1 -q
micromamba run -n bera-conda-smoke pytest beratools/modules/mapping/tests/test_workflow.py --maxfail=1 -q

- name: Upload to Anaconda.org (binstar)
if: steps.source.outputs.publish == 'true'
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/publish_to_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,13 @@ jobs:
printf 'release_tag=%s\npublish=%s\n' "$tag" "$publish" >> "$GITHUB_OUTPUT"
printf '### Publishing source\n\n- Mode: `%s`\n- Tag: `%s`\n- Source commit: `%s`\n- Workflow commit: `%s`\n' \
"$mode" "${tag:-none}" "$source_sha" "$GITHUB_SHA" >> "$GITHUB_STEP_SUMMARY"
- name: Set release version
if: steps.source.outputs.publish == 'true'
env:
RELEASE_TAG: ${{ steps.source.outputs.release_tag }}
run: echo "SETUPTOOLS_SCM_PRETEND_VERSION=$RELEASE_TAG" >> "$GITHUB_ENV"
- name: Install build tools
run: pip install build twine hatch-vcs
run: pip install build twine
- name: Build package
run: python -m build
- name: Check package metadata
run: python -m twine check --strict dist/*
# the version comes from beratools/__init__.py; a tag that doesn't match it stops the release
- name: Verify release package version
if: steps.source.outputs.publish == 'true'
env:
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/python-compatibility-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
compatibility:
name: Tox / Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
timeout-minutes: 20
timeout-minutes: 8
permissions:
contents: read
strategy:
Expand Down Expand Up @@ -54,13 +54,18 @@ jobs:
scikit-image>=0.24
tqdm
xarray-spatial
numba
python-igraph
tabulate
jsonschema
psutil
laspy
lazrs-python
scipy
pip
pytest
pytest-qt
tox
psutil
condarc: |
channel_priority: strict
channels:
Expand Down
15 changes: 13 additions & 2 deletions .github/workflows/python-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ concurrency:
jobs:
integration:
name: Pixi integration
timeout-minutes: 30
# R packages for the PC2Products tools come prebuilt from conda-forge on linux-64 (see pixi.toml)
timeout-minutes: 60
runs-on: ubuntu-latest
permissions:
contents: read
Expand All @@ -47,5 +48,15 @@ jobs:
cache: false

- name: Run integration tests
run: pixi run pytest --cov=beratools --cov-report=term tests/test_workflow.py --maxfail=1 --disable-warnings -s -v --log-cli-level=INFO
run: pixi run pytest --cov=beratools --cov-report=term beratools/modules/mapping/tests/test_workflow.py --maxfail=1 --disable-warnings -s -v --log-cli-level=INFO

- name: Install Ubuntu dependencies for R
run: |
sudo apt-get update
sudo apt-get install -y libudunits2-dev libgdal-dev libgeos-dev libproj-dev libgl1-mesa-dev libglu1-mesa-dev

- name: Run R environment test (installs missing R packages into the pixi R)
run: pixi run pytest beratools/modules/pc2products/tests/test_r_environment.py --maxfail=1 --disable-warnings -v --log-cli-level=INFO

- name: Run PC2Products workflow test
run: pixi run pytest --cov=beratools --cov-report=term beratools/modules/pc2products/tests/test_r_workflow.py --maxfail=1 --disable-warnings -v --log-cli-level=INFO
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ _build
.aider.*
.ignore
/docs/site
/beratools/modules/*/docs/site

# PC2Products tool outputs from the LiDAR tests
beratools/modules/pc2products/tests/data/LiDAR/Classified_PC
beratools/modules/pc2products/tests/data/LiDAR/Normalized_PC
beratools/modules/pc2products/tests/data/LiDAR/Raster_Output
# Spatial indexes the LiDAR tools build next to their inputs, and the local large-file test data
**/tests/data/**/*.lax
**/tests/data/LiDAR/Large_PC
**/tests/data/LiDAR/Real_Lidar
# Hydra run logs from examples/full_workflow.py
outputs/
Loading
Loading