An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:zap: Parallelize release checks and align Go cache paths
Danield8c4f28f6055
diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.ymlindex 80de4c5561..5e05f9e835 100644--- a/.github/workflows/cd.yml+++ b/.github/workflows/cd.yml@@ -156,7 +156,7 @@ jobs:run: node scripts/report-workflow-outcomes.mjscontracts:- name: API contracts and kernel tests+ name: API contracts and typesneeds: prepareruns-on: ubuntu-24.04permissions:@@ -189,6 +189,23 @@ jobs:- name: Check application and strict contract typesrun: pnpm run typecheckworking-directory: app++ kernel-tests-linux:+ name: Linux kernel tests+ # 完整内核检查与构建并行,发布汇总仍等待检查及其硬失败结果。+ needs: prepare+ runs-on: ubuntu-24.04+ permissions:+ contents: read+ steps:+ - uses: actions/checkout@v6+ - uses: actions/setup-go@v6+ with:+ go-version-file: kernel/go.mod+ cache-dependency-path: kernel/go.sum+ - uses: actions/setup-node@v6+ with:+ node-version: 24- name: Install filesystem fault injection dependencyrun: |sudo apt-get update@@ -220,8 +237,9 @@ jobs:WORKFLOW_STEPS: ${{ toJSON(steps) }}run: node scripts/report-workflow-outcomes.mjs- frontend-tests:- name: Frontend, Electron and packaging tests+ kernel-tests-windows:+ name: Windows kernel tests+ # 独立运行内核检查,前端测试不再等待其完成。needs: prepareruns-on: windows-latesttimeout-minutes: 30@@ -229,6 +247,9 @@ jobs:contents: readsteps:- uses: actions/checkout@v6+ - uses: actions/setup-node@v6+ with:+ node-version: 24- uses: actions/setup-go@v6with:go-version-file: kernel/go.mod@@ -249,6 +270,22 @@ jobs:env:CGO_ENABLED: 1CC: gcc++ - name: Report non-blocking step outcomes+ if: always()+ env:+ WORKFLOW_STEPS: ${{ toJSON(steps) }}+ run: node scripts/report-workflow-outcomes.mjs++ frontend-tests:+ name: Frontend, Electron and packaging tests+ needs: prepare+ runs-on: windows-latest+ timeout-minutes: 30+ permissions:+ contents: read+ steps:+ - uses: actions/checkout@v6- uses: actions/setup-node@v6with:node-version: 24@@ -525,6 +562,8 @@ jobs:build_android:runs-on: ubuntu-24.04name: ubuntu build android.apk+ env:+ GOPATH: ${{ github.workspace }}/go# Android 与桌面构建并行,前端检查由发布汇总等待。needs: [prepare, languages, contracts]steps:@@ -608,14 +647,11 @@ jobs:go install golang.org/x/mobile/cmd/gomobile@2553ed8ce294echo "$GOPATH/bin" >> $GITHUB_PATH"$GOPATH/bin/gomobile" init- env:- GOPATH: ${{ github.workspace }}/go- name: Building Android Kernelrun: gomobile bind -tags "fts5 sqlcipher" -ldflags "-s -w" -v -o kernel.aar -target android/arm64 -androidapi 26 ./mobile/working-directory: ${{ github.workspace }}/go/src/github.com/${{ github.repository }}/kernelenv:- GOPATH: ${{ github.workspace }}/goCGO_ENABLED: 1JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8@@ -692,11 +728,12 @@ jobs:create_release:name: Create Releaseruns-on: ubuntu-24.04- needs: [prepare, frontend-tests, build, build_macos_arm64, build_android, editor_e2e]- # 等待前端检查和两组编辑器测试结束;前端测试的软失败不阻塞发布。- # 前端检查的硬失败、构建失败或取消仍会阻止发布,编辑器测试失败只记录结果。+ needs: [prepare, kernel-tests-linux, kernel-tests-windows, frontend-tests, build, build_macos_arm64, build_android, editor_e2e]+ # 等待全部内核、前端检查和两组编辑器测试结束;测试步骤的软失败不阻塞发布。+ # 检查的硬失败、构建失败或取消仍会阻止发布,编辑器测试失败只记录结果。if: >-${{ always() && !cancelled() && needs.prepare.result == 'success' &&+ needs.kernel-tests-linux.result == 'success' && needs.kernel-tests-windows.result == 'success' &&needs.frontend-tests.result == 'success' &&needs.build.result == 'success' && needs.build_macos_arm64.result == 'success' &&needs.build_android.result == 'success' && needs.editor_e2e.result != 'cancelled' }}diff --git a/.github/workflows/desktop-build.yml b/.github/workflows/desktop-build.ymlindex 990529cfb1..6e7ecc3255 100644--- a/.github/workflows/desktop-build.yml+++ b/.github/workflows/desktop-build.yml@@ -18,6 +18,8 @@ jobs:runs-on: ${{ fromJSON(inputs.config).os }}name: ${{ fromJSON(inputs.config).name }}env:+ # 缓存恢复、保存与编译共用模块目录。+ GOPATH: ${{ github.workspace }}/goSIYUAN_E2E_SHARDS: ${{ fromJSON(inputs.config).e2e_shards }}steps:- uses: actions/checkout@v6@@ -47,7 +49,6 @@ jobs:GO111MODULE: onCGO_ENABLED: 1GOOS: ${{ fromJSON(inputs.config).goos }}- GOPATH: ${{ github.workspace }}/goGOARCH: ${{ fromJSON(inputs.config).goarch }}- name: Set up Node@@ -104,7 +105,6 @@ jobs:GO111MODULE: onCGO_ENABLED: 1GOOS: ${{ fromJSON(inputs.config).goos }}- GOPATH: ${{ github.workspace }}/goGOARCH: ${{ fromJSON(inputs.config).goarch }}- name: Snapshot raw ARM editor runtimediff --git a/scripts/test_editor_e2e_workflow.py b/scripts/test_editor_e2e_workflow.pyindex 2c8589a8ad..ba305b6d7f 100644--- a/scripts/test_editor_e2e_workflow.py+++ b/scripts/test_editor_e2e_workflow.py@@ -17,7 +17,7 @@ DESKTOP = (ROOT / ".github/workflows/desktop-build.yml").read_text(encoding="utfdef job(name):- return re.search(rf"^ {name}:\n(.*?)(?=^ \w+:\n|\Z)", CD, re.M | re.S).group(1)+ return re.search(rf"^ {name}:\n(.*?)(?=^ [\w-]+:\n|\Z)", CD, re.M | re.S).group(1)def snapshot_command():@@ -28,13 +28,13 @@ def snapshot_command():class EditorWorkflowTests(unittest.TestCase):def test_windows_kernel_tests_cover_all_packages_with_cgo(self):- frontend = job("frontend-tests")- compiler = frontend.split("- name: Set up Windows kernel test compiler\n", 1)[1].split(" - ", 1)[0]+ kernel = job("kernel-tests-windows")+ compiler = kernel.split("- name: Set up Windows kernel test compiler\n", 1)[1].split(" - ", 1)[0]self.assertIn("uses: msys2/setup-msys2@v2", compiler)self.assertIn("msystem: UCRT64", compiler)self.assertIn("path-type: inherit", compiler)self.assertIn("mingw-w64-ucrt-x86_64-gcc", compiler)- step = frontend.split("- name: Test all Windows kernel packages\n", 1)[1].split(" - ", 1)[0]+ step = kernel.split("- name: Test all Windows kernel packages\n", 1)[1].split(" - ", 1)[0]self.assertIn('run: go test -tags "fts5 sqlcipher" ./... -count=1', step)self.assertIn("shell: msys2 {0}", step)self.assertIn("CGO_ENABLED: 1", step)@@ -74,22 +74,72 @@ class EditorWorkflowTests(unittest.TestCase):self.assertNotIn("continue-on-error", ocr)self.assertIn('run: python -m unittest discover -s scripts -p "test_*ocr*.py"', ocr)- def test_release_waits_for_frontend_and_editor_with_existing_failure_rules(self):+ def test_release_waits_for_all_checks_with_existing_failure_rules(self):release = job("create_release")- self.assertIn("needs: [prepare, frontend-tests, build, build_macos_arm64, build_android, editor_e2e]", release)+ self.assertIn("needs: [prepare, kernel-tests-linux, kernel-tests-windows, frontend-tests, build, build_macos_arm64, build_android, editor_e2e]", release)expression = re.search(r"if: >-\s*\$\{\{(.*?)\}\}", release, re.S).group(1)expression = expression.replace("always()", "True").replace("!cancelled()", "not cancelled")expression = expression.replace("&&", " and ")expression = re.sub(r"needs\.([\w-]+)\.result", r'results["\1"]', expression)expression = " ".join(expression.split())+ expression = compile(expression, "release condition", "eval")states = ["success", "failure", "skipped", "cancelled"]- for values in itertools.product(states, repeat=6):- results = dict(zip(["prepare", "frontend-tests", "build", "build_macos_arm64", "build_android", "editor_e2e"], values))+ for values in itertools.product(states, repeat=8):+ results = dict(zip(["prepare", "kernel-tests-linux", "kernel-tests-windows", "frontend-tests", "build", "build_macos_arm64", "build_android", "editor_e2e"], values))for cancelled in [False, True]:- expected = not cancelled and all(value == "success" for value in values[:5]) and values[5] != "cancelled"+ expected = not cancelled and all(value == "success" for value in values[:7]) and values[7] != "cancelled"actual = eval(expression, {"__builtins__": {}}, {"results": results, "cancelled": cancelled})self.assertEqual(actual, expected, (results, cancelled))+ def test_kernel_checks_are_independent_and_keep_native_prerequisites(self):+ contracts = job("contracts")+ frontend = job("frontend-tests")+ self.assertNotIn("Test all kernel packages", contracts)+ self.assertNotIn("Test all Windows kernel packages", frontend)+ for name in ["kernel-tests-linux", "kernel-tests-windows", "frontend-tests"]:+ check = job(name)+ self.assertRegex(check, r"(?m)^ needs: prepare$")+ self.assertIn("contents: read", check)+ self.assertIn("uses: actions/checkout@v6", check)+ self.assertIn("uses: actions/setup-node@v6", check)+ self.assertNotRegex(check, r"(?m)^ continue-on-error:")+ for name in ["kernel-tests-linux", "kernel-tests-windows"]:+ check = job(name)+ self.assertIn("uses: actions/setup-go@v6", check)+ self.assertIn("go-version-file: kernel/go.mod", check)+ self.assertIn("cache-dependency-path: kernel/go.sum", check)+ linux = job("kernel-tests-linux")+ self.assertIn("runs-on: ubuntu-24.04", linux)+ self.assertIn("sudo apt-get install -y strace", linux)+ self.assertIn("python3 scripts/prepare-ocr.py --runtime linux-amd64 --build-worker", linux)+ full = linux.split("- name: Test all kernel packages\n", 1)[1].split(" - ", 1)[0]+ self.assertIn('run: go test -tags "fts5 sqlcipher" ./... -count=1', full)+ self.assertIn("continue-on-error: true", full)+ self.assertIn("SIYUAN_OCR_TEST_ASSETS: ${{ github.workspace }}/app/stage/ocr/models", full)+ self.assertIn("SIYUAN_OCR_TEST_LIBRARY: ${{ github.workspace }}/app/stage/ocr/runtime/linux-amd64/libonnxruntime.so", full)+ paths = linux.split("- name: Test path fixtures with custom temporary directories\n", 1)[1].split(" - ", 1)[0]+ self.assertIn("continue-on-error: true", paths)+ self.assertIn(+ 'run: go test -tags "fts5 sqlcipher" ./internal/testutil ./util ./model ./server '+ "-run 'Test(PublicDataDir|IsSensitivePath|.*Obsidian|RegisterStaticFileHandlers|StaticFile|WidgetResponseCacheControl|"+ "TemplatesAndExportRequireAdministrator|SnippetPublishAccess|PluginPublish|PublishFile)' -count=1", paths)+ self.assertIn("TMPDIR: /tmp", paths)+ self.assertIn("GOTMPDIR: ${{ runner.temp }}", paths)+ for hard_step in ["Install filesystem fault injection dependency", "Prepare native OCR verification resources"]:+ step = linux.split(f"- name: {hard_step}\n", 1)[1].split(" - ", 1)[0]+ self.assertNotIn("continue-on-error:", step)++ def test_go_cache_and_builds_share_job_level_module_directory(self):+ for build in [DESKTOP.split("jobs:\n build:\n", 1)[1], job("build_android")]:+ header, steps = build.split(" steps:\n", 1)+ self.assertIn(" GOPATH: ${{ github.workspace }}/go", header)+ self.assertNotIn("GOPATH:", steps)+ setup = steps.split("uses: actions/setup-go@v6", 1)[1].split(" - ", 1)[0]+ self.assertIn("cache: true", setup)+ self.assertIn("cache-dependency-path:", setup)+ self.assertIn('"$GOPATH/bin/gomobile" init', job("build_android"))+ self.assertIn("${{ github.workspace }}\\go\\${{ fromJSON(inputs.config).gobin }}\\goversioninfo", DESKTOP)+def test_independent_editor_runners_and_serial_workers(self):editor = job("editor_e2e")self.assertIn("needs: [prepare, build_macos_arm64]", editor)