ci: add gitea build and publish actions
Some checks failed
Build Python Package / build (push) Failing after 29s
Some checks failed
Build Python Package / build (push) Failing after 29s
This commit is contained in:
21
.gitea/scripts/setup-poetry.sh
Executable file
21
.gitea/scripts/setup-poetry.sh
Executable file
@@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo "Setting up Python and Poetry..."
|
||||||
|
|
||||||
|
# Install Poetry
|
||||||
|
pip install pipx
|
||||||
|
pipx install poetry
|
||||||
|
|
||||||
|
# Add Poetry to PATH
|
||||||
|
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
|
# Configure Poetry
|
||||||
|
poetry config virtualenvs.create false
|
||||||
|
|
||||||
|
poetry check
|
||||||
|
|
||||||
|
poetry lock --check
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
poetry install --no-root --no-interaction
|
||||||
37
.gitea/workflows/build.yml
Normal file
37
.gitea/workflows/build.yml
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
name: Build Python Package
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: "3.13"
|
||||||
|
|
||||||
|
- name: Run setup script
|
||||||
|
run: .gitea/scripts/setup-poetry.sh
|
||||||
|
|
||||||
|
- name: Check code formatting by black
|
||||||
|
run: |
|
||||||
|
poetry run black . --check
|
||||||
|
|
||||||
|
- name: Lint code by ruff
|
||||||
|
run: |
|
||||||
|
poetry run ruff .
|
||||||
|
|
||||||
|
- name: Check types by pyright
|
||||||
|
run: |
|
||||||
|
poetry run pyright
|
||||||
|
|
||||||
|
- name: Build package
|
||||||
|
run: poetry build
|
||||||
29
.gitea/workflows/publish.yml
Normal file
29
.gitea/workflows/publish.yml
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
name: Publish Python Package
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: "3.13"
|
||||||
|
|
||||||
|
- name: Run setup script
|
||||||
|
run: .gitea/scripts/setup-poetry.sh
|
||||||
|
|
||||||
|
- name: Build package
|
||||||
|
run: poetry build
|
||||||
|
|
||||||
|
- name: Publish to PyPI
|
||||||
|
env:
|
||||||
|
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
|
||||||
|
run: poetry publish --username __token__ --password $POETRY_PYPI_TOKEN_PYPI
|
||||||
Reference in New Issue
Block a user