An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Consolidate end-to-end shard orchestration
Danieldcd0331ca4fe
diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.ymlindex c74a9178d3..792afb861f 100644--- a/.github/workflows/cd.yml+++ b/.github/workflows/cd.yml@@ -83,6 +83,8 @@ jobs:runs-on: ${{ matrix.config.os }}name: ${{ matrix.config.name }}needs: [prepare]+ env:+ SIYUAN_E2E_SHARDS: "main:6806 editor:6807 attribute-view:6808"strategy:matrix:config:@@ -219,31 +221,31 @@ jobs:run: pnpm install --frozen-lockfileworking-directory: ${{ github.workspace }}/siyuan-testing+ - name: Validate End-to-End Test Shards+ if: matrix.config.goos == 'darwin' && matrix.config.goarch == 'arm64'+ run: |+ pnpm run typecheck+ pnpm run test:shards+ working-directory: ${{ github.workspace }}/siyuan-testing+- name: Start Kernel for End-to-End Testsif: matrix.config.goos == 'darwin' && matrix.config.goarch == 'arm64'continue-on-error: trueshell: bashrun: |- MAIN_WORKSPACE="${RUNNER_TEMP}/siyuan-e2e-main-workspace"- EDITOR_WORKSPACE="${RUNNER_TEMP}/siyuan-e2e-editor-workspace"- ATTRIBUTE_VIEW_WORKSPACE="${RUNNER_TEMP}/siyuan-e2e-attribute-view-workspace"APP_DIR="${{ github.workspace }}/go/src/github.com/${{ github.repository }}/app"KERNEL_PATH="${APP_DIR}/kernel-darwin-arm64/SiYuan-Kernel"- mkdir -p "${MAIN_WORKSPACE}" "${EDITOR_WORKSPACE}" "${ATTRIBUTE_VIEW_WORKSPACE}"- "${KERNEL_PATH}" --workspace="${MAIN_WORKSPACE}" serve --wd="${APP_DIR}" --port=6806 \- > "${RUNNER_TEMP}/siyuan-e2e-main-kernel-console.log" 2>&1 &- echo "SIYUAN_E2E_MAIN_KERNEL_PID=$!" >> "${GITHUB_ENV}"- "${KERNEL_PATH}" --workspace="${EDITOR_WORKSPACE}" serve --wd="${APP_DIR}" --port=6807 \- > "${RUNNER_TEMP}/siyuan-e2e-editor-kernel-console.log" 2>&1 &- echo "SIYUAN_E2E_EDITOR_KERNEL_PID=$!" >> "${GITHUB_ENV}"- "${KERNEL_PATH}" --workspace="${ATTRIBUTE_VIEW_WORKSPACE}" serve --wd="${APP_DIR}" --port=6808 \- > "${RUNNER_TEMP}/siyuan-e2e-attribute-view-kernel-console.log" 2>&1 &- echo "SIYUAN_E2E_ATTRIBUTE_VIEW_KERNEL_PID=$!" >> "${GITHUB_ENV}"- echo "SIYUAN_E2E_MAIN_WORKSPACE=${MAIN_WORKSPACE}" >> "${GITHUB_ENV}"- echo "SIYUAN_E2E_EDITOR_WORKSPACE=${EDITOR_WORKSPACE}" >> "${GITHUB_ENV}"- echo "SIYUAN_E2E_ATTRIBUTE_VIEW_WORKSPACE=${ATTRIBUTE_VIEW_WORKSPACE}" >> "${GITHUB_ENV}"-- - name: Wait for End-to-End Test Kernel+ for shard_config in ${SIYUAN_E2E_SHARDS}; do+ shard="${shard_config%:*}"+ port="${shard_config#*:}"+ workspace="${RUNNER_TEMP}/siyuan-e2e-${shard}-workspace"+ mkdir -p "${workspace}"+ "${KERNEL_PATH}" --workspace="${workspace}" serve --wd="${APP_DIR}" --port="${port}" \+ > "${RUNNER_TEMP}/siyuan-e2e-${shard}-kernel-console.log" 2>&1 &+ echo "$!" > "${RUNNER_TEMP}/siyuan-e2e-${shard}-kernel.pid"+ done++ - name: Wait for End-to-End Test Kernelsif: matrix.config.goos == 'darwin' && matrix.config.goarch == 'arm64'continue-on-error: trueshell: bash@@ -265,12 +267,13 @@ jobs:cat "${log_path}"return 1}- wait_for_kernel "${SIYUAN_E2E_MAIN_KERNEL_PID}" 6806 \- "${RUNNER_TEMP}/siyuan-e2e-main-kernel-console.log"- wait_for_kernel "${SIYUAN_E2E_EDITOR_KERNEL_PID}" 6807 \- "${RUNNER_TEMP}/siyuan-e2e-editor-kernel-console.log"- wait_for_kernel "${SIYUAN_E2E_ATTRIBUTE_VIEW_KERNEL_PID}" 6808 \- "${RUNNER_TEMP}/siyuan-e2e-attribute-view-kernel-console.log"+ for shard_config in ${SIYUAN_E2E_SHARDS}; do+ shard="${shard_config%:*}"+ port="${shard_config#*:}"+ pid="$(cat "${RUNNER_TEMP}/siyuan-e2e-${shard}-kernel.pid")"+ wait_for_kernel "${pid}" "${port}" \+ "${RUNNER_TEMP}/siyuan-e2e-${shard}-kernel-console.log"+ done- name: Run End-to-End Testsif: matrix.config.goos == 'darwin' && matrix.config.goarch == 'arm64'@@ -278,52 +281,39 @@ jobs:timeout-minutes: 30shell: bashrun: |- pnpm run typecheck+ TEST_PIDS=()+ TEST_SHARDS=()+ for shard_config in ${SIYUAN_E2E_SHARDS}; do+ shard="${shard_config%:*}"+ port="${shard_config#*:}"+ workspace="${RUNNER_TEMP}/siyuan-e2e-${shard}-workspace"+ (+ SIYUAN_BASE_URL="http://127.0.0.1:${port}" \+ SIYUAN_EXPECT_WORKSPACE="${workspace}" \+ SIYUAN_E2E_SHARD="${shard}" \+ SIYUAN_TEST_RESULTS_DIR="test-results-${shard}" \+ PLAYWRIGHT_HTML_OUTPUT_DIR="playwright-report-${shard}" \+ pnpm exec playwright test --config=playwright.focused.config.ts \+ --reporter=line,html --output="test-results-${shard}"+ ) &+ TEST_PIDS+=("$!")+ TEST_SHARDS+=("${shard}")+ done+ TEST_STATUS=0set +e- (- SIYUAN_BASE_URL="http://127.0.0.1:6806" \- SIYUAN_EXPECT_WORKSPACE="${SIYUAN_E2E_MAIN_WORKSPACE}" \- SIYUAN_E2E_SHARD="main" \- SIYUAN_TEST_RESULTS_DIR="test-results-main" \- PLAYWRIGHT_HTML_OUTPUT_DIR="playwright-report-main" \- pnpm exec playwright test --config=playwright.focused.config.ts \- --reporter=line,html --output=test-results-main- ) &- MAIN_TEST_PID=$!- (- SIYUAN_BASE_URL="http://127.0.0.1:6807" \- SIYUAN_EXPECT_WORKSPACE="${SIYUAN_E2E_EDITOR_WORKSPACE}" \- SIYUAN_E2E_SHARD="editor" \- SIYUAN_TEST_RESULTS_DIR="test-results-editor" \- PLAYWRIGHT_HTML_OUTPUT_DIR="playwright-report-editor" \- pnpm exec playwright test --config=playwright.focused.config.ts \- --reporter=line,html --output=test-results-editor- ) &- EDITOR_TEST_PID=$!- (- SIYUAN_BASE_URL="http://127.0.0.1:6808" \- SIYUAN_EXPECT_WORKSPACE="${SIYUAN_E2E_ATTRIBUTE_VIEW_WORKSPACE}" \- SIYUAN_E2E_SHARD="attribute-view" \- SIYUAN_TEST_RESULTS_DIR="test-results-attribute-view" \- PLAYWRIGHT_HTML_OUTPUT_DIR="playwright-report-attribute-view" \- pnpm exec playwright test --config=playwright.focused.config.ts \- --reporter=line,html --output=test-results-attribute-view- ) &- ATTRIBUTE_VIEW_TEST_PID=$!- wait "${MAIN_TEST_PID}"- MAIN_TEST_STATUS=$?- wait "${EDITOR_TEST_PID}"- EDITOR_TEST_STATUS=$?- wait "${ATTRIBUTE_VIEW_TEST_PID}"- ATTRIBUTE_VIEW_TEST_STATUS=$?+ for index in "${!TEST_PIDS[@]}"; do+ wait "${TEST_PIDS[${index}]}"+ shard_status=$?+ if [ "${shard_status}" -ne 0 ]; then+ echo "::error title=End-to-End shard failed::${TEST_SHARDS[${index}]} exited with ${shard_status}"+ TEST_STATUS=1+ fi+ doneset -e- if [ "${MAIN_TEST_STATUS}" -ne 0 ] || [ "${EDITOR_TEST_STATUS}" -ne 0 ] || \- [ "${ATTRIBUTE_VIEW_TEST_STATUS}" -ne 0 ]; then- exit 1- fi+ exit "${TEST_STATUS}"working-directory: ${{ github.workspace }}/siyuan-testing- - name: Stop End-to-End Test Kernel+ - name: Stop End-to-End Test Kernelsif: always() && matrix.config.goos == 'darwin' && matrix.config.goarch == 'arm64'continue-on-error: trueshell: bash@@ -342,9 +332,13 @@ jobs:donekill -KILL "${pid}"}- stop_kernel "${SIYUAN_E2E_MAIN_KERNEL_PID:-}"- stop_kernel "${SIYUAN_E2E_EDITOR_KERNEL_PID:-}"- stop_kernel "${SIYUAN_E2E_ATTRIBUTE_VIEW_KERNEL_PID:-}"+ for shard_config in ${SIYUAN_E2E_SHARDS}; do+ shard="${shard_config%:*}"+ pid_path="${RUNNER_TEMP}/siyuan-e2e-${shard}-kernel.pid"+ if [ -f "${pid_path}" ]; then+ stop_kernel "$(cat "${pid_path}")"+ fi+ done- name: Upload End-to-End Test Resultsif: always() && matrix.config.goos == 'darwin' && matrix.config.goarch == 'arm64'@@ -353,18 +347,10 @@ jobs:with:name: siyuan-e2e-macos-arm64path: |- ${{ github.workspace }}/siyuan-testing/playwright-report-main- ${{ github.workspace }}/siyuan-testing/playwright-report-editor- ${{ github.workspace }}/siyuan-testing/playwright-report-attribute-view- ${{ github.workspace }}/siyuan-testing/test-results-main- ${{ github.workspace }}/siyuan-testing/test-results-editor- ${{ github.workspace }}/siyuan-testing/test-results-attribute-view- ${{ runner.temp }}/siyuan-e2e-main-kernel-console.log- ${{ runner.temp }}/siyuan-e2e-editor-kernel-console.log- ${{ runner.temp }}/siyuan-e2e-attribute-view-kernel-console.log- ${{ runner.temp }}/siyuan-e2e-main-workspace/temp/siyuan.log- ${{ runner.temp }}/siyuan-e2e-editor-workspace/temp/siyuan.log- ${{ runner.temp }}/siyuan-e2e-attribute-view-workspace/temp/siyuan.log+ ${{ github.workspace }}/siyuan-testing/playwright-report-*+ ${{ github.workspace }}/siyuan-testing/test-results-*+ ${{ runner.temp }}/siyuan-e2e-*-kernel-console.log+ ${{ runner.temp }}/siyuan-e2e-*-workspace/temp/siyuan.logif-no-files-found: ignoreretention-days: 14