Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:construction_worker: Run all Windows kernel tests with cgo https://github.com/siyuan-note/siyuan/issues/20380

Daniel75b423209207
diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml
index 24b5a91ffc..7a602f91ef 100644
--- a/.github/workflows/cd.yml
+++ b/.github/workflows/cd.yml
@@ -233,12 +233,22 @@ jobs:
with:
go-version-file: kernel/go.mod
cache-dependency-path: kernel/go.sum
- - name: Test Windows process helpers
- id: test_windows_process_helpers
+ - name: Set up Windows kernel test compiler
+ uses: msys2/setup-msys2@v2
+ with:
+ msystem: UCRT64
+ path-type: inherit
+ install: mingw-w64-ucrt-x86_64-gcc
+ - name: Test all Windows kernel packages
+ id: test_windows_kernel_packages
# 测试失败只记录结果,不阻塞后续发布构建。
continue-on-error: true
- run: go test ./internal/elevator -count=1
+ shell: msys2 {0}
+ run: go test -tags "fts5 sqlcipher" ./... -count=1
working-directory: kernel
+ env:
+ CGO_ENABLED: 1
+ CC: gcc
- uses: actions/setup-node@v6
with:
node-version: 24
diff --git a/kernel/model/history_search_injection_test.go b/kernel/model/history_search_injection_test.go
index e9b949ede5..ec5b51a402 100644
--- a/kernel/model/history_search_injection_test.go
+++ b/kernel/model/history_search_injection_test.go
@@ -2,6 +2,7 @@ package model
import (
"os"
+ "os/exec"
"path/filepath"
"strconv"
"testing"
@@ -15,6 +16,15 @@ import (
// TestHistorySearchInjection 覆盖历史搜索的注入回归
// https://github.com/siyuan-note/siyuan/security/advisories/GHSA-4hjx-84f6-gr7c
func TestHistorySearchInjection(t *testing.T) {
+ const childEnv = "SIYUAN_TEST_HISTORY_SEARCH_INJECTION"
+ if os.Getenv(childEnv) != "1" {
+ cmd := exec.Command(os.Args[0], "-test.run=^TestHistorySearchInjection$", "-test.timeout=30s")
+ cmd.Env = append(os.Environ(), childEnv+"=1")
+ if output, err := cmd.CombinedOutput(); err != nil {
+ t.Fatalf("history search regression failed: %v\n%s", err, output)
+ }
+ return
+ }
root := t.TempDir()
util.WorkspaceDir = root
util.DataDir = filepath.Join(root, "data")
diff --git a/scripts/test_editor_e2e_workflow.py b/scripts/test_editor_e2e_workflow.py
index 538779af53..2c8589a8ad 100644
--- a/scripts/test_editor_e2e_workflow.py
+++ b/scripts/test_editor_e2e_workflow.py
@@ -27,6 +27,21 @@ 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]
+ 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]
+ self.assertIn('run: go test -tags "fts5 sqlcipher" ./... -count=1', step)
+ self.assertIn("shell: msys2 {0}", step)
+ self.assertIn("CGO_ENABLED: 1", step)
+ self.assertIn("CC: gcc", step)
+ self.assertIn("working-directory: kernel", step)
+ self.assertIn("continue-on-error: true", step)
+
def test_nonblocking_steps_have_ids_and_always_report_outcomes(self):
for workflow in [CD, DESKTOP]:
sections = re.split(r"^ [\w-]+:\n", workflow, flags=re.M)