Skip to content

Commit ae51f8d

Browse files
committed
chore(ci): unify local and CI checks under make verify
1 parent be9f998 commit ae51f8d

4 files changed

Lines changed: 35 additions & 21 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,5 @@ jobs:
2323
go-version-file: go.mod
2424
cache: true
2525

26-
- name: Format check
27-
run: |
28-
unformatted="$(gofmt -l .)"
29-
if [ -n "$unformatted" ]; then
30-
echo "Unformatted files:"
31-
echo "$unformatted"
32-
exit 1
33-
fi
34-
35-
- name: Build
36-
run: go build ./...
37-
38-
- name: Test
39-
run: go test ./...
26+
- name: Verify
27+
run: make verify

CONTRIBUTING.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,18 @@ Cleanup runbook: [docs/AI-COMMIT-CLEANUP.md](docs/AI-COMMIT-CLEANUP.md)
4646

4747
## Development Expectations
4848

49+
Before opening or updating a PR, run:
50+
51+
```sh
52+
make verify
53+
```
54+
55+
`make verify` runs:
56+
- formatting check (`gofmt -l .`)
57+
- build (`go build ./...`)
58+
- tests (`go test ./...`)
59+
- commit attribution check (`scripts/check-commit-attribution.sh`)
60+
4961
Before requesting review for mail flow changes:
5062
- test success path and failure path
5163
- verify retry behavior and max retry boundaries

Makefile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
APP_NAME=maild
22
MAIN_PACKAGE=./cmd/server
33

4-
.PHONY: setup run build test tidy
4+
.PHONY: setup run build test tidy fmt-check check-attribution verify
55

66
setup:
77
@if [ ! -f .env ]; then cp .env.example .env; fi
@@ -20,3 +20,16 @@ test:
2020

2121
tidy:
2222
go mod tidy
23+
24+
fmt-check:
25+
@unformatted="$$(gofmt -l .)"; \
26+
if [ -n "$$unformatted" ]; then \
27+
echo "Unformatted files:"; \
28+
echo "$$unformatted"; \
29+
exit 1; \
30+
fi
31+
32+
check-attribution:
33+
./scripts/check-commit-attribution.sh
34+
35+
verify: fmt-check build test check-attribution

internal/service/message_service_safety_test.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ func (q *safetyQueue) Dequeue(context.Context, time.Duration) (int64, bool, erro
8888
}
8989

9090
type safetyStore struct {
91-
suppressed bool
92-
unsubscribed bool
93-
messagesByID map[int64]domain.Message
94-
nextMessageID int64
91+
suppressed bool
92+
unsubscribed bool
93+
messagesByID map[int64]domain.Message
94+
nextMessageID int64
9595
transitionCalls int
9696
}
9797

@@ -158,7 +158,9 @@ func (s *safetyStore) ListMessages(context.Context, int64, int, time.Time, time.
158158
func (s *safetyStore) CountMessagesSince(context.Context, int64, string, time.Time) (int64, error) {
159159
return 0, nil
160160
}
161-
func (s *safetyStore) UpsertWorkspacePolicy(context.Context, domain.WorkspacePolicy) error { return nil }
161+
func (s *safetyStore) UpsertWorkspacePolicy(context.Context, domain.WorkspacePolicy) error {
162+
return nil
163+
}
162164
func (s *safetyStore) GetWorkspacePolicy(context.Context, int64) (domain.WorkspacePolicy, bool, error) {
163165
return domain.WorkspacePolicy{}, false, nil
164166
}
@@ -184,4 +186,3 @@ func (s *safetyStore) ListWebhookDeadLettersByID(context.Context, int64, []int64
184186
func (s *safetyStore) UpdateWebhookEventReplayResult(context.Context, int64, string, int, string) error {
185187
return nil
186188
}
187-

0 commit comments

Comments
 (0)