mirror of
https://github.com/vibe-existing/pyfragment.git
synced 2026-07-25 06:54:31 +00:00
feat: restructure GitHub workflows; add CI workflow, update publish process, and remove obsolete test and lint workflows
This commit is contained in:
@@ -8,3 +8,12 @@ updates:
|
|||||||
open-pull-requests-limit: 5
|
open-pull-requests-limit: 5
|
||||||
labels:
|
labels:
|
||||||
- "dependencies"
|
- "dependencies"
|
||||||
|
|
||||||
|
- package-ecosystem: "github-actions"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "weekly"
|
||||||
|
day: "monday"
|
||||||
|
open-pull-requests-limit: 5
|
||||||
|
labels:
|
||||||
|
- "dependencies"
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: ["**"]
|
||||||
|
pull_request:
|
||||||
|
branches: ["**"]
|
||||||
|
|
||||||
|
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"
|
||||||
|
|
||||||
|
- uses: astral-sh/setup-uv@v7.5.0
|
||||||
|
|
||||||
|
- run: uv pip install --system ".[dev]"
|
||||||
|
|
||||||
|
- run: ruff check .
|
||||||
|
|
||||||
|
- run: black --check . --target-version py312
|
||||||
|
|
||||||
|
test:
|
||||||
|
name: Tests
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6.0.2
|
||||||
|
|
||||||
|
- uses: actions/setup-python@v6.2.0
|
||||||
|
with:
|
||||||
|
python-version: "3.12"
|
||||||
|
|
||||||
|
- uses: astral-sh/setup-uv@v7.5.0
|
||||||
|
|
||||||
|
- run: uv pip install --system ".[dev]"
|
||||||
|
|
||||||
|
- name: Write cookies.json
|
||||||
|
if: ${{ env.COOKIES_JSON != '' }}
|
||||||
|
run: echo "$COOKIES_JSON" > cookies.json
|
||||||
|
env:
|
||||||
|
COOKIES_JSON: ${{ secrets.COOKIES_JSON }}
|
||||||
|
|
||||||
|
- run: pytest
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
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
|
|
||||||
@@ -1,12 +1,44 @@
|
|||||||
name: Publish to PyPI
|
name: Publish
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
workflow_run:
|
||||||
|
workflows: ["CI"]
|
||||||
|
types: [completed]
|
||||||
branches: [master]
|
branches: [master]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
version-check:
|
||||||
|
name: Version Check
|
||||||
|
if: github.event.workflow_run.conclusion == 'success'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
version: ${{ steps.version.outputs.value }}
|
||||||
|
is-new: ${{ steps.tag.outputs.is-new }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6.0.2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Read version
|
||||||
|
id: version
|
||||||
|
run: |
|
||||||
|
value=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
|
||||||
|
echo "value=$value" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Check tag
|
||||||
|
id: tag
|
||||||
|
run: |
|
||||||
|
if git ls-remote --tags origin "refs/tags/v${{ steps.version.outputs.value }}" | grep -q .; then
|
||||||
|
echo "is-new=false" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "is-new=true" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
|
needs: version-check
|
||||||
|
if: needs.version-check.outputs.is-new == 'true'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -16,23 +48,19 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
python-version: "3.12"
|
python-version: "3.12"
|
||||||
|
|
||||||
- name: Install uv
|
- uses: astral-sh/setup-uv@v7.5.0
|
||||||
uses: astral-sh/setup-uv@v7.5.0
|
|
||||||
|
|
||||||
- name: Build distribution
|
- run: uv build
|
||||||
run: uv build
|
|
||||||
|
|
||||||
- name: Upload artifacts
|
- uses: actions/upload-artifact@v7
|
||||||
uses: actions/upload-artifact@v7
|
|
||||||
with:
|
with:
|
||||||
name: dist
|
name: dist
|
||||||
path: dist/*
|
path: dist/*
|
||||||
|
|
||||||
publish:
|
publish:
|
||||||
name: Publish
|
name: Publish to PyPI
|
||||||
needs: build
|
needs: [version-check, build]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.ref == 'refs/heads/master'
|
|
||||||
environment:
|
environment:
|
||||||
name: pypi
|
name: pypi
|
||||||
url: https://pypi.org/project/pyfragment/
|
url: https://pypi.org/project/pyfragment/
|
||||||
@@ -40,11 +68,34 @@ jobs:
|
|||||||
id-token: write
|
id-token: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Download artifacts
|
- uses: actions/download-artifact@v8.0.1
|
||||||
uses: actions/download-artifact@v8.0.1
|
|
||||||
with:
|
with:
|
||||||
name: dist
|
name: dist
|
||||||
path: dist
|
path: dist
|
||||||
|
|
||||||
- name: Publish to PyPI
|
- uses: pypa/gh-action-pypi-publish@v1.13.0
|
||||||
uses: pypa/gh-action-pypi-publish@v1.13.0
|
|
||||||
|
release:
|
||||||
|
name: GitHub Release
|
||||||
|
needs: [version-check, build]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6.0.2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- uses: actions/download-artifact@v8.0.1
|
||||||
|
with:
|
||||||
|
name: dist
|
||||||
|
path: dist
|
||||||
|
|
||||||
|
- uses: softprops/action-gh-release@v2.6.1
|
||||||
|
with:
|
||||||
|
tag_name: v${{ needs.version-check.outputs.version }}
|
||||||
|
name: v${{ needs.version-check.outputs.version }}
|
||||||
|
files: dist/*
|
||||||
|
generate_release_notes: true
|
||||||
|
make_latest: true
|
||||||
|
|||||||
@@ -1,34 +0,0 @@
|
|||||||
name: Tests
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: ["**"]
|
|
||||||
pull_request:
|
|
||||||
branches: ["**"]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
name: Run tests
|
|
||||||
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 dependencies
|
|
||||||
run: uv pip install --system ".[dev]"
|
|
||||||
|
|
||||||
- name: Write cookies.json
|
|
||||||
if: ${{ env.COOKIES_JSON != '' }}
|
|
||||||
run: echo "$COOKIES_JSON" > cookies.json
|
|
||||||
env:
|
|
||||||
COOKIES_JSON: ${{ secrets.COOKIES_JSON }}
|
|
||||||
|
|
||||||
- name: Run tests
|
|
||||||
run: pytest
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
All notable changes to pyfragment are documented in this file.
|
||||||
|
|
||||||
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||||
|
and this project uses [Calendar Versioning](https://calver.org/) (`YYYY.MINOR.MICRO`).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## [2026.0.1] — 2026-03-16
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Initial stable release of `pyfragment`
|
||||||
|
- `FragmentClient` — async client for the Fragment.com API
|
||||||
|
- `gift_premium(username, months)` — purchase Telegram Premium for any user (3, 6, or 12 months)
|
||||||
|
- `gift_stars(username, amount)` — send Telegram Stars to any user (50–1,000,000)
|
||||||
|
- `topup_ton(username, amount)` — top up TON Ads balance (1–1,000,000,000 TON)
|
||||||
|
- `get_wallet()` — fetch wallet address and balance
|
||||||
|
- Support for TON wallet versions `V4R2` and `V5R1`
|
||||||
|
- Structured exception hierarchy (`FragmentError`, `ConfigurationError`, `CookieError`, etc.)
|
||||||
|
- `py.typed` marker — full PEP 561 typing support for type-checkers
|
||||||
|
|
||||||
|
[2026.0.1]: https://github.com/bohd4nx/pyfragment/releases/tag/v2026.0.1
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
[](https://python.org)
|
[](https://python.org)
|
||||||
[](LICENSE)
|
[](LICENSE)
|
||||||
[](https://github.com/bohd4nx/pyfragment/stargazers)
|
[](https://github.com/bohd4nx/pyfragment/stargazers)
|
||||||
[](https://github.com/bohd4nx/pyfragment/actions)
|
[](https://github.com/bohd4nx/pyfragment/actions)
|
||||||
|
|
||||||
[Report Bug](https://github.com/bohd4nx/pyfragment/issues) · [Request Feature](https://github.com/bohd4nx/pyfragment/issues) · [**Donate TON**](https://app.tonkeeper.com/transfer/UQCppfw5DxWgdVHf3zkmZS8k1mt9oAUYxQLwq2fz3nhO8No5)
|
[Report Bug](https://github.com/bohd4nx/pyfragment/issues) · [Request Feature](https://github.com/bohd4nx/pyfragment/issues) · [**Donate TON**](https://app.tonkeeper.com/transfer/UQCppfw5DxWgdVHf3zkmZS8k1mt9oAUYxQLwq2fz3nhO8No5)
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright (c) 2025 bohd4nx
|
# Copyright (c) 2026 bohd4nx
|
||||||
#
|
#
|
||||||
# This source code is licensed under the MIT License found in the
|
# This source code is licensed under the MIT License found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|||||||
+2
-1
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "pyfragment"
|
name = "pyfragment"
|
||||||
version = "2026.1.0"
|
version = "2026.0.1"
|
||||||
description = "Python library for the Fragment.com API — purchase Telegram Stars, Premium, and top up TON Ads balance."
|
description = "Python library for the Fragment.com API — purchase Telegram Stars, Premium, and top up TON Ads balance."
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license = { text = "MIT" }
|
license = { text = "MIT" }
|
||||||
@@ -42,6 +42,7 @@ dev = [
|
|||||||
Homepage = "https://github.com/bohd4nx/pyfragment"
|
Homepage = "https://github.com/bohd4nx/pyfragment"
|
||||||
Repository = "https://github.com/bohd4nx/pyfragment"
|
Repository = "https://github.com/bohd4nx/pyfragment"
|
||||||
Issues = "https://github.com/bohd4nx/pyfragment/issues"
|
Issues = "https://github.com/bohd4nx/pyfragment/issues"
|
||||||
|
Changelog = "https://github.com/bohd4nx/pyfragment/blob/master/CHANGELOG.md"
|
||||||
|
|
||||||
[tool.hatch.build.targets.wheel]
|
[tool.hatch.build.targets.wheel]
|
||||||
packages = ["pyfragment"]
|
packages = ["pyfragment"]
|
||||||
|
|||||||
Reference in New Issue
Block a user