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
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
github: [tr4nt0r]
buy_me_a_coffee: tr4nt0r

93 changes: 93 additions & 0 deletions .github/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
---
# Labels names are important as they are used by Release Drafter to decide
# regarding where to record them in changelog or if to skip them.
#
# The repository labels will be automatically configured using this file and
# the GitHub Action https://github.com/marketplace/actions/github-labeler.
- name: ':boom: breaking change'
from_name: breaking
description: Breaking Changes
color: bfd4f2
- name: ':ghost: bug'
from_name: bug
description: Something isn't working
color: d73a4a
- name: ':building_construction: build'
from_name: build
description: Build System and Dependencies
color: bfdadc
- name: ':construction_worker_woman: ci'
from_name: ci
description: Continuous Integration
color: 4a97d6
- name: ':recycle: dependencies'
from_name: dependencies
description: Pull requests that update a dependency file
color: 0366d6
- name: ':book: documentation'
from_name: documentation
description: Improvements or additions to documentation
color: 0075ca
- name: ':roll_eyes: duplicate'
from_name: duplicate
description: This issue or pull request already exists
color: cfd3d7
- name: ':rocket: feature'
from_name: enhancement
description: New feature or request
color: a2eeef
- name: ':clapper: github_actions'
from_name: github_actions
description: Pull requests that update Github_actions code
color: '000000'
- name: ':hatching_chick: good first issue'
from_name: good first issue
description: Good for newcomers
color: 7057ff
- name: ':pray: help wanted'
from_name: help wanted
description: Extra attention is needed
color: '008672'
- name: ':no_entry_sign: invalid'
from_name: invalid
description: This doesn't seem right
color: e4e669
- name: ':racing_car: performance'
from_name: performance
description: Performance
color: '016175'
- name: ':snake: python'
from_name: python
description: Pull requests that update Python code
color: 2b67c6
- name: ':question: question'
from_name: question
description: Further information is requested
color: d876e3
- name: ':sparkles: code quality'
from_name: code quality
description: Code quality improvements
color: ef67c4
- name: ':file_cabinet: deprecation'
from_name: deprecation
description: Removals and Deprecations
color: 9ae7ea
- name: ':nail_care: style'
from_name: style
description: Style
color: c120e5
- name: ':test_tube: testing'
from_name: testing
description: Pull request that adds tests
color: b1fc6f
- name: ':woman_shrugging: wontfix'
from_name: wontfix
description: This will not be worked on
color: ffffff
- name: ':arrow_up: bump'
description: Bump the version
color: 3C5D34
- name: ':sparkles: enhancement'
color: CBF8DA
- name: 'skip-changelog'
color: D3D3D3
96 changes: 96 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name-template: "v$RESOLVED_VERSION"
tag-template: "v$RESOLVED_VERSION"

categories:
- title: "💥 Breaking changes"
labels:
- ":boom: breaking change"
- title: "🚀 New Features"
labels:
- ":rocket: feature"
- title: "👻 Bug Fixes"
labels:
- ":ghost: bug"
- title: "⏳ Deprecations"
labels:
- ":file_cabinet: deprecation"
- title: "📃 Documentation"
labels:
- ":book: documentation"
- title: "🧰 Maintenance"
labels:
- ":building_construction: build"
- ":construction_worker_woman: ci"
- ":clapper: github_actions"
collapse-after: 5
- title: "🔬 Other updates"
labels:
- ":nail_care: style"
- ":test_tube: testing"
- ":racing_car: performance"
- ":sparkles: code quality"
- ":sparkles: enhancement"
- title: "🧩 Dependency Updates"
labels:
- ":recycle: dependencies"
collapse-after: 5
exclude-labels:
- ":arrow_up: bump"
- "skip-changelog"

