Skip to content

Commit ef62eec

Browse files
committed
feat: add comprehensive CI/CD pipeline with GitHub Actions
- Add test workflow with parallel execution using pytest-xdist - Support multi-Python version testing (3.9, 3.10, 3.11) - Configure CPU-only mode to prevent GPU conflicts in CI - Add coverage reporting with pytest-cov and Codecov integration - Include code quality checks (black, isort, flake8) - Add documentation building workflow - Add PyPI publishing workflow for releases - Add manual test trigger workflow for debugging - Configure pytest settings in pyproject.toml - Fix test_verbose_batch_size_auto to work with parallel execution - Add CUDA_VISIBLE_DEVICES=-1 to prevent GPU conflicts - Add Dependabot configuration for automated updates - Add issue and PR templates All tests now pass with parallel execution enabled.
1 parent 3d3de25 commit ef62eec

File tree

10 files changed

+494
-21
lines changed

10 files changed

+494
-21
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: '[BUG] '
5+
labels: 'bug'
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Code example or command that causes the issue
16+
2. Input data characteristics (if relevant)
17+
3. Error message or unexpected output
18+
19+
```python
20+
# Minimal reproducible example
21+
import locator
22+
23+
# Your code here
24+
```
25+
26+
**Expected behavior**
27+
A clear and concise description of what you expected to happen.
28+
29+
**Error messages**
30+
If applicable, paste the full error traceback here.
31+
32+
```
33+
# Error traceback
34+
```
35+
36+
**Environment (please complete the following information):**
37+
- OS: [e.g. Ubuntu 22.04]
38+
- Python version: [e.g. 3.11.5]
39+
- TensorFlow version: [e.g. 2.15.0]
40+
- Locator version: [e.g. 1.0.0]
41+
- CUDA/GPU info (if relevant): [e.g. CUDA 12.1, RTX 4090]
42+
43+
**Additional context**
44+
Add any other context about the problem here.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: '[FEATURE] '
5+
labels: 'enhancement'
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Example use case**
20+
Provide a code example of how you would like to use this feature:
21+
22+
```python
23+
# Example of desired API
24+
import locator
25+
26+
# Your example here
27+
```
28+
29+
**Additional context**
30+
Add any other context or screenshots about the feature request here.

.github/dependabot.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
version: 2
2+
updates:
3+
# Enable version updates for Python dependencies
4+
- package-ecosystem: "pip"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
day: "monday"
9+
time: "04:00"
10+
open-pull-requests-limit: 5
11+
reviewers:
12+
- "adkern"
13+
labels:
14+
- "dependencies"
15+
- "python"
16+
ignore:
17+
# Ignore major version updates for stable dependencies
18+
- dependency-name: "tensorflow*"
19+
update-types: ["version-update:semver-major"]
20+
- dependency-name: "numpy"
21+
update-types: ["version-update:semver-major"]
22+
- dependency-name: "pandas"
23+
update-types: ["version-update:semver-major"]
24+
25+
# Enable version updates for GitHub Actions
26+
- package-ecosystem: "github-actions"
27+
directory: "/"
28+
schedule:
29+
interval: "weekly"
30+
day: "monday"
31+
time: "04:00"
32+
reviewers:
33+
- "adkern"
34+
labels:
35+
- "dependencies"
36+
- "github-actions"

.github/workflows/badges.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# GitHub Actions Status Badges
2+
3+
Add these badges to your README.md:
4+
5+
```markdown
6+
[\![Tests](https://github.com/YOUR_USERNAME/relocator/actions/workflows/test.yml/badge.svg)](https://github.com/YOUR_USERNAME/relocator/actions/workflows/test.yml)
7+
[\![codecov](https://codecov.io/gh/YOUR_USERNAME/relocator/branch/main/graph/badge.svg)](https://codecov.io/gh/YOUR_USERNAME/relocator)
8+
[\![Documentation](https://github.com/YOUR_USERNAME/relocator/actions/workflows/docs.yml/badge.svg)](https://github.com/YOUR_USERNAME/relocator/actions/workflows/docs.yml)
9+
```
10+
11+
Replace YOUR_USERNAME with your GitHub username or organization name.
12+
EOF < /dev/null

