diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 04e8a72ef4..c459e87bb5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,7 +32,7 @@ jobs: runs-on: ubuntu-latest name: Test Packages env: - PACKAGES: '@lobechat/file-loaders @lobechat/prompts @lobechat/model-runtime @lobechat/web-crawler @lobechat/electron-server-ipc @lobechat/utils @lobechat/python-interpreter @lobechat/context-engine @lobechat/agent-runtime @lobechat/conversation-flow @lobechat/ssrf-safe-fetch @lobechat/memory-user-memory @lobechat/types @lobechat/trpc @lobechat/app-config @lobechat/locales @lobechat/env @lobechat/builtin-tool-lobe-agent model-bank @lobechat/agent-gateway-client @lobechat/agent-manager-runtime @lobechat/device-gateway-client @lobechat/device-identity @lobechat/eval-dataset-parser @lobechat/eval-rubric @lobechat/fetch-sse @lobechat/heterogeneous-agents' + PACKAGES: '@lobechat/file-loaders @lobechat/prompts @lobechat/model-runtime @lobechat/web-crawler @lobechat/electron-server-ipc @lobechat/utils @lobechat/context-engine @lobechat/agent-runtime @lobechat/conversation-flow @lobechat/ssrf-safe-fetch @lobechat/memory-user-memory @lobechat/types @lobechat/trpc @lobechat/app-config @lobechat/locales @lobechat/env @lobechat/builtin-tool-lobe-agent model-bank @lobechat/agent-gateway-client @lobechat/agent-manager-runtime @lobechat/device-gateway-client @lobechat/device-identity @lobechat/eval-dataset-parser @lobechat/eval-rubric @lobechat/fetch-sse @lobechat/heterogeneous-agents' steps: - name: Checkout @@ -90,11 +90,23 @@ jobs: for package in $PACKAGES; do dir="${package#@lobechat/}" if [ -f "./packages/$dir/coverage/lcov.info" ]; then - echo "Uploading coverage for $dir..." + flag="packages/$dir" + + case "$dir" in + builtin-tool-*) + flag="builtin-tools" + ;; + locales|env|device-gateway-client) + echo "Skipping Codecov upload for $dir." + continue + ;; + esac + + echo "Uploading coverage for $dir as $flag..." ./codecov upload-coverage \ $COMMON_ARGS \ --file ./packages/$dir/coverage/lcov.info \ - --flag packages/$dir \ + --flag "$flag" \ --disable-search fi done @@ -105,8 +117,8 @@ jobs: if: needs.check-duplicate-run.outputs.should_skip != 'true' strategy: matrix: - shard: [1, 2, 3] - name: Test App (shard ${{ matrix.shard }}/3) + shard: [1, 2] + name: Test App (shard ${{ matrix.shard }}/2) runs-on: ubuntu-latest steps: - name: Checkout @@ -126,7 +138,7 @@ jobs: run: pnpm install - name: Run tests - run: bunx vitest --coverage --silent='passed-only' --reporter=default --reporter=blob --shard=${{ matrix.shard }}/3 + run: bunx vitest --coverage --silent='passed-only' --reporter=default --reporter=blob --shard=${{ matrix.shard }}/2 --exclude '**/apps/server/**' - name: Upload blob report if: ${{ !cancelled() }} @@ -219,6 +231,40 @@ jobs: files: ./apps/desktop/coverage/lcov.info flags: desktop + test-server: + needs: check-duplicate-run + if: needs.check-duplicate-run.outputs.should_skip != 'true' + name: Test Server + + runs-on: ubuntu-latest + + steps: + - name: Checkout + env: + REF_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} + REPOSITORY: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name || github.repository }} + run: | + git init . + git remote add origin "https://github.com/${REPOSITORY}.git" + git fetch --no-tags --depth=1 origin "${REF_SHA}" + git checkout --force FETCH_HEAD + + - name: Setup environment + uses: ./.github/actions/setup-env + + - name: Install deps + run: pnpm install + + - name: Test Server Coverage + run: bunx vitest --coverage --silent='passed-only' --reporter=default --coverage.reportsDirectory=./apps/server/coverage --dir apps/server + + - name: Upload Server coverage to Codecov + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./apps/server/coverage/lcov.info + flags: server + test-databsae: needs: check-duplicate-run if: needs.check-duplicate-run.outputs.should_skip != 'true' diff --git a/codecov.yml b/codecov.yml index ab33198fc2..5252cbc41b 100644 --- a/codecov.yml +++ b/codecov.yml @@ -1,5 +1,20 @@ component_management: individual_components: + # Top-level packages + - component_id: server + name: 'Server' + paths: + - apps/server/** + - component_id: database + name: 'Database' + paths: + - packages/database/** + - component_id: builtin_tools + name: 'Builtin Tools' + paths: + - packages/builtin-tool-*/** + - packages/builtin-tools/** + # App architecture layers - component_id: app_store name: 'Store' @@ -9,10 +24,6 @@ component_management: name: 'Services' paths: - src/services/** - - component_id: app_server - name: 'Server' - paths: - - src/server/** - component_id: app_libs name: 'Libs' paths: @@ -26,14 +37,27 @@ coverage: status: project: default: off + server: + flags: + - server database: flags: - database + builtin-tools: + flags: + - builtin-tools app: flags: - app threshold: '0.5%' patch: off +ignore: + - src/app/**/*.tsx + - packages/python-interpreter/** + - packages/locales/** + - packages/env/** + - packages/device-gateway-client/** + comment: layout: 'header, diff, flags, components' # show component info in the PR comment