Skip to content

Commit 90a5ce8

Browse files
committed
feat: initial commit
0 parents  commit 90a5ce8

31 files changed

Lines changed: 3647 additions & 0 deletions

.github/dependabot.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "pip"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
groups:
8+
dev-dependencies:
9+
patterns:
10+
- "pytest*"
11+
- "mypy"
12+
- "ruff"
13+
- "respx"
14+
15+
- package-ecosystem: "github-actions"
16+
directory: "/"
17+
schedule:
18+
interval: "weekly"

.github/workflows/ci.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
test:
15+
name: Test (Python ${{ matrix.python-version }})
16+
runs-on: ubuntu-latest
17+
timeout-minutes: 10
18+
strategy:
19+
fail-fast: true
20+
matrix:
21+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
22+
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@v4
26+
27+
- name: Set up Python ${{ matrix.python-version }}
28+
uses: actions/setup-python@v5
29+
with:
30+
python-version: ${{ matrix.python-version }}
31+
cache: 'pip'
32+
33+
- name: Install dependencies
34+
run: |
35+
python -m pip install --upgrade pip
36+
pip install -e ".[dev]"
37+
38+
- name: Run linting
39+
run: python -m ruff check src/lettermint
40+
41+
- name: Run type checking
42+
run: python -m mypy src/lettermint --strict
43+
44+
- name: Run tests
45+
run: python -m pytest tests/ -v --tb=short
46+
47+
build:
48+
name: Build
49+
runs-on: ubuntu-latest
50+
needs: test
51+
52+
steps:
53+
- name: Checkout code
54+
uses: actions/checkout@v4
55+
56+
- name: Set up Python
57+
uses: actions/setup-python@v5
58+
with:
59+
python-version: '3.12'
60+
cache: 'pip'
61+
62+
- name: Install build dependencies
63+
run: |
64+
python -m pip install --upgrade pip
65+
pip install build
66+
67+
- name: Build package
68+
run: python -m build
69+
70+
- name: Check build output
71+
run: |
72+
if [ ! -d "dist" ]; then
73+
echo "Build output directory 'dist' not found"
74+
exit 1
75+
fi
76+
ls -la dist/
77+
78+
- name: Upload build artifacts
79+
uses: actions/upload-artifact@v4
80+
with:
81+
name: build-artifacts
82+
path: dist/
83+
retention-days: 7
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: dependabot-auto-merge
2+
on: pull_request_target
3+
4+
permissions:
5+
pull-requests: write
6+
contents: write
7+
8+
jobs:
9+
dependabot:
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 5
12+
if: github.actor == 'dependabot[bot]'
13+
steps:
14+
15+
- name: Dependabot metadata
16+
id: metadata
17+
uses: dependabot/fetch-metadata@v2
18+
with:
19+
github-token: ${{ secrets.GITHUB_TOKEN }}
20+
21+
- name: Auto-merge Dependabot PRs for semver-minor updates
22+
if: steps.metadata.outputs.update-type == 'version-update:semver-minor'
23+
run: gh pr merge --auto --merge "$PR_URL"
24+
env:
25+
PR_URL: ${{ github.event.pull_request.html_url }}
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
28+
- name: Auto-merge Dependabot PRs for semver-patch updates
29+
if: steps.metadata.outputs.update-type == 'version-update:semver-patch'
30+
run: gh pr merge --auto --merge "$PR_URL"
31+
env:
32+
PR_URL: ${{ github.event.pull_request.html_url }}
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Fix Python code style issues
2+
3+
on:
4+
push:
5+
paths:
6+
- '**.py'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
python-code-styling:
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 5
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: '3.12'
24+
cache: 'pip'
25+
26+
- name: Install ruff
27+
run: pip install ruff
28+
29+
- name: Fix code style issues
30+
run: |
31+
python -m ruff check --fix src/lettermint || true
32+
python -m ruff format src/lettermint || true
33+
34+
- name: Commit changes
35+
uses: stefanzweifel/git-auto-commit-action@v5
36+
with:
37+
commit_message: Fix styling
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
on:
2+
release:
3+
types: [published]
4+
workflow_dispatch:
5+
6+
jobs:
7+
github-releases-to-discord:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v4
12+
- name: Discord Release Webhook
13+
uses: lettermint/action-discord-releases@v1.0.1
14+
with:
15+
color: '3776ab'
16+
webhook_url: ${{ secrets.DISCORD_RELEASE_WEBHOOK_URL }}
17+
content: 'A new release for the Lettermint Python SDK is now available! ||@Python||'

.github/workflows/release.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
id-token: write
11+
12+
jobs:
13+
test-and-build:
14+
name: Test and Build
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Set up Python
24+
uses: actions/setup-python@v5
25+
with:
26+
python-version: '3.12'
27+
cache: 'pip'
28+
29+
- name: Install dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
pip install -e ".[dev]"
33+
pip install build
34+
35+
- name: Run tests
36+
run: python -m pytest tests/ -v
37+
38+
- name: Build package
39+
run: python -m build
40+
41+
- name: Upload build artifacts
42+
uses: actions/upload-artifact@v4
43+
with:
44+
name: release-artifacts
45+
path: |
46+
dist/
47+
pyproject.toml
48+
README.md
49+
LICENSE
50+
retention-days: 30
51+
52+
release:
53+
name: Release
54+
runs-on: ubuntu-latest
55+
needs: test-and-build
56+
if: github.ref == 'refs/heads/main'
57+
58+
steps:
59+
- name: Checkout code
60+
uses: actions/checkout@v4
61+
with:
62+
fetch-depth: 0
63+
token: ${{ secrets.GITHUB_TOKEN }}
64+
65+
- name: Set up Python
66+
uses: actions/setup-python@v5
67+
with:
68+
python-version: '3.12'
69+
cache: 'pip'
70+
71+
- name: Install dependencies
72+
run: |
73+
python -m pip install --upgrade pip
74+
pip install python-semantic-release build
75+
76+
- name: Configure Git
77+
run: |
78+
git config user.name "github-actions[bot]"
79+
git config user.email "github-actions[bot]@users.noreply.github.com"
80+
81+
- name: Python Semantic Release
82+
id: release
83+
env:
84+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85+
run: |
86+
semantic-release version
87+
semantic-release publish
88+
89+
- name: Download build artifacts
90+
uses: actions/download-artifact@v4
91+
with:
92+
name: release-artifacts
93+
path: artifacts/
94+
95+
- name: Publish to PyPI
96+
if: steps.release.outputs.released == 'true'
97+
uses: pypa/gh-action-pypi-publish@release/v1
98+
with:
99+
packages-dir: artifacts/dist/
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Update Changelog
2+
3+
on:
4+
release:
5+
types: [released]
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
update:
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 5
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
with:
19+
ref: main
20+
21+
- name: Update Changelog
22+
uses: stefanzweifel/changelog-updater-action@v1
23+
with:
24+
latest-version: ${{ github.event.release.name }}
25+
release-notes: ${{ github.event.release.body }}
26+
27+
- name: Commit updated CHANGELOG
28+
uses: stefanzweifel/git-auto-commit-action@v5
29+
with:
30+
branch: main
31+
commit_message: Update CHANGELOG
32+
file_pattern: CHANGELOG.md

0 commit comments

Comments
 (0)