Add CI workflow and contribution guidelines

- GitHub Actions workflow for testing on Python 3.9-3.12
- Ruff linting in CI
- Coverage reporting to Codecov
- CONTRIBUTING.md with development setup instructions
- LICENSE file (MIT)
- Dev dependencies in pyproject.toml
This commit is contained in:
Tim Hadwen
2026-01-18 20:59:04 +10:00
parent 2477fd1539
commit b89456a7f7
4 changed files with 204 additions and 0 deletions

59
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,59 @@
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov
pip install -e .
- name: Run tests
run: |
python -m pytest tests/ -v --cov=inventree_rma_plugin --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
if: matrix.python-version == '3.11'
with:
files: ./coverage.xml
fail_ci_if_error: false
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install linters
run: |
python -m pip install --upgrade pip
pip install ruff
- name: Run ruff
run: |
ruff check --output-format=github .

95
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,95 @@
# Contributing to InvenTree RMA Plugin
Thank you for your interest in contributing! This document provides guidelines for contributing to the project.
## Getting Started
1. Fork the repository
2. Clone your fork:
```bash
git clone https://github.com/YOUR_USERNAME/inventree-rma-plugin.git
cd inventree-rma-plugin
```
3. Install development dependencies:
```bash
pip install -e ".[dev]"
```
## Development Workflow
### Running Tests
```bash
pytest tests/ -v
```
### Running Linter
```bash
ruff check .
```
To auto-fix issues:
```bash
ruff check --fix .
```
### Code Style
This project uses [ruff](https://github.com/astral-sh/ruff) for linting. Please ensure your code passes all checks before submitting a PR.
## Pull Request Process
1. Create a new branch for your feature/fix:
```bash
git checkout -b feature/your-feature-name
```
2. Make your changes and commit with clear, descriptive messages
3. Ensure all tests pass and linting is clean:
```bash
pytest tests/ -v
ruff check .
```
4. Push to your fork and open a Pull Request
5. Describe your changes in the PR description, including:
- What the change does
- Why it's needed
- Any breaking changes
## Testing with InvenTree
To test the plugin with a local InvenTree instance:
1. Set up InvenTree using Docker:
```bash
git clone https://github.com/inventree/InvenTree.git
cd InvenTree
docker compose -f contrib/container/docker-compose.yml up -d
```
2. Install the plugin in development mode:
```bash
docker compose exec inventree-server pip install -e /path/to/inventree-rma-plugin
```
3. Enable the required settings in InvenTree:
- ENABLE_PLUGINS_APP
- ENABLE_PLUGINS_URL
- ENABLE_PLUGINS_INTERFACE
## Reporting Issues
When reporting issues, please include:
- InvenTree version
- Plugin version
- Steps to reproduce
- Expected vs actual behavior
- Any error messages or logs
## Questions?
Feel free to open an issue for any questions about contributing.

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2026 Timmy Hadwen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -42,6 +42,35 @@ include = ["inventree_rma_plugin*"]
"migrations/*", "migrations/*",
] ]
[project.optional-dependencies]
dev = [
"pytest",
"pytest-cov",
"ruff",
]
[tool.pytest.ini_options] [tool.pytest.ini_options]
testpaths = ["tests"] testpaths = ["tests"]
python_files = "test_*.py" python_files = "test_*.py"
[tool.ruff]
line-length = 120
target-version = "py39"
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"UP", # pyupgrade
]
ignore = [
"E501", # line too long (handled by formatter)
"B008", # do not perform function calls in argument defaults
]
[tool.ruff.lint.isort]
known-first-party = ["inventree_rma_plugin"]