diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 3c2e10a..f87d118 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -3,11 +3,45 @@ name: Release on: push: branches: [main] + paths: + - 'src/**' + - 'src-tauri/**' + - 'package.json' + - 'vite.config.ts' + - 'index.html' 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: name: Bump version and tag - if: "!contains(github.event.head_commit.message, '[skip ci]')" + needs: test runs-on: ubuntu-latest outputs: new_version: ${{ steps.bump.outputs.new_version }} diff --git a/.gitea/workflows/sidecar-release.yml b/.gitea/workflows/sidecar-release.yml index 6bd6439..f7357b9 100644 --- a/.gitea/workflows/sidecar-release.yml +++ b/.gitea/workflows/sidecar-release.yml @@ -12,8 +12,27 @@ on: workflow_dispatch: 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: name: Bump sidecar version and tag + needs: test if: "!contains(github.event.head_commit.message, '[skip ci]')" runs-on: ubuntu-latest outputs: @@ -61,7 +80,6 @@ jobs: NEW_VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}" 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 echo "version=${NEW_VERSION}" >> $GITHUB_OUTPUT diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml index de396f6..9f40287 100644 --- a/.gitea/workflows/test.yml +++ b/.gitea/workflows/test.yml @@ -5,6 +5,7 @@ on: branches: [main] pull_request: branches: [main] + workflow_dispatch: jobs: python-tests: @@ -13,12 +14,20 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Install test dependencies + - name: Install uv 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 - 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: name: Frontend Tests