From ff2d621185e1db62dda666845ed6365a3d2b2052 Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Wed, 20 May 2026 18:37:21 +0530 Subject: [PATCH 1/7] chore: fix the pnpm version in GitHub Actions workflow --- .github/workflows/code-quality.yml | 36 ++++++++++++++---------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index 0dd2e1809..2590f98b3 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -17,7 +17,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: 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 - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: '3.12' @@ -35,7 +35,7 @@ jobs: run: pip install pre-commit - name: Cache pre-commit hooks - uses: actions/cache@v4 + uses: actions/cache@v5 with: path: ~/.cache/pre-commit key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} @@ -74,7 +74,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: 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 - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: '3.12' @@ -91,7 +91,7 @@ jobs: run: pip install pre-commit - name: Cache pre-commit hooks - uses: actions/cache@v4 + uses: actions/cache@v5 with: path: ~/.cache/pre-commit key: pre-commit-security-${{ hashFiles('.pre-commit-config.yaml') }} @@ -131,21 +131,21 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: fetch-depth: 0 - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: '3.12' - name: Install UV - uses: astral-sh/setup-uv@v3 + uses: astral-sh/setup-uv@v8.1.0 - name: Check if backend files changed id: backend-changes - uses: dorny/paths-filter@v3 + uses: dorny/paths-filter@v4 with: filters: | backend: @@ -153,7 +153,7 @@ jobs: - name: Cache dependencies if: steps.backend-changes.outputs.backend == 'true' - uses: actions/cache@v4 + uses: actions/cache@v5 with: path: | ~/.cache/uv @@ -171,7 +171,7 @@ jobs: - name: Cache pre-commit hooks if: steps.backend-changes.outputs.backend == 'true' - uses: actions/cache@v4 + uses: actions/cache@v5 with: path: ~/.cache/pre-commit key: pre-commit-backend-${{ hashFiles('.pre-commit-config.yaml') }} @@ -212,7 +212,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: fetch-depth: 0 @@ -221,18 +221,16 @@ jobs: 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 - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: node-version: '18' - name: Install pnpm - uses: pnpm/action-setup@v4 - with: - version: latest + uses: pnpm/action-setup@v6 - name: Check if frontend files changed id: frontend-changes - uses: dorny/paths-filter@v3 + uses: dorny/paths-filter@v4 with: filters: | web: @@ -254,7 +252,7 @@ jobs: run: pip install pre-commit - name: Cache pre-commit hooks - uses: actions/cache@v4 + uses: actions/cache@v5 with: path: ~/.cache/pre-commit key: pre-commit-frontend-${{ hashFiles('.pre-commit-config.yaml') }} From 20152b1243ab0650c6c197b67fd9a61d8a2b1639 Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Wed, 20 May 2026 18:41:05 +0530 Subject: [PATCH 2/7] chore: update Node.js version to 20 in GitHub Actions workflow --- .github/workflows/code-quality.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index 2590f98b3..f9042fee0 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -223,7 +223,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v6 with: - node-version: '18' + node-version: '20' - name: Install pnpm uses: pnpm/action-setup@v6 From 2de8ea550155ba17fb15d98f686792417d1e7e92 Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Wed, 20 May 2026 19:25:39 +0530 Subject: [PATCH 3/7] chore: update biome version in pre-commit configuration --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c02d2068b..1d814b430 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -67,7 +67,7 @@ repos: # Biome check for surfsense_web - id: 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 files: ^surfsense_web/ pass_filenames: false From a786574484e223a41cf5c04fb4c8583d9aa3c152 Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Wed, 20 May 2026 19:29:09 +0530 Subject: [PATCH 4/7] chore: simplify job names in GitHub Actions workflow --- .github/workflows/code-quality.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index f9042fee0..fcecdd23f 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -11,7 +11,7 @@ concurrency: jobs: file-quality: - name: File Quality Checks + name: File Quality runs-on: ubuntu-latest if: github.event.pull_request.draft == false @@ -125,7 +125,7 @@ jobs: exit ${exit_code:-0} python-backend: - name: Python Backend Quality + name: Backend Quality runs-on: ubuntu-latest if: github.event.pull_request.draft == false @@ -206,7 +206,7 @@ jobs: exit ${exit_code:-0} typescript-frontend: - name: TypeScript/JavaScript Quality + name: Frontend Quality runs-on: ubuntu-latest if: github.event.pull_request.draft == false From 844b8ba6090408f9ebc9c9eb8a1ce03b291e21e8 Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Wed, 20 May 2026 19:42:47 +0530 Subject: [PATCH 5/7] chore: refactor GitHub Actions workflow to improve backend change detection and job dependencies --- .github/workflows/backend-tests.yml | 82 ++++++++++++++++------------- 1 file changed, 45 insertions(+), 37 deletions(-) diff --git a/.github/workflows/backend-tests.yml b/.github/workflows/backend-tests.yml index 6e0a6db6d..ec8a2e7f6 100644 --- a/.github/workflows/backend-tests.yml +++ b/.github/workflows/backend-tests.yml @@ -10,10 +10,30 @@ concurrency: cancel-in-progress: true jobs: + changes: + name: Changes + runs-on: ubuntu-latest + outputs: + backend: ${{ steps.filter.outputs.backend }} + + steps: + - name: Checkout code + uses: actions/checkout@v6 + + - name: Check changed files + id: filter + uses: dorny/paths-filter@v4 + with: + filters: | + backend: + - 'surfsense_backend/**' + - '.github/workflows/backend-tests.yml' + unit-tests: name: Unit Tests runs-on: ubuntu-latest - if: github.event.pull_request.draft == false + needs: changes + if: ${{ github.event.pull_request.draft == false && needs.changes.outputs.backend == 'true' }} env: EMBEDDING_MODEL: sentence-transformers/all-MiniLM-L6-v2 @@ -21,26 +41,15 @@ jobs: - name: Checkout code 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 - if: steps.backend-changes.outputs.backend == 'true' - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: '3.12' - name: Install UV - if: steps.backend-changes.outputs.backend == 'true' - uses: astral-sh/setup-uv@v7 + uses: astral-sh/setup-uv@v8.1.0 - name: Cache dependencies - if: steps.backend-changes.outputs.backend == 'true' uses: actions/cache@v5 with: path: | @@ -51,26 +60,24 @@ jobs: python-deps- - name: Cache HuggingFace models - if: steps.backend-changes.outputs.backend == 'true' uses: actions/cache@v5 with: path: ~/.cache/huggingface key: hf-models-${{ env.EMBEDDING_MODEL }} - name: Install dependencies - if: steps.backend-changes.outputs.backend == 'true' working-directory: surfsense_backend run: uv sync - name: Run unit tests - if: steps.backend-changes.outputs.backend == 'true' working-directory: surfsense_backend run: uv run pytest -m unit integration-tests: name: Integration Tests runs-on: ubuntu-latest - if: github.event.pull_request.draft == false + needs: changes + if: ${{ github.event.pull_request.draft == false && needs.changes.outputs.backend == 'true' }} env: EMBEDDING_MODEL: sentence-transformers/all-MiniLM-L6-v2 @@ -93,26 +100,15 @@ jobs: - name: Checkout code 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 - if: steps.backend-changes.outputs.backend == 'true' - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: '3.12' - name: Install UV - if: steps.backend-changes.outputs.backend == 'true' - uses: astral-sh/setup-uv@v7 + uses: astral-sh/setup-uv@v8.1.0 - name: Cache dependencies - if: steps.backend-changes.outputs.backend == 'true' uses: actions/cache@v5 with: path: | @@ -123,19 +119,16 @@ jobs: python-deps- - name: Cache HuggingFace models - if: steps.backend-changes.outputs.backend == 'true' uses: actions/cache@v5 with: path: ~/.cache/huggingface key: hf-models-${{ env.EMBEDDING_MODEL }} - name: Install dependencies - if: steps.backend-changes.outputs.backend == 'true' working-directory: surfsense_backend run: uv sync - name: Run integration tests - if: steps.backend-changes.outputs.backend == 'true' working-directory: surfsense_backend env: TEST_DATABASE_URL: postgresql+asyncpg://postgres:postgres@localhost:5432/surfsense_test @@ -146,14 +139,29 @@ jobs: test-gate: name: Test Gate runs-on: ubuntu-latest - needs: [unit-tests, integration-tests] + needs: [changes, unit-tests, integration-tests] if: always() steps: - name: Check all test jobs run: | - if [[ "${{ needs.unit-tests.result }}" == "failure" || - "${{ needs.integration-tests.result }}" == "failure" ]]; then + if [[ "${{ needs.changes.result }}" == "failure" || "${{ needs.changes.result }}" == "cancelled" ]]; then + echo "Backend change detection failed" + exit 1 + fi + + if [[ "${{ github.event.pull_request.draft }}" == "true" ]]; then + echo "Draft PR; backend tests skipped" + exit 0 + fi + + if [[ "${{ needs.changes.outputs.backend }}" != "true" ]]; then + echo "No backend changes detected; backend tests skipped" + exit 0 + fi + + if [[ "${{ needs.unit-tests.result }}" != "success" || + "${{ needs.integration-tests.result }}" != "success" ]]; then echo "Backend tests failed" exit 1 else From a6a0f7a373b039997ba8f1294edd30aa4cc39170 Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Wed, 20 May 2026 20:03:51 +0530 Subject: [PATCH 6/7] chore: streamline GitHub Actions workflow by removing change detection job and simplifying test conditions --- .github/workflows/backend-tests.yml | 49 +++++------------------------ 1 file changed, 8 insertions(+), 41 deletions(-) diff --git a/.github/workflows/backend-tests.yml b/.github/workflows/backend-tests.yml index ec8a2e7f6..7916dcf50 100644 --- a/.github/workflows/backend-tests.yml +++ b/.github/workflows/backend-tests.yml @@ -4,36 +4,19 @@ on: pull_request: branches: [main, dev] types: [opened, synchronize, reopened, ready_for_review] + paths: + - 'surfsense_backend/**' + - '.github/workflows/backend-tests.yml' concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: - changes: - name: Changes - runs-on: ubuntu-latest - outputs: - backend: ${{ steps.filter.outputs.backend }} - - steps: - - name: Checkout code - uses: actions/checkout@v6 - - - name: Check changed files - id: filter - uses: dorny/paths-filter@v4 - with: - filters: | - backend: - - 'surfsense_backend/**' - - '.github/workflows/backend-tests.yml' - unit-tests: name: Unit Tests runs-on: ubuntu-latest - needs: changes - if: ${{ github.event.pull_request.draft == false && needs.changes.outputs.backend == 'true' }} + if: github.event.pull_request.draft == false env: EMBEDDING_MODEL: sentence-transformers/all-MiniLM-L6-v2 @@ -76,8 +59,7 @@ jobs: integration-tests: name: Integration Tests runs-on: ubuntu-latest - needs: changes - if: ${{ github.event.pull_request.draft == false && needs.changes.outputs.backend == 'true' }} + if: github.event.pull_request.draft == false env: EMBEDDING_MODEL: sentence-transformers/all-MiniLM-L6-v2 @@ -139,29 +121,14 @@ jobs: test-gate: name: Test Gate runs-on: ubuntu-latest - needs: [changes, unit-tests, integration-tests] + needs: [unit-tests, integration-tests] if: always() steps: - name: Check all test jobs run: | - if [[ "${{ needs.changes.result }}" == "failure" || "${{ needs.changes.result }}" == "cancelled" ]]; then - echo "Backend change detection failed" - exit 1 - fi - - if [[ "${{ github.event.pull_request.draft }}" == "true" ]]; then - echo "Draft PR; backend tests skipped" - exit 0 - fi - - if [[ "${{ needs.changes.outputs.backend }}" != "true" ]]; then - echo "No backend changes detected; backend tests skipped" - exit 0 - fi - - if [[ "${{ needs.unit-tests.result }}" != "success" || - "${{ needs.integration-tests.result }}" != "success" ]]; then + if [[ "${{ needs.unit-tests.result }}" == "failure" || + "${{ needs.integration-tests.result }}" == "failure" ]]; then echo "Backend tests failed" exit 1 else From 58a975205da99e105d92924e7ffea4820a48fa8e Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Wed, 20 May 2026 20:06:38 +0530 Subject: [PATCH 7/7] chore: add workflow file to change detection filters for backend and frontend jobs --- .github/workflows/code-quality.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index fcecdd23f..27e587794 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -150,6 +150,7 @@ jobs: filters: | backend: - 'surfsense_backend/**' + - '.github/workflows/code-quality.yml' - name: Cache dependencies if: steps.backend-changes.outputs.backend == 'true' @@ -235,8 +236,10 @@ jobs: filters: | web: - 'surfsense_web/**' + - '.github/workflows/code-quality.yml' extension: - 'surfsense_browser_extension/**' + - '.github/workflows/code-quality.yml' - name: Install dependencies for web if: steps.frontend-changes.outputs.web == 'true'