Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

👷 ci: group internal package tests to reduce job count (#11275)

YuTengjing480cbe9103fe
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 1417d78bddd..d46aae876f6 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -6,6 +6,10 @@ permissions:
actions: write
contents: read
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
jobs:
# Check for duplicate runs
pre_job:
@@ -16,69 +20,18 @@ jobs:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
- concurrent_skipping: 'same_content_newer'
- skip_after_successful_duplicate: 'true'
+ concurrent_skipping: "same_content_newer"
+ skip_after_successful_duplicate: "true"
do_not_skip: '["workflow_dispatch", "schedule"]'
- # Package tests - using each package's own test script
- test-intenral-packages:
- needs: pre_job
- if: needs.pre_job.outputs.should_skip != 'true'
- runs-on: ubuntu-latest
- strategy:
- matrix:
- package:
- - file-loaders
- - prompts
- - model-runtime
- - web-crawler
- - electron-server-ipc
- - utils
- - python-interpreter
- - context-engine
- - agent-runtime
- - conversation-flow
- - ssrf-safe-fetch
- - memory-user-memory
-
- name: Test package ${{ matrix.package }}
-
- steps:
- - uses: actions/checkout@v6
-
- - name: Setup Node.js
- uses: actions/setup-node@v6
- with:
- node-version: 24.11.1
- package-manager-cache: false
-
- - name: Install bun
- uses: oven-sh/setup-bun@v2
- with:
- bun-version: ${{ secrets.BUN_VERSION }}
-
- - name: Install deps
- run: bun i
-
- - name: Test ${{ matrix.package }} package with coverage
- run: bun run --filter @lobechat/${{ matrix.package }} test:coverage
-
- - name: Upload ${{ matrix.package }} coverage to Codecov
- uses: codecov/codecov-action@v5
- with:
- token: ${{ secrets.CODECOV_TOKEN }}
- files: ./packages/${{ matrix.package }}/coverage/lcov.info
- flags: packages/${{ matrix.package }}
-
+ # Package tests - all packages in single job to save runner resources
test-packages:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
- strategy:
- matrix:
- package: [model-bank]
-
- name: Test package ${{ matrix.package }}
+ 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 model-bank"
steps:
- uses: actions/checkout@v6
@@ -92,20 +45,32 @@ jobs:
- name: Install bun
uses: oven-sh/setup-bun@v2
with:
- bun-version: latest
+ bun-version: ${{ secrets.BUN_VERSION }}
- name: Install deps
run: bun i
- - name: Test ${{ matrix.package }} package with coverage
- run: bun run --filter ${{ matrix.package }} test:coverage
-
- - name: Upload ${{ matrix.package }} coverage to Codecov
- uses: codecov/codecov-action@v5
- with:
- token: ${{ secrets.CODECOV_TOKEN }}
- files: ./packages/${{ matrix.package }}/coverage/lcov.info
- flags: packages/${{ matrix.package }}
+ - name: Test packages with coverage
+ run: |
+ for package in $PACKAGES; do
+ echo "::group::Testing $package"
+ bun run --filter $package test:coverage
+ echo "::endgroup::"
+ done
+
+ - name: Upload coverage to Codecov
+ if: always()
+ run: |
+ for package in $PACKAGES; do
+ # Extract directory name: @lobechat/file-loaders -> file-loaders, model-bank -> model-bank
+ dir="${package#@lobechat/}"
+ if [ -f "./packages/$dir/coverage/lcov.info" ]; then
+ echo "Uploading coverage for $package..."
+ npx codecov --token=${{ secrets.CODECOV_TOKEN }} \
+ --file=./packages/$dir/coverage/lcov.info \
+ --flags=packages/$dir
+ fi
+ done
# App tests
test-website:
@@ -199,7 +164,6 @@ jobs:
options: >-
--health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
-
ports:
- 5432:5432