Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
ef62eec
feat: add comprehensive CI/CD pipeline with GitHub Actions
andrewkern Jul 6, 2025
e80f2b5
feat: add pre-commit hooks and format codebase
andrewkern Jul 7, 2025
d662991
fix: resolve ALL flake8 errors and apply black formatting
andrewkern Jul 7, 2025
58edd6b
style: apply pre-commit formatting to CI/CD and test files
andrewkern Jul 7, 2025
aef95e5
remove: remove deprecated code
andrewkern Jul 7, 2025
b1472f1
fix: remove duplicate pytest coverage arguments in CI
andrewkern Jul 7, 2025
809a4c9
fix: add missing pytest plugins and simplify pytest configuration
andrewkern Jul 7, 2025
ea2b7ae
fix: resolve test failures from missing imports and boolean comparisons
andrewkern Jul 7, 2025
df5ca68
fix: handle GPU availability in test_doc_examples
andrewkern Jul 7, 2025
1a579c4
fix: correct .gitignore to not exclude locator/data Python package
andrewkern Jul 7, 2025
8905318
fix: remove non-existent WindowGenerator import from data/__init__.py
andrewkern Jul 7, 2025
f53d451
fix: change ci python versions
andrewkern Jul 7, 2025
d50255a
fix: resolve documentation build warnings
andrewkern Jul 7, 2025
f9bb1ed
chore: add example/demo_output/ to .gitignore
andrewkern Jul 7, 2025
806f426
fix: improve docs build workflow to handle warnings properly
andrewkern Jul 7, 2025
16cd75c
fix: fix docs build workflow
andrewkern Jul 7, 2025
632f978
fix: doc workflow build location path fixed
andrewkern Jul 7, 2025
818a3ff
chore: tidy up old files we don't need
andrewkern Jul 7, 2025
fadaf2d
fix: had to update test.yml
andrewkern Jul 7, 2025
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
20 changes: 19 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,2 +1,20 @@
[flake8]
max-line-length = 89
max-line-length = 89
extend-ignore = E203, E266, E501, W503, E402, D100, D103, D200, D205, D301, D400, D401, B006, B007, B008, B023, B028, C401, C408, C419, SIM102, SIM105, SIM114, SIM117, SIM118, SIM201, SIM907, SIM910
max-complexity = 10
exclude =
.git,
__pycache__,
docs/source/conf.py,
old,
build,
dist,
.eggs,
*.egg,
work/,
out/
per-file-ignores =
__init__.py:F401,F403
tests/*:F401,F403,E501
locator/prediction.py:C901
scripts/locator_phased.py:C901
70 changes: 70 additions & 0 deletions .github/CI_CD_SETUP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# CI/CD Setup for Locator

This repository uses GitHub Actions for continuous integration and deployment.

## Workflows

### 1. Tests (`.github/workflows/test.yml`)
- **Triggers**: Push and pull requests to main/develop branches
- **Python versions**: 3.9, 3.10, 3.11
- **Features**:
- Parallel test execution with pytest-xdist (`-n auto`)
- Coverage reporting with pytest-cov
- CPU-only mode (no GPU required)
- Dependency caching for faster runs
- Code linting with black, isort, and flake8

### 2. Documentation (`.github/workflows/docs.yml`)
- Builds Sphinx documentation
- Checks for documentation warnings
- Uploads built docs as artifacts

### 3. Publishing (`.github/workflows/publish.yml`)
- Triggered on GitHub releases
- Publishes to PyPI and Test PyPI
- Requires secrets: `PYPI_API_TOKEN`, `TEST_PYPI_API_TOKEN`

### 4. Manual Testing (`.github/workflows/manual-test.yml`)
- Allows manual workflow triggers
- Configurable Python version and test patterns

## Local Testing

Run tests locally with parallel execution:
```bash
# Run all tests in parallel
pytest -n auto

# Run with 4 workers
pytest -n 4

# Run without GPU (recommended)
CUDA_VISIBLE_DEVICES=-1 pytest -n auto

# Run specific test file
pytest tests/test_verbosity_control.py -n auto

# Run with coverage
pytest -n auto --cov=locator --cov-report=html
```

## Configuration

- **pytest configuration**: See `pyproject.toml`
- **Coverage settings**: See `pyproject.toml`
- **Dependabot**: See `.github/dependabot.yml`

## Required Secrets (for publishing)

Set these in your GitHub repository settings:
- `CODECOV_TOKEN` (optional, for private repos)
- `PYPI_API_TOKEN` (for PyPI publishing)
- `TEST_PYPI_API_TOKEN` (for Test PyPI publishing)

## Status Badges

Add these to your README.md:
```markdown
[![Tests](https://github.com/YOUR_USERNAME/relocator/actions/workflows/test.yml/badge.svg)](https://github.com/YOUR_USERNAME/relocator/actions/workflows/test.yml)
[![codecov](https://codecov.io/gh/YOUR_USERNAME/relocator/branch/main/graph/badge.svg)](https://codecov.io/gh/YOUR_USERNAME/relocator)
```
44 changes: 44 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
name: Bug report
about: Create a report to help us improve
title: '[BUG] '
labels: 'bug'
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Code example or command that causes the issue
2. Input data characteristics (if relevant)
3. Error message or unexpected output

```python
# Minimal reproducible example
import locator

# Your code here
```

**Expected behavior**
A clear and concise description of what you expected to happen.

**Error messages**
If applicable, paste the full error traceback here.

```
# Error traceback
```

**Environment (please complete the following information):**
- OS: [e.g. Ubuntu 22.04]
- Python version: [e.g. 3.11.5]
- TensorFlow version: [e.g. 2.15.0]
- Locator version: [e.g. 1.0.0]
- CUDA/GPU info (if relevant): [e.g. CUDA 12.1, RTX 4090]

**Additional context**
Add any other context about the problem here.
30 changes: 30 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: Feature request
about: Suggest an idea for this project
title: '[FEATURE] '
labels: 'enhancement'
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Example use case**
Provide a code example of how you would like to use this feature:

```python
# Example of desired API
import locator

# Your example here
```

**Additional context**
Add any other context or screenshots about the feature request here.
36 changes: 36 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
version: 2
updates:
# Enable version updates for Python dependencies
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
time: "04:00"
open-pull-requests-limit: 5
reviewers:
- "adkern"
labels:
- "dependencies"
- "python"
ignore:
# Ignore major version updates for stable dependencies
- dependency-name: "tensorflow*"
update-types: ["version-update:semver-major"]
- dependency-name: "numpy"
update-types: ["version-update:semver-major"]
- dependency-name: "pandas"
update-types: ["version-update:semver-major"]

# Enable version updates for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
time: "04:00"
reviewers:
- "adkern"
labels:
- "dependencies"
- "github-actions"
39 changes: 39 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
## Description

Please include a summary of the changes and which issue is fixed. Include relevant motivation and context.

Fixes #(issue)

## Type of change

Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Documentation update
- [ ] Performance improvement
- [ ] Code refactoring

## How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.

- [ ] Test A
- [ ] Test B

**Test Configuration**:
* Python version:
* TensorFlow version:
* Operating System:

## Checklist:

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules
12 changes: 12 additions & 0 deletions .github/workflows/badges.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# GitHub Actions Status Badges

Add these badges to your README.md:

```markdown
[\![Tests](https://github.com/YOUR_USERNAME/relocator/actions/workflows/test.yml/badge.svg)](https://github.com/YOUR_USERNAME/relocator/actions/workflows/test.yml)
[\![codecov](https://codecov.io/gh/YOUR_USERNAME/relocator/branch/main/graph/badge.svg)](https://codecov.io/gh/YOUR_USERNAME/relocator)
[\![Documentation](https://github.com/YOUR_USERNAME/relocator/actions/workflows/docs.yml/badge.svg)](https://github.com/YOUR_USERNAME/relocator/actions/workflows/docs.yml)
```

Replace YOUR_USERNAME with your GitHub username or organization name.
EOF < /dev/null
69 changes: 69 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Documentation

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build-docs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Cache pip packages
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-docs-${{ hashFiles('**/setup.py', '**/requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-docs-
${{ runner.os }}-pip-

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libproj-dev proj-data proj-bin libgeos-dev
sudo apt-get install -y pandoc

- name: Install package with docs dependencies
env:
CUDA_VISIBLE_DEVICES: "-1"
run: |
python -m pip install --upgrade pip
pip install wheel
pip install -e ".[docs]"

- name: Build documentation
run: |
cd docs
make clean
make html

- name: Check for documentation warnings
run: |
cd docs
# Build docs and capture output
make html 2>&1 | tee build_output.txt

# Check for warnings, excluding known harmless ones
if grep -i "warning" build_output.txt | grep -v "Protobuf gencode version" | grep -v "UserWarning" | grep -v "warnings\.warn" | grep -q .; then
echo "Documentation build produced warnings (excluding protobuf warnings):"
grep -i "warning" build_output.txt | grep -v "Protobuf gencode version" | grep -v "UserWarning" | grep -v "warnings\.warn"
exit 1
fi

echo "Documentation build completed successfully (protobuf warnings ignored)"

- name: Upload documentation artifacts
uses: actions/upload-artifact@v4
with:
name: documentation
path: docs/build/html/
Loading
Loading