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
|
- name: Use system Python
|
||||||
run: |
|
run: |
|
||||||
echo "Python $(python3 --version)"
|
echo "Python $(python3 --version)"
|
||||||
echo "UV=$(uv --version)"
|
|
||||||
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies (with dev)
|
||||||
run: uv sync --group dev
|
run: uv sync --group dev
|
||||||
|
|
||||||
- name: Run tests with coverage
|
- name: Run tests with coverage
|
||||||
@ -37,14 +36,8 @@ jobs:
|
|||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Python
|
- name: Use system Python
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version: "3.12"
|
|
||||||
|
|
||||||
- name: Install UV
|
|
||||||
run: |
|
run: |
|
||||||
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
||||||
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
@ -57,24 +50,3 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
! grep -r "password\s*=" --include="*.py" src/ || true
|
! grep -r "password\s*=" --include="*.py" src/ || true
|
||||||
! grep -r "token\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
|
|
||||||
|
|||||||
@ -22,7 +22,6 @@ jobs:
|
|||||||
- name: Use system Python
|
- name: Use system Python
|
||||||
run: |
|
run: |
|
||||||
echo "Python $(python3 --version)"
|
echo "Python $(python3 --version)"
|
||||||
echo "UV=$(uv --version)"
|
|
||||||
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
- name: Get version from tag or pyproject
|
- name: Get version from tag or pyproject
|
||||||
@ -35,17 +34,18 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies (production only)
|
||||||
run: uv sync --group dev
|
run: uv sync --no-dev
|
||||||
|
|
||||||
- name: Run tests
|
|
||||||
run: uv run pytest tests/unit/ -v
|
|
||||||
|
|
||||||
- name: Build package
|
- name: Build package
|
||||||
run: uv build
|
run: uv build
|
||||||
|
|
||||||
- name: Save dist path
|
- name: Upload artifacts
|
||||||
run: echo "DIST_PATH=$(pwd)/dist" >> $GITHUB_ENV
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: dist
|
||||||
|
path: dist/
|
||||||
|
retention-days: 7
|
||||||
|
|
||||||
publish-gitea:
|
publish-gitea:
|
||||||
needs: build
|
needs: build
|
||||||
@ -53,20 +53,14 @@ jobs:
|
|||||||
if: startsWith(github.ref, 'refs/tags/v')
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Download artifacts
|
||||||
uses: actions/checkout@v4
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
- name: Get version from tag
|
name: dist
|
||||||
run: |
|
path: dist/
|
||||||
VERSION=${GITHUB_REF#refs/tags/v}
|
|
||||||
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Build package
|
|
||||||
run: uv build
|
|
||||||
|
|
||||||
- name: Publish to Gitea Packages
|
- name: Publish to Gitea Packages
|
||||||
run: |
|
run: |
|
||||||
# Gitea PyPI-compatible API
|
|
||||||
uv publish \
|
uv publish \
|
||||||
--username ${{ github.actor }} \
|
--username ${{ github.actor }} \
|
||||||
--password ${{ secrets.GITEA_TOKEN }} \
|
--password ${{ secrets.GITEA_TOKEN }} \
|
||||||
@ -83,11 +77,10 @@ jobs:
|
|||||||
|
|
||||||
- name: Use system Python
|
- name: Use system Python
|
||||||
run: |
|
run: |
|
||||||
echo "Python $(python3 --version)"
|
|
||||||
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: uv sync --group dev
|
run: uv sync --no-dev
|
||||||
|
|
||||||
- name: Build documentation
|
- name: Build documentation
|
||||||
run: uv run mkdocs build
|
run: uv run mkdocs build
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user