-
-
Notifications
You must be signed in to change notification settings - Fork 9
147 lines (123 loc) 路 4.68 KB
/
Copy pathci.yml
File metadata and controls
147 lines (123 loc) 路 4.68 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
name: CI
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
jobs:
deps:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup Go
uses: actions/setup-go@v7
with:
go-version-file: go.mod
cache: true
- name: Verify module cache
run: GOWORK=off go mod verify
- name: Check go.mod tidy
run: |
GOWORK=off go mod tidy
git diff --exit-code -- go.mod go.sum
- name: Install govulncheck
run: GOWORK=off go install golang.org/x/vuln/cmd/govulncheck@v1.7.0
- name: Run govulncheck
run: GOWORK=off "$(go env GOPATH)/bin/govulncheck" ./...
lint:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup Go
uses: actions/setup-go@v7
with:
go-version-file: go.mod
cache: true
- name: Check formatting
run: |
changed="$(gofmt -l .)"
if [ -n "$changed" ]; then
printf 'gofmt wants changes in:\n%s\n' "$changed"
exit 1
fi
- name: Vet
run: GOWORK=off go vet ./...
- name: Install deadcode
run: GOWORK=off go install golang.org/x/tools/cmd/deadcode@v0.49.0
- name: Deadcode
run: |
output_file=$(mktemp)
GOWORK=off "$(go env GOPATH)/bin/deadcode" -test ./... > "$output_file"
if [ -s "$output_file" ]; then
cat "$output_file"
exit 1
fi
test:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup Go
uses: actions/setup-go@v7
with:
go-version-file: go.mod
cache: true
- name: Test
run: GOWORK=off go test -count=1 ./...
- name: Build CLI
run: |
GOWORK=off go build -trimpath \
-ldflags "-s -w -X github.com/openclaw/graincrawl/internal/buildinfo.Version=ci -X github.com/openclaw/graincrawl/internal/buildinfo.Commit=${GITHUB_SHA} -X github.com/openclaw/graincrawl/internal/buildinfo.Date=ci" \
-o bin/graincrawl ./cmd/graincrawl
- name: Smoke test CLI control surface
run: |
set -euo pipefail
output="$(./bin/graincrawl --help 2>&1)"
printf '%s\n' "$output"
printf '%s' "$output" | grep -q "graincrawl archives Granola"
printf '%s' "$output" | grep -q "metadata"
printf '%s' "$output" | grep -q "tui"
version_output="$(./bin/graincrawl --json version)"
printf '%s\n' "$version_output"
printf '%s\n' "$version_output" | grep -q '"version"'
tmp="$RUNNER_TEMP/graincrawl-smoke"
cfg="$tmp/config.toml"
db="$tmp/graincrawl.db"
mkdir -p "$tmp/home" "$tmp/xdg-config" "$tmp/xdg-cache" "$tmp/xdg-state"
env HOME="$tmp/home" XDG_CONFIG_HOME="$tmp/xdg-config" XDG_CACHE_HOME="$tmp/xdg-cache" XDG_STATE_HOME="$tmp/xdg-state" GRAINCRAWL_DB_PATH="$db" ./bin/graincrawl --config "$cfg" --json init | grep -q '"config_path"'
env HOME="$tmp/home" XDG_CONFIG_HOME="$tmp/xdg-config" XDG_CACHE_HOME="$tmp/xdg-cache" XDG_STATE_HOME="$tmp/xdg-state" ./bin/graincrawl --config "$cfg" --json metadata | grep -q '"schema_version"'
env HOME="$tmp/home" XDG_CONFIG_HOME="$tmp/xdg-config" XDG_CACHE_HOME="$tmp/xdg-cache" XDG_STATE_HOME="$tmp/xdg-state" ./bin/graincrawl --config "$cfg" --json status | grep -q '"databases"'
env HOME="$tmp/home" XDG_CONFIG_HOME="$tmp/xdg-config" XDG_CACHE_HOME="$tmp/xdg-cache" XDG_STATE_HOME="$tmp/xdg-state" ./bin/graincrawl --config "$cfg" --json tui | grep -q '^\['
env HOME="$tmp/home" XDG_CONFIG_HOME="$tmp/xdg-config" XDG_CACHE_HOME="$tmp/xdg-cache" XDG_STATE_HOME="$tmp/xdg-state" ./bin/graincrawl --config "$cfg" --json snapshot create --out "$tmp/snapshot" | grep -q '"manifest"'
release-check:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v7
with:
go-version-file: go.mod
cache: true
- name: Snapshot release build
uses: goreleaser/goreleaser-action@v7.2.3
with:
distribution: goreleaser
version: "~> v2"
args: release --snapshot --clean --skip=publish