-
Notifications
You must be signed in to change notification settings - Fork 1.3k
175 lines (144 loc) · 5.32 KB
/
ci.yml
File metadata and controls
175 lines (144 loc) · 5.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
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
# 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@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # 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 -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@671740ac38dd9b0130fbe1cec585b89eea48d3de # 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@671740ac38dd9b0130fbe1cec585b89eea48d3de # 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@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # 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.10.1
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@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # 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.82.4
- name: Cache beads (bd)
id: cache-beads-int
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # 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.55.4
- 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"