Fix CI: use uv for test venv, gate builds on tests, reduce build triggers
- test.yml: use uv venv instead of pip --break-system-packages - release.yml: inline test job that must pass before version bump; only triggers on source file changes (src/, src-tauri/, package.json) - sidecar-release.yml: inline Python test job that must pass before sidecar version bump - Both coordinators use `needs: test` so builds never start if tests fail Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3,11 +3,45 @@ name: Release
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
|
paths:
|
||||||
|
- 'src/**'
|
||||||
|
- 'src-tauri/**'
|
||||||
|
- 'package.json'
|
||||||
|
- 'vite.config.ts'
|
||||||
|
- 'index.html'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
test:
|
||||||
|
name: Run Tests
|
||||||
|
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 20
|
||||||
|
|
||||||
|
- name: Install npm deps
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Frontend tests
|
||||||
|
run: npx vitest run
|
||||||
|
|
||||||
|
- name: Install uv
|
||||||
|
run: |
|
||||||
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
|
- name: Python tests
|
||||||
|
run: |
|
||||||
|
uv venv .testvenv
|
||||||
|
VIRTUAL_ENV=.testvenv uv pip install pytest httpx pytest-asyncio anyio fastapi pydantic pyyaml uvicorn requests
|
||||||
|
.testvenv/bin/python -m pytest backend/tests/ client/tests/ -v --tb=short
|
||||||
|
|
||||||
bump-version:
|
bump-version:
|
||||||
name: Bump version and tag
|
name: Bump version and tag
|
||||||
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
needs: test
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
new_version: ${{ steps.bump.outputs.new_version }}
|
new_version: ${{ steps.bump.outputs.new_version }}
|
||||||
|
|||||||
@@ -12,8 +12,27 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
test:
|
||||||
|
name: Run Tests
|
||||||
|
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install uv
|
||||||
|
run: |
|
||||||
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
|
- name: Python tests
|
||||||
|
run: |
|
||||||
|
uv venv .testvenv
|
||||||
|
VIRTUAL_ENV=.testvenv uv pip install pytest httpx pytest-asyncio anyio fastapi pydantic pyyaml uvicorn requests
|
||||||
|
.testvenv/bin/python -m pytest backend/tests/ client/tests/ -v --tb=short
|
||||||
|
|
||||||
bump-sidecar-version:
|
bump-sidecar-version:
|
||||||
name: Bump sidecar version and tag
|
name: Bump sidecar version and tag
|
||||||
|
needs: test
|
||||||
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
@@ -61,7 +80,6 @@ jobs:
|
|||||||
NEW_VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}"
|
NEW_VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}"
|
||||||
echo "New sidecar version: ${NEW_VERSION}"
|
echo "New sidecar version: ${NEW_VERSION}"
|
||||||
|
|
||||||
# Only update pyproject.toml -- version.py is owned by the app release workflow
|
|
||||||
sed -i "s/^version = \"${CURRENT}\"/version = \"${NEW_VERSION}\"/" pyproject.toml
|
sed -i "s/^version = \"${CURRENT}\"/version = \"${NEW_VERSION}\"/" pyproject.toml
|
||||||
|
|
||||||
echo "version=${NEW_VERSION}" >> $GITHUB_OUTPUT
|
echo "version=${NEW_VERSION}" >> $GITHUB_OUTPUT
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ on:
|
|||||||
branches: [main]
|
branches: [main]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
python-tests:
|
python-tests:
|
||||||
@@ -13,12 +14,20 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install test dependencies
|
- name: Install uv
|
||||||
run: |
|
run: |
|
||||||
pip install --break-system-packages pytest httpx pytest-asyncio anyio fastapi pydantic pyyaml uvicorn requests
|
if command -v uv &> /dev/null; then
|
||||||
|
echo "uv already installed: $(uv --version)"
|
||||||
|
else
|
||||||
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Run pytest
|
- name: Run pytest
|
||||||
run: python3 -m pytest backend/tests/ client/tests/ -v --tb=short
|
run: |
|
||||||
|
uv venv .testvenv
|
||||||
|
VIRTUAL_ENV=.testvenv uv pip install pytest httpx pytest-asyncio anyio fastapi pydantic pyyaml uvicorn requests
|
||||||
|
.testvenv/bin/python -m pytest backend/tests/ client/tests/ -v --tb=short
|
||||||
|
|
||||||
frontend-tests:
|
frontend-tests:
|
||||||
name: Frontend Tests
|
name: Frontend Tests
|
||||||
|
|||||||
Reference in New Issue
Block a user