autolabeler:
- label: ":rocket: feature"
title:
- "/adds/i"
- "/add method/i"
- label: ":ghost: bug"
title:
- "/fix/i"
- label: ":sparkles: code quality"
title:
- "/Refactor/i"
- label: ":test_tube: testing"
files:
- "test_*"
- "conftest.py"
- label: ":book: documentation"
title:
- "/docs:/i"
files:
- "*.md"
- "mkdocs.yml"
- label: ":construction_worker_woman: ci"
files:
- ".github/*"
- label: ":recycle: dependencies"
title:
- "/^bump(?! version)/i"
- label: ":file_cabinet: deprecation"
title:
- "/Deprecate/i"

change-template: "- $TITLE @$AUTHOR (#$NUMBER)"
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
exclude-contributors:
- "dependabot"
- "renovate"

version-resolver:
major:
labels:
- ":boom: breaking change"
minor:
labels:
- ":rocket: feature"
default: patch

template: |
## What's Changed

$CHANGES

Contributors: $CONTRIBUTORS

replacers:
- search: '/(?:and )?@dependabot(?:\[bot\])?,?/g'
replace: ""
106 changes: 65 additions & 41 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,75 @@
name: build
name: Build

on: ['push', 'pull_request']
on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest
test:
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

os: [windows-latest, ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
- uses: actions/checkout@v5
- name: Install Hatch
uses: pypa/hatch@install
- name: Lint and typecheck
run: |
python -m pip install --upgrade pip
pip install -e .[dev]
- name: Lint with ruff
hatch fmt --linter
- name: Test
run: |
ruff check xbox
ruff check tests
- name: Test with pytest
run: |
pytest

deploy:
hatch test --all

- uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
verbose: true

release:
runs-on: ubuntu-latest
needs: build
environment: release
needs: test
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
id-token: write

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine build
- name: Build and publish
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_KEY }}
run: |
python -m build
twine upload dist/*
- uses: actions/checkout@v5
- name: Install dependencies
shell: bash
run: pipx install hatch
- name: mint API token
id: mint-token
run: |
# retrieve the ambient OIDC token
resp=$(curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
"$ACTIONS_ID_TOKEN_REQUEST_URL&audience=pypi")
oidc_token=$(jq -r '.value' <<< "${resp}")

# exchange the OIDC token for an API token
resp=$(curl -X POST https://pypi.org/_/oidc/mint-token -d "{\"token\": \"${oidc_token}\"}")
api_token=$(jq -r '.token' <<< "${resp}")

# mask the newly minted API token, so that we don't accidentally leak it
echo "::add-mask::${api_token}"

# see the next step in the workflow for an example of using this step output
echo "api-token=${api_token}" >> "${GITHUB_OUTPUT}"
- name: Build and publish on PyPI
env:
HATCH_INDEX_USER: __token__
HATCH_INDEX_AUTH: ${{ steps.mint-token.outputs.api-token }}
run: |
hatch build
hatch publish
- name: Create release
uses: ncipollo/release-action@v1
with:
draft: true
body: ${{ github.event.head_commit.message }}
allowUpdates: true
omitBodyDuringUpdate: true
updateOnlyUnreleased: true
artifacts: dist/*.whl,dist/*.tar.gz
token: ${{ secrets.GITHUB_TOKEN }}
26 changes: 26 additions & 0 deletions .github/workflows/draft.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Release Drafter

on:
push:
branches:
- main
# pull_request event is required only for autolabeler
pull_request:
types: [opened, reopened, synchronize]
pull_request_target:
types: [opened, reopened, synchronize]

permissions:
contents: read

jobs:
update-draft:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
# Drafts your next Release notes as Pull Requests are merged into "main"
- uses: release-drafter/release-drafter@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21 changes: 21 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Labeler

on: workflow_dispatch

permissions:
actions: read
contents: read
security-events: write
pull-requests: write

jobs:
labeler:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v5

- name: Run Labeler
uses: crazy-max/ghaction-github-labeler@v5.3.0
with:
skip-delete: true
Loading