Skip to content

Commit 67636fb

Browse files
committed
ci: add GitHub Actions workflow for lint + unit + integration tests
Three parallel jobs on push to main and every PR: - lint: golangci-lint via golangci-lint-action@v9 (v7+ required for our v2 .golangci.yml config; v6 only understands v1 configs) - test: unit tests with race detector via make test - test-integration: search-sync-worker integration tests via make test-integration SERVICE=search-sync-worker (Docker is pre-installed on ubuntu-latest runners, so testcontainers-go can start ES + NATS) Scoped integration to search-sync-worker only — other services have their own azure-pipelines.yml and running all -tags=integration tests in one job would be slow. Expand to a per-service matrix later if needed. Also drops goimports from .golangci.yml linters.settings — v2.11+ rejects it (additional properties 'goimports' not allowed) because goimports was reclassified as a formatter in v2. The duplicate block under formatters.settings (unchanged) keeps it active with the same local-prefixes. https://claude.ai/code/session_01XTmSpmv5dT6UXX7NpRdYqN
1 parent 8b7b27a commit 67636fb

2 files changed

Lines changed: 69 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: ci
2+
3+
# Skip CI for docs-only changes. Note: if you later add required status
4+
# checks, switch to per-job `if:` conditionals since paths-ignore will
5+
# leave the checks in a "pending" state instead of passing them.
6+
on:
7+
push:
8+
branches: [main]
9+
paths-ignore:
10+
- "docs/**"
11+
- "**.md"
12+
pull_request:
13+
paths-ignore:
14+
- "docs/**"
15+
- "**.md"
16+
17+
# Cancel in-progress runs for the same branch when a new commit lands.
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.ref }}
20+
cancel-in-progress: true
21+
22+
permissions:
23+
contents: read
24+
25+
env:
26+
GO_VERSION: "1.25.8"
27+
# Pin golangci-lint to a known-good version so a new release can't break
28+
# CI without a config update. Bump deliberately.
29+
GOLANGCI_LINT_VERSION: "v2.11.4"
30+
31+
jobs:
32+
lint:
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/checkout@v4
36+
- uses: actions/setup-go@v5
37+
with:
38+
go-version: ${{ env.GO_VERSION }}
39+
cache: true
40+
- uses: golangci/golangci-lint-action@v9
41+
with:
42+
version: ${{ env.GOLANGCI_LINT_VERSION }}
43+
44+
test:
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@v4
48+
- uses: actions/setup-go@v5
49+
with:
50+
go-version: ${{ env.GO_VERSION }}
51+
cache: true
52+
- name: Unit tests (race detector)
53+
run: make test
54+
55+
# Integration tests run the full testcontainers-go stack (Elasticsearch,
56+
# NATS JetStream, MongoDB, Cassandra as applicable per service). Docker is
57+
# pre-installed on ubuntu-latest runners. Bump the timeout if container
58+
# image pulls are slow on cold cache.
59+
test-integration:
60+
runs-on: ubuntu-latest
61+
timeout-minutes: 20
62+
steps:
63+
- uses: actions/checkout@v4
64+
- uses: actions/setup-go@v5
65+
with:
66+
go-version: ${{ env.GO_VERSION }}
67+
cache: true
68+
- name: Integration tests (search-sync-worker)
69+
run: make test-integration SERVICE=search-sync-worker

.golangci.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ linters:
1010
- bodyclose
1111
- exhaustive
1212
settings:
13-
goimports:
14-
local-prefixes:
15-
- github.com/hmchangw/chat
1613
exhaustive:
1714
default-signifies-exhaustive: true
1815
gocritic:

0 commit comments

Comments
 (0)