.github/workflows/docs.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Documentation
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build-docs:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: "3.11"
20+
21+
- name: Cache pip packages
22+
uses: actions/cache@v4
23+
with:
24+
path: ~/.cache/pip
25+
key: ${{ runner.os }}-pip-docs-${{ hashFiles('**/setup.py', '**/requirements*.txt') }}
26+
restore-keys: |
27+
${{ runner.os }}-pip-docs-
28+
${{ runner.os }}-pip-
29+
30+
- name: Install system dependencies
31+
run: |
32+
sudo apt-get update
33+
sudo apt-get install -y libproj-dev proj-data proj-bin libgeos-dev
34+
sudo apt-get install -y pandoc
35+
36+
- name: Install package with docs dependencies
37+
env:
38+
CUDA_VISIBLE_DEVICES: "-1"
39+
run: |
40+
python -m pip install --upgrade pip
41+
pip install wheel
42+
pip install -e ".[docs]"
43+
44+
- name: Build documentation
45+
run: |
46+
cd docs
47+
make clean
48+
make html
49+
50+
- name: Check for documentation warnings
51+
run: |
52+
cd docs
53+
if make html 2>&1 | grep -i "warning"; then
54+
echo "Documentation build produced warnings"
55+
exit 1
56+
fi
57+
58+
- name: Upload documentation artifacts
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: documentation
62+
path: docs/_build/html/

.github/workflows/manual-test.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Manual Test Run
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
python-version:
7+
description: 'Python version to test'
8+
required: true
9+
default: '3.11'
10+
type: choice
11+
options:
12+
- '3.9'
13+
- '3.10'
14+
- '3.11'
15+
- '3.12'
16+
test-pattern:
17+
description: 'Test pattern to run (e.g., test_core.py, test_*gpu*)'
18+
required: false
19+
default: ''
20+
verbose:
21+
description: 'Run tests in verbose mode'
22+
required: false
23+
type: boolean
24+
default: true
25+
26+
jobs:
27+
manual-test:
28+
runs-on: ubuntu-latest
29+
30+
steps:
31+
- uses: actions/checkout@v4
32+
33+
- name: Set up Python ${{ inputs.python-version }}
34+
uses: actions/setup-python@v5
35+
with:
36+
python-version: ${{ inputs.python-version }}
37+
38+
- name: Cache pip packages
39+
uses: actions/cache@v4
40+
with:
41+
path: ~/.cache/pip
42+
key: ${{ runner.os }}-pip-${{ inputs.python-version }}-${{ hashFiles('**/setup.py', '**/requirements*.txt') }}
43+
restore-keys: |
44+
${{ runner.os }}-pip-${{ inputs.python-version }}-
45+
${{ runner.os }}-pip-
46+
47+
- name: Install system dependencies
48+
run: |
49+
sudo apt-get update
50+
sudo apt-get install -y libproj-dev proj-data proj-bin libgeos-dev
51+
52+
- name: Install package and dependencies
53+
env:
54+
CUDA_VISIBLE_DEVICES: "-1"
55+
run: |
56+
python -m pip install --upgrade pip
57+
pip install wheel
58+
pip install -e ".[dev]"
59+
60+
- name: Show environment info
61+
run: |
62+
echo "Python version: $(python --version)"
63+
echo "pip version: $(pip --version)"
64+
echo "Installed packages:"
65+
pip list
66+
echo ""
67+
echo "TensorFlow info:"
68+
python -c "import tensorflow as tf; print(f'TensorFlow version: {tf.__version__}')"
69+
python -c "import tensorflow as tf; print(f'GPU available: {tf.config.list_physical_devices(\"GPU\")}')"
70+
71+
- name: Run specific tests
72+
if: inputs.test-pattern != ''
73+
env:
74+
CUDA_VISIBLE_DEVICES: "-1"
75+
TF_CPP_MIN_LOG_LEVEL: "2"
76+
run: |
77+
if [[ "${{ inputs.verbose }}" == "true" ]]; then
78+
pytest -v -n auto tests/${{ inputs.test-pattern }}
79+
else
80+
pytest -n auto tests/${{ inputs.test-pattern }}
81+
fi
82+
83+
- name: Run all tests
84+
if: inputs.test-pattern == ''
85+
env:
86+
CUDA_VISIBLE_DEVICES: "-1"
87+
TF_CPP_MIN_LOG_LEVEL: "2"
88+
run: |
89+
if [[ "${{ inputs.verbose }}" == "true" ]]; then
90+
pytest -v -n auto --cov=locator --cov-report=xml --cov-report=term-missing
91+
else
92+
pytest -n auto --cov=locator --cov-report=xml --cov-report=term-missing
93+
fi

.github/workflows/publish.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
build-and-publish:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Set up Python
15+
uses: actions/setup-python@v5
16+
with:
17+
python-version: "3.11"
18+
19+
- name: Install dependencies
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install build twine
23+
24+
- name: Build package
25+
run: |
26+
python -m build
27+
28+
- name: Check package
29+
run: |
30+
twine check dist/*
31+
32+
- name: Publish to Test PyPI
33+
if: github.event.release.prerelease
34+
env:
35+
TWINE_USERNAME: __token__
36+
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
37+
run: |
38+
twine upload --repository testpypi dist/*
39+
40+
- name: Publish to PyPI
41+
if: "!github.event.release.prerelease"
42+
env:
43+
TWINE_USERNAME: __token__
44+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
45+
run: |
46+
twine upload dist/*

0 commit comments

Comments
 (0)