feat: implement CI/CD workflows for testing, linting, and publishing to PyPI

This commit is contained in:
bohd4nx
2026-03-15 21:45:24 +02:00
parent d2d046a2b9
commit 9a090e3dbc
21 changed files with 438 additions and 57 deletions
+101
View File
@@ -0,0 +1,101 @@
name: Bug report
description: Report an issue or unexpected behavior in FragmentAPI.
labels:
- bug
body:
- type: checkboxes
attributes:
label: Checklist
options:
- label: I am sure the error is coming from FragmentAPI code
required: true
- label: I have searched the issue tracker for similar bug reports, including closed ones
required: true
- type: markdown
attributes:
value: |
## Context
Please provide as much detail as possible to help us reproduce and fix the issue.
- type: input
attributes:
label: Operating system
placeholder: e.g. Ubuntu 22.04 / macOS 14 / Windows 11
validations:
required: true
- type: input
attributes:
label: Python version
description: Run `python --version` inside your virtualenv
placeholder: e.g. 3.12.3
validations:
required: true
- type: input
attributes:
label: FragmentAPI version
description: Run `pip show fragmentapi` inside your virtualenv
placeholder: e.g. 2026.1.0
validations:
required: true
- type: textarea
attributes:
label: Expected behavior
description: Describe what you expected to happen.
placeholder: e.g. Stars should be gifted and StarsResult returned.
validations:
required: true
- type: textarea
attributes:
label: Current behavior
description: Describe what is actually happening.
placeholder: e.g. RequestError is raised with status 400.
validations:
required: true
- type: textarea
attributes:
label: Steps to reproduce
description: Minimal steps that reproduce the issue.
placeholder: |
1. Create FragmentClient with valid credentials
2. Call gift_stars("@username", amount=100)
3. See error
validations:
required: true
- type: textarea
attributes:
label: Code example
description: Provide a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) if applicable.
placeholder: |
import asyncio
from fragmentapi import FragmentClient
async def main():
client = FragmentClient(...)
result = await client.gift_stars("@username", amount=100)
asyncio.run(main())
render: python
- type: textarea
attributes:
label: Traceback / logs
description: Paste the full traceback or relevant logs.
placeholder: |
Traceback (most recent call last):
File "main.py", line 7, in main
...
fragmentapi.types.RequestError: ...
render: sh
- type: textarea
attributes:
label: Additional information
description: Anything else that might help us diagnose the problem.
placeholder: e.g. Only happens with V5R1 wallet version.
+5
View File
@@ -0,0 +1,5 @@
blank_issues_enabled: true
contact_links:
- name: Ask a question or start a discussion
url: https://github.com/bohd4nx/FragmentAPI/discussions
about: General questions, ideas, and community help go here — not in the issue tracker.
+51
View File
@@ -0,0 +1,51 @@
name: Feature request
description: Suggest an improvement or new feature for FragmentAPI.
labels:
- enhancement
body:
- type: dropdown
attributes:
label: FragmentAPI version
description: Which version are you running?
options:
- latest
- older
- n/a
validations:
required: true
- type: textarea
attributes:
label: Problem
description: Is your request related to a specific problem? Describe it.
placeholder: e.g. There is no way to check my current TON balance before sending.
validations:
required: true
- type: textarea
attributes:
label: Proposed solution
description: Describe what you would like to see added or changed.
placeholder: e.g. Add a get_balance() method to FragmentClient.
validations:
required: true
- type: textarea
attributes:
label: Alternatives considered
description: Any workarounds or alternative approaches you have thought of.
placeholder: e.g. I manually call the Fragment API, but it's not ergonomic.
- type: textarea
attributes:
label: Code example
description: A short example demonstrating the desired API, if applicable.
placeholder: |
balance = await client.get_balance()
print(balance.ton)
render: python
- type: textarea
attributes:
label: Additional information
description: Any other context, screenshots, or references.
+34
View File
@@ -0,0 +1,34 @@
# Description
Please include a summary of the change and which issue is fixed.
Include relevant motivation and context.
Fixes # (issue)
## Type of change
- [ ] Documentation (typos, examples, or any docs update)
- [ ] 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 change)
- [ ] This change requires a documentation update
## How has this been tested?
Describe the tests you ran to verify the change and list any relevant details.
- [ ] Existing tests pass (`pytest`)
- [ ] New tests added for this change
**Test configuration:**
* OS:
* Python version:
* FragmentAPI version:
## Checklist
- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have updated documentation where necessary
- [ ] I have added tests that prove my fix or feature works
- [ ] All new and existing tests pass locally
+31
View File
@@ -0,0 +1,31 @@
name: Lint
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
lint:
name: Lint & format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6.0.2
- uses: actions/setup-python@v6.2.0
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v7.5.0
- name: Install dev dependencies
run: uv pip install --system ".[dev]"
- name: Run ruff
run: ruff check .
- name: Run black
run: black --check . --target-version py312
+49
View File
@@ -0,0 +1,49 @@
name: Publish to PyPI
on:
push:
branches: [master]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6.0.2
- uses: actions/setup-python@v6.2.0
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v7.5.0
- name: Build distribution
run: uv build
- name: Upload artifacts
uses: actions/upload-artifact@v7
with:
name: dist
path: dist/*
publish:
name: Publish
needs: build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/fragmentapi/
permissions:
id-token: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v8.0.1
with:
name: dist
path: dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@v1.13.0
+7 -4
View File
@@ -8,18 +8,21 @@ on:
jobs:
test:
name: Run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v6.0.2
- uses: actions/setup-python@v6
- uses: actions/setup-python@v6.2.0
with:
python-version: "3.12"
cache: "pip"
- name: Install uv
uses: astral-sh/setup-uv@v7.5.0
- name: Install dependencies
run: pip install -r requirements.txt pytest pytest-asyncio
run: uv pip install --system ".[dev]"
- name: Write cookies.json
if: ${{ env.COOKIES_JSON != '' }}