- Use gitea.ref instead of github.ref for tag detection - Add release job with Gitea-compatible release-action - Add lint, test, and release jobs with proper dependencies
86 lines
1.8 KiB
YAML
86 lines
1.8 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ main, master ]
|
|
pull_request:
|
|
branches: [ main, master ]
|
|
|
|
permissions:
|
|
contents: read
|
|
checks: write
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.11'
|
|
cache: 'pip'
|
|
|
|
- name: Install linting tools
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install ruff mypy
|
|
|
|
- name: Run ruff check
|
|
run: python -m ruff check config_convert tests
|
|
|
|
- name: Run ruff format check
|
|
run: python -m ruff format --check config_convert tests
|
|
|
|
- name: Run mypy type checking
|
|
run: python -m mypy config_convert tests
|
|
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.11'
|
|
cache: 'pip'
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -e ".[dev]"
|
|
|
|
- name: Run pytest
|
|
run: python -m pytest tests/ -v --tb=short --ignore=tests/integration/
|
|
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
needs: [lint, test]
|
|
if: startsWith(gitea.ref, 'refs/tags/')
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Install build tools
|
|
run: pip install build
|
|
|
|
- name: Build package
|
|
run: python -m build
|
|
|
|
- name: Create Release
|
|
uses: https://gitea.com/actions/release-action@main
|
|
with:
|
|
files: |
|
|
dist/**
|