Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

ci(web): parallelize web tests with 4-shard Vitest sharding (#32713)

yyh35b31d0cdd1f
diff --git a/.github/workflows/web-tests.yml b/.github/workflows/web-tests.yml
index 78d0b2af40c..f50689636b8 100644
--- a/.github/workflows/web-tests.yml
+++ b/.github/workflows/web-tests.yml
@@ -3,14 +3,22 @@ name: Web Tests
on:
workflow_call:
+permissions:
+ contents: read
+
concurrency:
group: web-tests-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
test:
- name: Web Tests
+ name: Web Tests (${{ matrix.shardIndex }}/${{ matrix.shardTotal }})
runs-on: ubuntu-latest
+ strategy:
+ fail-fast: false
+ matrix:
+ shardIndex: [1, 2, 3, 4]
+ shardTotal: [4]
defaults:
run:
shell: bash
@@ -39,7 +47,58 @@ jobs:
run: pnpm install --frozen-lockfile
- name: Run tests
- run: pnpm test:ci
+ run: pnpm vitest run --reporter=blob --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --coverage
+
+ - name: Upload blob report
+ if: ${{ !cancelled() }}
+ uses: actions/upload-artifact@v6
+ with:
+ name: blob-report-${{ matrix.shardIndex }}
+ path: web/.vitest-reports/*
+ include-hidden-files: true
+ retention-days: 1
+
+ merge-reports:
+ name: Merge Test Reports
+ if: ${{ !cancelled() }}
+ needs: [test]
+ runs-on: ubuntu-latest
+ defaults:
+ run:
+ shell: bash
+ working-directory: ./web
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v6
+ with:
+ persist-credentials: false
+
+ - name: Install pnpm
+ uses: pnpm/action-setup@v4
+ with:
+ package_json_file: web/package.json
+ run_install: false
+
+ - name: Setup Node.js
+ uses: actions/setup-node@v6
+ with:
+ node-version: 24
+ cache: pnpm
+ cache-dependency-path: ./web/pnpm-lock.yaml
+
+ - name: Install dependencies
+ run: pnpm install --frozen-lockfile
+
+ - name: Download blob reports
+ uses: actions/download-artifact@v6
+ with:
+ path: web/.vitest-reports
+ pattern: blob-report-*
+ merge-multiple: true
+
+ - name: Merge reports
+ run: pnpm vitest --merge-reports --coverage --silent=passed-only
- name: Coverage Summary
if: always()
diff --git a/web/app/components/header/account-setting/index.tsx b/web/app/components/header/account-setting/index.tsx
index 65ac3965293..45d8dde8a6b 100644
--- a/web/app/components/header/account-setting/index.tsx
+++ b/web/app/components/header/account-setting/index.tsx
@@ -209,7 +209,7 @@ export default function AccountSetting({
<div className="mt-1 text-text-tertiary system-sm-regular">{activeItem?.description}</div>
)}
</div>
- {activeItem?.key === 'provider' && (
+ {activeItem?.key === ACCOUNT_SETTING_TAB.PROVIDER && (
<div className="flex grow justify-end">
<SearchInput
className="w-[200px]"
@@ -220,13 +220,13 @@ export default function AccountSetting({
)}
</div>
<div className="px-4 pt-2 sm:px-8">
- {activeMenu === 'provider' && <ModelProviderPage searchText={searchValue} />}
- {activeMenu === 'members' && <MembersPage />}
- {activeMenu === 'billing' && <BillingPage />}
- {activeMenu === 'data-source' && <DataSourcePage />}
- {activeMenu === 'api-based-extension' && <ApiBasedExtensionPage />}
- {activeMenu === 'custom' && <CustomPage />}
- {activeMenu === 'language' && <LanguagePage />}
+ {activeMenu === ACCOUNT_SETTING_TAB.PROVIDER && <ModelProviderPage searchText={searchValue} />}
+ {activeMenu === ACCOUNT_SETTING_TAB.MEMBERS && <MembersPage />}
+ {activeMenu === ACCOUNT_SETTING_TAB.BILLING && <BillingPage />}
+ {activeMenu === ACCOUNT_SETTING_TAB.DATA_SOURCE && <DataSourcePage />}
+ {activeMenu === ACCOUNT_SETTING_TAB.API_BASED_EXTENSION && <ApiBasedExtensionPage />}
+ {activeMenu === ACCOUNT_SETTING_TAB.CUSTOM && <CustomPage />}
+ {activeMenu === ACCOUNT_SETTING_TAB.LANGUAGE && <LanguagePage />}
</div>
</div>
</div>