-
Notifications
You must be signed in to change notification settings - Fork 3
feat(ci): add GitHub Actions workflows for CI, linting, and commit validation #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # Default owner for everything in the repo | ||
| * @MarTrepodi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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? --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: | ||
| 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: | ||
|
|
||
| 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: | ||
|
|
||
| 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')" | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.