Merge pull request #1420 from AnishSarkar22/fix/pnpm-version-ci

fix: Update CI workflow versions and scoped test triggers
This commit is contained in:
Rohan Verma 2026-05-20 12:14:47 -07:00 committed by GitHub
commit 883ac81ce1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 32 additions and 56 deletions

View file

@ -4,6 +4,9 @@ on:
pull_request: pull_request:
branches: [main, dev] branches: [main, dev]
types: [opened, synchronize, reopened, ready_for_review] types: [opened, synchronize, reopened, ready_for_review]
paths:
- 'surfsense_backend/**'
- '.github/workflows/backend-tests.yml'
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.ref }} group: ${{ github.workflow }}-${{ github.ref }}
@ -21,26 +24,15 @@ jobs:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v6 uses: actions/checkout@v6
- name: Check if backend files changed
id: backend-changes
uses: dorny/paths-filter@v3
with:
filters: |
backend:
- 'surfsense_backend/**'
- name: Set up Python - name: Set up Python
if: steps.backend-changes.outputs.backend == 'true' uses: actions/setup-python@v6
uses: actions/setup-python@v5
with: with:
python-version: '3.12' python-version: '3.12'
- name: Install UV - name: Install UV
if: steps.backend-changes.outputs.backend == 'true' uses: astral-sh/setup-uv@v8.1.0
uses: astral-sh/setup-uv@v7
- name: Cache dependencies - name: Cache dependencies
if: steps.backend-changes.outputs.backend == 'true'
uses: actions/cache@v5 uses: actions/cache@v5
with: with:
path: | path: |
@ -51,19 +43,16 @@ jobs:
python-deps- python-deps-
- name: Cache HuggingFace models - name: Cache HuggingFace models
if: steps.backend-changes.outputs.backend == 'true'
uses: actions/cache@v5 uses: actions/cache@v5
with: with:
path: ~/.cache/huggingface path: ~/.cache/huggingface
key: hf-models-${{ env.EMBEDDING_MODEL }} key: hf-models-${{ env.EMBEDDING_MODEL }}
- name: Install dependencies - name: Install dependencies
if: steps.backend-changes.outputs.backend == 'true'
working-directory: surfsense_backend working-directory: surfsense_backend
run: uv sync run: uv sync
- name: Run unit tests - name: Run unit tests
if: steps.backend-changes.outputs.backend == 'true'
working-directory: surfsense_backend working-directory: surfsense_backend
run: uv run pytest -m unit run: uv run pytest -m unit
@ -93,26 +82,15 @@ jobs:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v6 uses: actions/checkout@v6
- name: Check if backend files changed
id: backend-changes
uses: dorny/paths-filter@v3
with:
filters: |
backend:
- 'surfsense_backend/**'
- name: Set up Python - name: Set up Python
if: steps.backend-changes.outputs.backend == 'true' uses: actions/setup-python@v6
uses: actions/setup-python@v5
with: with:
python-version: '3.12' python-version: '3.12'
- name: Install UV - name: Install UV
if: steps.backend-changes.outputs.backend == 'true' uses: astral-sh/setup-uv@v8.1.0
uses: astral-sh/setup-uv@v7
- name: Cache dependencies - name: Cache dependencies
if: steps.backend-changes.outputs.backend == 'true'
uses: actions/cache@v5 uses: actions/cache@v5
with: with:
path: | path: |
@ -123,19 +101,16 @@ jobs:
python-deps- python-deps-
- name: Cache HuggingFace models - name: Cache HuggingFace models
if: steps.backend-changes.outputs.backend == 'true'
uses: actions/cache@v5 uses: actions/cache@v5
with: with:
path: ~/.cache/huggingface path: ~/.cache/huggingface
key: hf-models-${{ env.EMBEDDING_MODEL }} key: hf-models-${{ env.EMBEDDING_MODEL }}
- name: Install dependencies - name: Install dependencies
if: steps.backend-changes.outputs.backend == 'true'
working-directory: surfsense_backend working-directory: surfsense_backend
run: uv sync run: uv sync
- name: Run integration tests - name: Run integration tests
if: steps.backend-changes.outputs.backend == 'true'
working-directory: surfsense_backend working-directory: surfsense_backend
env: env:
TEST_DATABASE_URL: postgresql+asyncpg://postgres:postgres@localhost:5432/surfsense_test TEST_DATABASE_URL: postgresql+asyncpg://postgres:postgres@localhost:5432/surfsense_test

View file

