ci: split workflows - PR tests with dev deps, main build without dev deps
- PR workflow: full tests with dev dependencies (pytest, ruff, pip-audit) - Release workflow: production-only build for main and tags - Use upload-artifact@v3 for Gitea compatibility - Separate docs deployment for main branch - Faster CI by avoiding dev deps in production builds
This commit is contained in:
parent
1e4d8bdf9f
commit
8a018e4e6d
@ -15,10 +15,9 @@ jobs:
|
||||
- name: Use system Python
|
||||
run: |
|
||||
echo "Python $(python3 --version)"
|
||||
echo "UV=$(uv --version)"
|
||||
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Install dependencies
|
||||
- name: Install dependencies (with dev)
|
||||
run: uv sync --group dev
|
||||
|
||||
- name: Run tests with coverage
|
||||
@ -37,14 +36,8 @@ jobs:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
|
||||
- name: Install UV
|
||||
- name: Use system Python
|
||||
run: |
|
||||
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Install dependencies
|
||||
@ -57,24 +50,3 @@ jobs:
|
||||
run: |
|
||||
! grep -r "password\s*=" --include="*.py" src/ || true
|
||||
! grep -r "token\s*=" --include="*.py" src/ || true
|
||||
|
||||
commitlint:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "20"
|
||||
|
||||
- name: Install commitlint
|
||||
run: npm install -g @commitlint/cli @commitlint/config-conventional
|
||||
|
||||
- name: Validate PR title
|
||||
run: |
|
||||
echo "${{ github.event.pull_request.title }}" | commitlint --help-only || true
|
||||
|
||||
@ -3,8 +3,8 @@ name: Release & Publish
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
tags:
|
||||
- 'v*'
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@ -22,7 +22,6 @@ jobs:
|
||||
- name: Use system Python
|
||||
run: |
|
||||
echo "Python $(python3 --version)"
|
||||
echo "UV=$(uv --version)"
|
||||
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Get version from tag or pyproject
|
||||
@ -35,17 +34,18 @@ jobs:
|
||||
fi
|
||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Install dependencies
|
||||
run: uv sync --group dev
|
||||
|
||||
- name: Run tests
|
||||
run: uv run pytest tests/unit/ -v
|
||||
- name: Install dependencies (production only)
|
||||
run: uv sync --no-dev
|
||||
|
||||
- name: Build package
|
||||
run: uv build
|
||||
|
||||
- name: Save dist path
|
||||
run: echo "DIST_PATH=$(pwd)/dist" >> $GITHUB_ENV
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: dist
|
||||
path: dist/
|
||||
retention-days: 7
|
||||
|
||||
publish-gitea:
|
||||
needs: build
|
||||
@ -53,20 +53,14 @@ jobs:
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Get version from tag
|
||||
run: |
|
||||
VERSION=${GITHUB_REF#refs/tags/v}
|
||||
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||
|
||||
- name: Build package
|
||||
run: uv build
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: dist
|
||||
path: dist/
|
||||
|
||||
- name: Publish to Gitea Packages
|
||||
run: |
|
||||
# Gitea PyPI-compatible API
|
||||
uv publish \
|
||||
--username ${{ github.actor }} \
|
||||
--password ${{ secrets.GITEA_TOKEN }} \
|
||||
@ -83,11 +77,10 @@ jobs:
|
||||
|
||||
- name: Use system Python
|
||||
run: |
|
||||
echo "Python $(python3 --version)"
|
||||
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Install dependencies
|
||||
run: uv sync --group dev
|
||||
run: uv sync --no-dev
|
||||
|
||||
- name: Build documentation
|
||||
run: uv run mkdocs build
|
||||
|
||||
Loading…
Reference in New Issue
Block a user