-
Notifications
You must be signed in to change notification settings - Fork 7
152 lines (144 loc) · 4.99 KB
/
Copy pathprc.yml
File metadata and controls
152 lines (144 loc) · 4.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
name: Pull Request Check
on:
pull_request:
push:
workflow_dispatch:
permissions:
contents: read
jobs:
discover-go-modules:
name: discover go modules
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- id: set-matrix
shell: bash
run: |
set -euo pipefail
mapfile -t modules < <(find . -name go.mod | sort | while IFS= read -r mod; do
if head -n 5 "${mod}" | grep -q "DO NOT USE!"; then
continue
fi
echo "${mod}"
done)
if [ "${#modules[@]}" -eq 0 ]; then
echo "matrix={\"module\":[]}" >> "$GITHUB_OUTPUT"
exit 0
fi
matrix=$(printf '%s\n' "${modules[@]}" | sed 's|^\./||' | jq -R -s -c 'split("\n") | map(select(length>0))')
echo "matrix={\"module\":${matrix}}" >> "$GITHUB_OUTPUT"
test-go-modules:
name: go test (${{ matrix.module }})
runs-on: ubuntu-latest
needs: discover-go-modules
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.discover-go-modules.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.24.9"
- name: Test module
shell: bash
run: bash .github/scripts/run-go-tests.sh --module "${{ matrix.module }}"
test-longmemeval-standalone:
name: test LongMemEval standalone
runs-on: ubuntu-latest
env:
CGO_CFLAGS: -DSQLITE_INNOCUOUS=0x000200000
CGO_ENABLED: "1"
GOFLAGS: -mod=readonly
GOWORK: "off"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.24.9"
- name: Verify trpc-agent-go dependency pins
working-directory: memory/trpc-agent-go-impl
shell: bash
run: |
set -euo pipefail
python3 - <<'PY'
import json
import subprocess
source_root = "trpc.group/trpc-go/trpc-agent-go"
expected_remote_root = "github.com/print-happy/trpc-agent-go"
expected_version = "v0.0.0-20260716032212-1b3adb2f4bb8"
allowed_remote_roots = {
expected_remote_root,
}
module = json.loads(
subprocess.check_output(["go", "mod", "edit", "-json"])
)
pins = [
replacement
for replacement in module.get("Replace", [])
if replacement["Old"]["Path"] == source_root
or replacement["Old"]["Path"].startswith(source_root + "/")
]
if not pins:
raise SystemExit("no trpc-agent-go dependency pins found")
pinned_roots = set()
for pin in pins:
path = pin["New"].get("Path", "")
version = pin["New"].get("Version", "")
root = next((
candidate
for candidate in allowed_remote_roots
if path == candidate or path.startswith(candidate + "/")
), None)
if root is None:
raise SystemExit(f"non-remote trpc-agent-go replacement: {path}")
pinned_roots.add(root)
if not version:
raise SystemExit(f"unpinned trpc-agent-go replacement: {path}")
if len(pinned_roots) != 1:
raise SystemExit(
"trpc-agent-go replacements use different repositories: "
+ ", ".join(sorted(pinned_roots))
)
versions = {pin["New"]["Version"] for pin in pins}
if len(versions) != 1:
raise SystemExit(
"trpc-agent-go replacements use different versions: "
+ ", ".join(sorted(versions))
)
version = versions.pop()
if pinned_roots != {expected_remote_root} or version != expected_version:
raise SystemExit(
"unexpected trpc-agent-go dependency pin: "
+ ", ".join(sorted(pinned_roots))
+ "@"
+ version
)
print("trpc-agent-go dependency pin:", version)
PY
- name: Verify module dependencies
working-directory: memory/trpc-agent-go-impl
run: go mod verify
- name: Test standalone module
working-directory: memory/trpc-agent-go-impl
run: go test ./...
check-go-mod-tidy:
name: check go mod tidy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.24.9"
- name: Check go.mod and go.sum are tidy
shell: bash
run: bash .github/scripts/check-go-mod-tidy.sh
check-lfs-excluded:
name: check git lfs excluded
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Validate Git LFS files are excluded from published modules
shell: bash
run: bash .github/scripts/check-lfs-excluded.sh