Skip to content
Draft
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ jobs:
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}

- name: Autobuild
uses: github/codeql-action/autobuild@v4
build-mode: none

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
Expand Down
43 changes: 27 additions & 16 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,39 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

env:
UV_VERSION: '0.7.12'

jobs:
pre-commit:
name: Run pre-commit # https://pre-commit.com/
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version:
- '3.10'
steps:
- name: 'Checkout ${{ github.ref }} ( ${{ github.sha }} )'
uses: actions/checkout@v5
- uses: actions/setup-python@v6 # https://www.python.org/
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
with:
persist-credentials: false
- uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41
with:
python-version: '3.10' # Version range or exact version of a Python version to use, using SemVer's version range syntax
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
- name: Install dependencies # https://pip.pypa.io/en/stable/
run: |
python -m pip install --upgrade pip
pip install pre-commit
- name: set PY
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- uses: actions/cache@v4
version: ${{ env.UV_VERSION }}

- name: Install dependencies
run: uv sync --all-groups

- name: Cache pre-commit data
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}

- name: Run pre-commit
run: pre-commit run --color=always --all-files
run: uv run prek run --show-diff-on-failure --color=always --all-files
- name: Run manual pre-commit hooks
run: pre-commit run --color=always --all-files --hook-stage manual
run: uv run prek run --show-diff-on-failure --color=always --all-files --hook-stage manual
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,12 @@ repos:
description: check spelling with codespell
args: [--ignore-words=.github/linters/codespell.txt]
exclude: ^docs/image|^spark/common/src/test/resources|^docs/usecases|^tools/maven/scalafmt|osmpbf/build|^docker/zeppelin|^docs-overrides
- repo: https://github.com/gitleaks/gitleaks
rev: v8.28.0
hooks:
- id: gitleaks
name: run gitleaks
description: check for secrets with gitleaks
# - repo: https://github.com/gitleaks/gitleaks
# rev: v8.28.0
# hooks:
# - id: gitleaks
# name: run gitleaks
# description: check for secrets with gitleaks
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
Expand Down
63 changes: 34 additions & 29 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,49 +15,54 @@
# specific language governing permissions and limitations
# under the License.

PYTHON := $(shell command -v python || command -v python3 || echo python)
PIP := $(PYTHON) -m pip
.PHONY: check check-from-ref check-install check-last check-stage clean docsbuild docsinstall install run-docs \
sync-no-dev update update-deps

.PHONY: check checkinstall checkupdate install docsinstall docsbuild clean test
check: install ## run all pre-commit checks
prek run --all-files

check:
@echo "Running pre-commit checks..."
@if ! command -v pre-commit >/dev/null 2>&1; then \
echo "Error: pre-commit is not installed. Run 'make checkinstall' first."; \
exit 1; \
fi
pre-commit run --all-files
check-from-ref: install ## will run prek checks for all changes since you branched off
prek run --from-ref main

checkinstall:
@echo "Installing pre-commit..."
@if ! command -v pre-commit >/dev/null 2>&1; then \
$(PIP) install pre-commit; \
fi
pre-commit install
check-install: ## checks for a uv installation
@command -v uv >/dev/null 2>&1 || (echo 'uv not found, install via: curl -LsSf https://astral.sh/uv/install.sh | sh' && exit 1)

checkupdate: checkinstall
@echo "Updating pre-commit hooks..."
pre-commit autoupdate
check-last: install ## will run pre-commit checks on last commit only
prek --last-commit

install: checkinstall
check-stage: install ## runs check on currently staged changes
prek

docsinstall:
@echo "Installing documentation dependencies..."
@command -v uv >/dev/null 2>&1 || (echo 'uv not found, install via: curl -LsSf https://astral.sh/uv/install.sh | sh' && exit 1)
uv sync --group docs
clean:
@echo "Cleaning up generated files... (TODO)"
rm -rf __pycache__
rm -rf .mypy_cache
rm -rf .pytest_cache

docsbuild: docsinstall
@echo "Building documentation..."
uv run mkdocs build
uv run mike deploy --update-aliases latest-snapshot -b website -p
uv run mike serve

clean:
@echo "Cleaning up generated files... (TODO)"
rm -rf __pycache__
rm -rf .mypy_cache
rm -rf .pytest_cache
docsinstall: check-install
@echo "Installing documentation dependencies..."
uv sync --group docs

install: check-install ## Sync all dependencies (including development) using uv
uv sync --all-groups

run-docs:
docker build -f docker/docs/Dockerfile -t mkdocs-sedona .
docker run --rm -it -p 8000:8000 -v ${PWD}:/docs mkdocs-sedona

sync-no-dev: check-install ## Sync non-development dependencies using uv
uv sync --no-dev

update: install
prek auto-update

update-deps: check-install ## Update pre-commit hooks and dependency locks
prek auto-update || :
uv lock --upgrade
uv sync --all-groups
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,6 @@ docs = [
"sphinx_rtd_theme",
"sphinx-autobuild",
]
dev = [
"prek>=0.2.19"
]