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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Default owner for everything in the repo
* @MarTrepodi
30 changes: 30 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Label definitions for actions/labeler
# Maps file path patterns to PR labels

code:
- changed-files:
- any-glob-to-any-file:
- "src/**"

testing:
- changed-files:
- any-glob-to-any-file:
- "tests/**"

documentation:
- changed-files:
- any-glob-to-any-file:
- "docs/**"
- "*.md"
- "examples/**"

ci:
- changed-files:
- any-glob-to-any-file:
- ".github/**"

dependencies:
- changed-files:
- any-glob-to-any-file:
- "pyproject.toml"
- "uv.lock"
29 changes: 29 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
## Description

<!-- What does this PR do? Why is it needed? -->

## Related Issues

<!-- Link related issues: "Closes #123" or "Relates to #456" -->

## Type of Change

- [ ] Bug fix (non-breaking change that fixes an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Refactor (code change that neither fixes a bug nor adds a feature)
- [ ] Documentation
- [ ] Tests

## Checklist

- [ ] My commits follow the [Angular commit convention](https://www.conventionalcommits.org/) (`feat:`, `fix:`, `refactor:`, etc.)
- [ ] I have added/updated docstrings with type hints for any new or changed public methods
- [ ] I have added unit tests that cover my changes (mocked, not requiring a live comlink service)
- [ ] All existing tests still pass (`python -m pytest tests/ -v`)
- [ ] Ruff linter passes (`ruff check src/ tests/`)
- [ ] I have not bundled unrelated changes in this PR

## Testing

<!-- How did you test this? What should reviewers verify? -->
126 changes: 126 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
name: CI

on:
pull_request:
branches: [main, 2.0-development]
push:
branches: [main]

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:

# ── Lint ───────────────────────────────────────────────────────────────
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v4

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

- name: Run Ruff linter
run: uvx ruff check src/ tests/

- name: Run Ruff formatter check
# NOTE: Set continue-on-error to false once the initial formatting PR is merged
continue-on-error: true
run: uvx ruff format --check src/ tests/

# ── Type check ─────────────────────────────────────────────────────────
type-check:
Comment thread Fixed
name: Type Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v4

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

- name: Install dependencies
run: uv pip install --system -e "." mypy

- name: Run mypy
# NOTE: 38 existing errors (mostly implicit Optional). Set continue-on-error
# to false once type annotations are cleaned up (see pyproject.toml TODO).
continue-on-error: true
run: mypy src/swgoh_comlink/

# ── Test ───────────────────────────────────────────────────────────────
test:
Comment thread Fixed
name: Test (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: uv pip install --system -e "." pytest pytest-cov

- name: Run tests with coverage
run: |
python -m pytest tests/ \
--cov=swgoh_comlink \
--cov-report=term-missing \
--cov-report=xml:coverage.xml \
-v

- name: Upload coverage artifact
if: matrix.python-version == '3.12'
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage.xml

# ── Build verification ─────────────────────────────────────────────────
build:
Comment thread Fixed
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v4

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

- name: Install hatch
run: uv pip install --system hatch

- name: Build package
run: hatch build

- name: Verify wheel contents
run: |
pip install dist/*.whl
python -c "from swgoh_comlink import SwgohComlink; print('Import OK')"
Comment thread Fixed
41 changes: 41 additions & 0 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Commit Lint

on:
pull_request:
branches: [main, 2.0-development]

permissions:
contents: read

jobs:
commitlint:
name: Validate Commit Messages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install commitlint
run: npm install -g @commitlint/{cli,config-conventional}

- name: Create commitlint config
run: |
cat > .commitlintrc.json << 'EOF'
{
"extends": ["@commitlint/config-conventional"],
"rules": {
"type-enum": [2, "always", [
"feat", "fix", "refactor", "build", "deps",
"chore", "docs", "test", "style", "ci", "perf"
]],
"scope-enum": [1, "always", [
"core", "helpers", "deps", "release", "ci"
]],
"subject-max-length": [1, "always", 100]
}
}
EOF

- name: Validate commits
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
Comment thread Fixed
19 changes: 19 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Auto Label PR

on:
pull_request:
types: [opened, synchronize]

permissions:
contents: read
pull-requests: write

jobs:
label:
name: Auto Label
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v5
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
sync-labels: false
Loading
Loading