-
Notifications
You must be signed in to change notification settings - Fork 1.3k
200 lines (167 loc) · 6.32 KB
/
ci.yml
File metadata and controls
200 lines (167 loc) · 6.32 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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
# Guard: go.mod must not contain replace directives — they break `go install`.
# See: https://github.com/steveyegge/gastown/issues/2230
check-no-replace-directives:
name: Reject go.mod replace directives
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Check for replace directives in go.mod
run: |
if grep -qE '^replace\s' go.mod; then
echo "ERROR: go.mod contains replace directives."
echo ""
echo "Replace directives break 'go install github.com/steveyegge/gastown/cmd/gt@latest'."
echo "See: https://github.com/steveyegge/gastown/issues/2230"
echo ""
echo "Found:"
grep -n '^replace' go.mod
echo ""
echo "Remove replace directives before merging to main."
exit 1
fi
echo "OK: no replace directives in go.mod"
# Guard: gastown no longer supports issues.jsonl — Dolt server is the only backend.
check-no-issues-jsonl:
name: Reject issues.jsonl
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Reject issues.jsonl if present
run: |
if [ -f .beads/issues.jsonl ]; then
echo "ERROR: .beads/issues.jsonl must not exist in the repository."
echo ""
echo "Gastown requires a Dolt server — issues.jsonl is no longer supported."
echo ""
echo "To fix, run:"
echo " git rm .beads/issues.jsonl"
echo " git commit --amend"
echo " git push --force"
echo ""
exit 1
fi
echo "OK: no issues.jsonl found"
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6
with:
go-version: '1.26'
cache: true
- name: Install ICU4C development headers
run: sudo apt-get install -y libicu-dev
- name: Configure Git
run: |
git config --global user.name "CI Bot"
git config --global user.email "ci@gastown.test"
- name: Install Dolt
run: |
curl -L https://github.com/dolthub/dolt/releases/latest/download/install.sh | sudo bash
- name: Install gotestsum
run: go install gotest.tools/gotestsum@latest
- name: Build
run: go build -v ./cmd/gt
- name: Test with Coverage
run: |
set -o pipefail
gotestsum --format testname --junitfile junit.xml -- -race -short -timeout=10m -coverprofile=coverage.out ./... 2>&1 | tee test-output.txt
- name: Test Report
if: always()
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
python3 .github/scripts/junit-report.py junit.xml "Unit Test Failures"
- name: Upload coverage to Codecov
if: ${{ !cancelled() }}
uses: codecov/codecov-action@1af58845a975a7985b0beb0cbe6fbbb71a41dbad # v5
with:
files: coverage.out
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/codecov-action@1af58845a975a7985b0beb0cbe6fbbb71a41dbad # v5
with:
files: junit.xml
token: ${{ secrets.CODECOV_TOKEN }}
report_type: test_results
fail_ci_if_error: false
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set up Go
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6
with:
go-version: '1.26'
cache: true
- name: Install ICU4C development headers
run: sudo apt-get install -y libicu-dev
- name: golangci-lint
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9
with:
version: v2.11.4
args: --timeout=5m
integration:
name: Integration Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set up Go
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6
with:
go-version: '1.26'
cache: true
- name: Install ICU4C development headers
run: sudo apt-get install -y libicu-dev
- name: Configure Git
run: |
git config --global user.name "CI Bot"
git config --global user.email "ci@gastown.test"
- name: Install Dolt
run: |
curl -L https://github.com/dolthub/dolt/releases/latest/download/install.sh | sudo bash
- name: Pre-pull Dolt Docker image
run: docker pull dolthub/dolt-sql-server:1.83.0
- name: Cache beads (bd)
id: cache-beads-int
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5
with:
path: ~/go/bin/bd
key: beads-${{ hashFiles('.github/workflows/ci.yml') }}
- name: Install beads (bd)
if: steps.cache-beads-int.outputs.cache-hit != 'true'
run: go install github.com/steveyegge/beads/cmd/bd@v0.57.0
- name: Install gotestsum
run: go install gotest.tools/gotestsum@latest
- name: Build gt
run: |
make build
cp gt $(go env GOPATH)/bin/
- name: Add to PATH
run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
- name: Integration Tests
run: gotestsum --format testname --junitfile junit-integration.xml -- -tags=integration -timeout=15m -v ./internal/cmd/...
- name: Test Report
if: always()
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
python3 .github/scripts/junit-report.py junit-integration.xml "Integration Test Failures"