@ -11,13 +11,13 @@ concurrency:
jobs: jobs:
file-quality: file-quality:
name: File Quality Checks name: File Quality
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.event.pull_request.draft == false if: github.event.pull_request.draft == false
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v6
with: with:
fetch-depth: 0 fetch-depth: 0
@ -27,7 +27,7 @@ jobs:
git fetch origin ${{ github.base_ref }}:${{ github.base_ref }} 2>/dev/null || git fetch origin ${{ github.base_ref }} 2>/dev/null || true git fetch origin ${{ github.base_ref }}:${{ github.base_ref }} 2>/dev/null || git fetch origin ${{ github.base_ref }} 2>/dev/null || true
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v5 uses: actions/setup-python@v6
with: with:
python-version: '3.12' python-version: '3.12'
@ -35,7 +35,7 @@ jobs:
run: pip install pre-commit run: pip install pre-commit
- name: Cache pre-commit hooks - name: Cache pre-commit hooks
uses: actions/cache@v4 uses: actions/cache@v5
with: with:
path: ~/.cache/pre-commit path: ~/.cache/pre-commit
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
@ -74,7 +74,7 @@ jobs:
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v6
with: with:
fetch-depth: 0 fetch-depth: 0
@ -83,7 +83,7 @@ jobs:
git fetch origin ${{ github.base_ref }}:${{ github.base_ref }} 2>/dev/null || git fetch origin ${{ github.base_ref }} 2>/dev/null || true git fetch origin ${{ github.base_ref }}:${{ github.base_ref }} 2>/dev/null || git fetch origin ${{ github.base_ref }} 2>/dev/null || true
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v5 uses: actions/setup-python@v6
with: with:
python-version: '3.12' python-version: '3.12'
@ -91,7 +91,7 @@ jobs:
run: pip install pre-commit run: pip install pre-commit
- name: Cache pre-commit hooks - name: Cache pre-commit hooks
uses: actions/cache@v4 uses: actions/cache@v5
with: with:
path: ~/.cache/pre-commit path: ~/.cache/pre-commit
key: pre-commit-security-${{ hashFiles('.pre-commit-config.yaml') }} key: pre-commit-security-${{ hashFiles('.pre-commit-config.yaml') }}
@ -125,35 +125,36 @@ jobs:
exit ${exit_code:-0} exit ${exit_code:-0}
python-backend: python-backend:
name: Python Backend Quality name: Backend Quality
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.event.pull_request.draft == false if: github.event.pull_request.draft == false
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v6
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v5 uses: actions/setup-python@v6
with: with:
python-version: '3.12' python-version: '3.12'
- name: Install UV - name: Install UV
uses: astral-sh/setup-uv@v3 uses: astral-sh/setup-uv@v8.1.0
- name: Check if backend files changed - name: Check if backend files changed
id: backend-changes id: backend-changes
uses: dorny/paths-filter@v3 uses: dorny/paths-filter@v4
with: with:
filters: | filters: |
backend: backend:
- 'surfsense_backend/**' - 'surfsense_backend/**'
- '.github/workflows/code-quality.yml'
- name: Cache dependencies - name: Cache dependencies
if: steps.backend-changes.outputs.backend == 'true' if: steps.backend-changes.outputs.backend == 'true'
uses: actions/cache@v4 uses: actions/cache@v5
with: with:
path: | path: |
~/.cache/uv ~/.cache/uv
@ -171,7 +172,7 @@ jobs:
- name: Cache pre-commit hooks - name: Cache pre-commit hooks
if: steps.backend-changes.outputs.backend == 'true' if: steps.backend-changes.outputs.backend == 'true'
uses: actions/cache@v4 uses: actions/cache@v5
with: with:
path: ~/.cache/pre-commit path: ~/.cache/pre-commit
key: pre-commit-backend-${{ hashFiles('.pre-commit-config.yaml') }} key: pre-commit-backend-${{ hashFiles('.pre-commit-config.yaml') }}
@ -206,13 +207,13 @@ jobs:
exit ${exit_code:-0} exit ${exit_code:-0}
typescript-frontend: typescript-frontend:
name: TypeScript/JavaScript Quality name: Frontend Quality
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.event.pull_request.draft == false if: github.event.pull_request.draft == false
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v6
with: with:
fetch-depth: 0 fetch-depth: 0
@ -221,24 +222,24 @@ jobs:
git fetch origin ${{ github.base_ref }}:${{ github.base_ref }} 2>/dev/null || git fetch origin ${{ github.base_ref }} 2>/dev/null || true git fetch origin ${{ github.base_ref }}:${{ github.base_ref }} 2>/dev/null || git fetch origin ${{ github.base_ref }} 2>/dev/null || true
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v6
with: with:
node-version: '18' node-version: '20'
- name: Install pnpm - name: Install pnpm
uses: pnpm/action-setup@v4 uses: pnpm/action-setup@v6
with:
version: latest
- name: Check if frontend files changed - name: Check if frontend files changed
id: frontend-changes id: frontend-changes
uses: dorny/paths-filter@v3 uses: dorny/paths-filter@v4
with: with:
filters: | filters: |
web: web:
- 'surfsense_web/**' - 'surfsense_web/**'
- '.github/workflows/code-quality.yml'
extension: extension:
- 'surfsense_browser_extension/**' - 'surfsense_browser_extension/**'
- '.github/workflows/code-quality.yml'
- name: Install dependencies for web - name: Install dependencies for web
if: steps.frontend-changes.outputs.web == 'true' if: steps.frontend-changes.outputs.web == 'true'
@ -254,7 +255,7 @@ jobs:
run: pip install pre-commit run: pip install pre-commit
- name: Cache pre-commit hooks - name: Cache pre-commit hooks
uses: actions/cache@v4 uses: actions/cache@v5
with: with:
path: ~/.cache/pre-commit path: ~/.cache/pre-commit
key: pre-commit-frontend-${{ hashFiles('.pre-commit-config.yaml') }} key: pre-commit-frontend-${{ hashFiles('.pre-commit-config.yaml') }}

View file

@ -67,7 +67,7 @@ repos:
# Biome check for surfsense_web # Biome check for surfsense_web
- id: biome-check-web - id: biome-check-web
name: biome-check-web name: biome-check-web
entry: bash -c 'cd surfsense_web && npx @biomejs/biome check --diagnostic-level=error .' entry: bash -c 'cd surfsense_web && npx @biomejs/biome@2.4.6 check --diagnostic-level=error .'
language: system language: system
files: ^surfsense_web/ files: ^surfsense_web/
pass_filenames: false pass_filenames: false