Skip to content

Commit

Permalink
chore: setup release workflow (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
hadrien committed Sep 8, 2024
1 parent a29e989 commit e129176
Show file tree
Hide file tree
Showing 5 changed files with 606 additions and 7 deletions.
24 changes: 17 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,11 @@ on:
push:

jobs:
build:
Tests:
runs-on: ubuntu-latest
steps:
- name: 📥 checkout
uses: actions/checkout@v4
- name: 🐍 setup python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: ⚡️ setup uv
uses: astral-sh/setup-uv@v2
with:
Expand All @@ -22,11 +18,25 @@ jobs:
cache-dependency-glob: |
pyproject.toml
uv.lock
- name: ⚡️ uv sync
run: uv sync
- name: 🧪 pytest
run: uv run pytest --cov fastapi_async_sqla --cov-report=term-missing --cov-report=xml
- name: "🐔 codecov: upload test coverage"
uses: codecov/[email protected]
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
Ruff:
runs-on: ubuntu-latest
steps:
- name: 📥 checkout
uses: actions/checkout@v4
- name: ⚡️ setup uv
uses: astral-sh/setup-uv@v2
with:
version: "latest"
enable-cache: true
cache-suffix: 2024-09-08 09:10
cache-dependency-glob: |
pyproject.toml
uv.lock
- name: 🐶 ruff
run: uv run ruff check
35 changes: 35 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Publish

on:
push:
tags:
- '*'

jobs:
Publish:
runs-on: ubuntu-latest
concurrency: publish
permissions:
id-token: write
contents: write
steps:
- name: 📥 checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: ⚡️ setup uv
uses: astral-sh/setup-uv@v2
with:
version: "latest"
enable-cache: true
cache-suffix: 2024-09-08 09:10
cache-dependency-glob: |
pyproject.toml
uv.lock
- name: 🛠️ build
run: uv build
- name: 📰 publish on pypi
run: uv run twine upload dist/*
env:
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
31 changes: 31 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Release

on:
push:
branches:
- main
jobs:
Release:
runs-on: ubuntu-latest
concurrency: release
permissions:
id-token: write
contents: write
steps:
- name: 📥 checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: ⚡️ setup uv
uses: astral-sh/setup-uv@v2
with:
version: "latest"
enable-cache: true
cache-suffix: 2024-09-08 09:10
cache-dependency-glob: |
pyproject.toml
uv.lock
- name: 📜 semantic release version
run: uv run semantic-release --strict version
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ dev-dependencies = [
"toml>=0.10.2",
"aiosqlite>=0.20.0",
"fastapi>=0.114.0",
"python-semantic-release>=9.8.8",
"twine>=5.1.1",
]

[tool.uv.sources]
Expand All @@ -35,3 +37,6 @@ asyncio_mode = 'auto'
branch = true
omit = ["tests/*", ".venv/*"]
concurrency = ["thread", "greenlet"]

[tool.semantic_release.remote.token]
env = "GH_TOKEN"
Loading

0 comments on commit e129176

Please sign in to comment.