Skip to content

Commit d77e194

Browse files
authored
Merge pull request #81 from planetscale/ci/github-actions-public-go
ci: migrate checks to GitHub Actions on Go 1.26
2 parents af35c4b + 482fad7 commit d77e194

14 files changed

Lines changed: 772 additions & 739 deletions

File tree

.github/workflows/ci.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
checks:
14+
name: ${{ matrix.name }}
15+
runs-on: ubuntu-latest
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
include:
20+
- name: Tests
21+
service: ci
22+
command: make test-ci
23+
- name: Build server
24+
service: ci
25+
command: make build-server
26+
- name: go vet
27+
service: ci
28+
command: make vet
29+
- name: Lint Format
30+
service: ci
31+
command: make lint-fmt
32+
- name: staticcheck
33+
service: ci
34+
command: make lint
35+
- name: Verify dependency licenses
36+
service: licensing
37+
command: make license-check
38+
39+
env:
40+
DOCKER_BUILDKIT: "1"
41+
42+
steps:
43+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10
44+
45+
- name: Run ${{ matrix.name }}
46+
run: |
47+
docker compose run --rm --build "${{ matrix.service }}" sh -c '
48+
git config --global --add safe.directory "$PWD"
49+
50+
${{ matrix.command }}
51+
'

Dockerfile

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
# syntax=docker/dockerfile:1
22

3-
ARG GO_VERSION=1.21.3
4-
FROM pscale.dev/wolfi-prod/go:${GO_VERSION} AS build
3+
ARG GO_VERSION=1.26.4
4+
FROM golang:${GO_VERSION} AS build
55

6-
ARG GH_TOKEN
76
WORKDIR /fivetran-source
87
COPY . .
98

9+
RUN apt-get update \
10+
&& apt-get install -y --no-install-recommends unzip \
11+
&& rm -rf /var/lib/apt/lists/*
1012
RUN go mod download
11-
RUN make build-server
12-
COPY server /connect
13+
RUN make build-server \
14+
&& cp server /connect
1315

14-
FROM pscale.dev/wolfi-prod/base:latest
16+
FROM gcr.io/distroless/static-debian12:nonroot
1517

1618
COPY --from=build /connect /usr/local/bin/
17-
ENV FIVETRAN_ENTRYPOINT "/usr/local/bin/connect"
19+
ENV FIVETRAN_ENTRYPOINT=/usr/local/bin/connect
1820
ENTRYPOINT ["/usr/local/bin/connect"]

Dockerfile.ci

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
# syntax=docker/dockerfile:1
22

3-
ARG GO_VERSION=1.21.3
4-
FROM pscale.dev/wolfi-prod/go:${GO_VERSION} AS build
3+
ARG GO_VERSION=1.26.4
4+
FROM golang:${GO_VERSION}
55

6-
ARG GH_TOKEN
76
ENTRYPOINT []
87
WORKDIR /fivetran-source
9-
COPY . .
108

11-
RUN go mod download
12-
RUN make build-server
9+
RUN apt-get update \
10+
&& apt-get install -y --no-install-recommends unzip \
11+
&& rm -rf /var/lib/apt/lists/*

Makefile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ else
1111
endif
1212

1313
BIN := bin
14-
export GOPRIVATE := github.com/planetscale/*
1514
export GOBIN := $(PWD)/$(BIN)
1615

1716
GO ?= go
@@ -29,13 +28,15 @@ ifeq ($(OS),Darwin)
2928
endif
3029
FIVETRANSDK_PROTO_OUT := fivetran_sdk.v2
3130
FIVETRAN_PROTO_VERSION := 466a61bddfc0e541bfec3cb0cc6a3cf3704d64be
31+
GOFUMPT_VERSION := v0.10.0
32+
STATICCHECK_VERSION := v0.7.0
3233

3334
.PHONY: all
3435
all: build test lint-fmt lint
3536

3637
.PHONY: bootstrap
3738
bootstrap:
38-
@go install mvdan.cc/gofumpt@latest
39+
@go install mvdan.cc/gofumpt@$(GOFUMPT_VERSION)
3940

4041

4142
.PHONY: test
@@ -68,8 +69,8 @@ license-check: $(FIVETRANSDK_PROTO_OUT)/connector_sdk.pb.go
6869

6970
.PHONY: lint
7071
lint: proto
71-
@go install honnef.co/go/tools/cmd/staticcheck@latest
72-
@$(GOBIN)/staticcheck ./...
72+
@go install honnef.co/go/tools/cmd/staticcheck@$(STATICCHECK_VERSION)
73+
@$(GOBIN)/staticcheck $$(go list ./... | grep -v '/$(FIVETRANSDK_PROTO_OUT)$$')
7374

7475
.PHONY: lint-fmt
7576
lint-fmt: fmt
@@ -78,13 +79,13 @@ lint-fmt: fmt
7879
.PHONY: build-image
7980
build-image:
8081
@echo "==> Building docker image ${REPO}/${NAME}:$(VERSION)"
81-
@docker build --platform ${DOCKER_BUILD_PLATFORM} --build-arg VERSION=$(VERSION:v%=%) --build-arg GH_TOKEN=${GH_TOKEN} --build-arg COMMIT=$(COMMIT) --build-arg DATE=$(DATE) -t ${REPO}/${NAME}:$(VERSION) .
82+
@docker build --platform ${DOCKER_BUILD_PLATFORM} --build-arg VERSION=$(VERSION:v%=%) --build-arg COMMIT=$(COMMIT) --build-arg DATE=$(DATE) -t ${REPO}/${NAME}:$(VERSION) .
8283
@docker tag ${REPO}/${NAME}:$(VERSION) ${REPO}/${NAME}:latest
8384

8485
.PHONY: build-image-linux
8586
build-image-linux:
8687
@echo "==> Building docker image ${REPO}/${NAME}:$(VERSION)"
87-
@docker build --platform ${DOCKER_LINUX_BUILD_PLATFORM} --build-arg VERSION=$(VERSION:v%=%) --build-arg GH_TOKEN=${GH_TOKEN} --build-arg COMMIT=$(COMMIT) --build-arg DATE=$(DATE) -t ${REPO}/${NAME}:$(VERSION) .
88+
@docker build --platform ${DOCKER_LINUX_BUILD_PLATFORM} --build-arg VERSION=$(VERSION:v%=%) --build-arg COMMIT=$(COMMIT) --build-arg DATE=$(DATE) -t ${REPO}/${NAME}:$(VERSION) .
8889
@docker tag ${REPO}/${NAME}:$(VERSION) ${REPO}/${NAME}:latest
8990

9091
.PHONY: push

cmd/internal/server/proto_codec.go

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
package server
2+
3+
import (
4+
"fmt"
5+
6+
"google.golang.org/grpc/encoding"
7+
"google.golang.org/grpc/mem"
8+
"google.golang.org/protobuf/proto"
9+
"google.golang.org/protobuf/protoadapt"
10+
)
11+
12+
type standardProtoCodec struct{}
13+
14+
func init() {
15+
// Vitess v0.24 globally registers a codec named "proto" for VTProto.
16+
// This connector serves Fivetran protobuf RPCs, so restore gRPC's standard
17+
// protobuf codec for this package after Vitess package init has run.
18+
encoding.RegisterCodecV2(standardProtoCodec{})
19+
}
20+
21+
func (standardProtoCodec) Name() string {
22+
return "proto"
23+
}
24+
25+
func (standardProtoCodec) Marshal(v any) (mem.BufferSlice, error) {
26+
msg := protoMessage(v)
27+
if msg == nil {
28+
return nil, fmt.Errorf("proto: failed to marshal, message is %T, want proto.Message", v)
29+
}
30+
31+
data, err := proto.Marshal(msg)
32+
if err != nil {
33+
return nil, err
34+
}
35+
return mem.BufferSlice{mem.SliceBuffer(data)}, nil
36+
}
37+
38+
func (standardProtoCodec) Unmarshal(data mem.BufferSlice, v any) error {
39+
msg := protoMessage(v)
40+
if msg == nil {
41+
return fmt.Errorf("proto: failed to unmarshal, message is %T, want proto.Message", v)
42+
}
43+
44+
return proto.Unmarshal(data.Materialize(), msg)
45+
}
46+
47+
func protoMessage(v any) proto.Message {
48+
switch v := v.(type) {
49+
case protoadapt.MessageV1:
50+
return protoadapt.MessageV2Of(v)
51+
case protoadapt.MessageV2:
52+
return v
53+
default:
54+
return nil
55+
}
56+
}

cmd/internal/server/server_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ func server(ctx context.Context, clientConstructor edgeClientConstructor, mysqlC
4747
log.Printf("error serving server: %v", err)
4848
}
4949
}()
50-
conn, err := grpc.DialContext(ctx, "",
51-
grpc.WithContextDialer(func(context.Context, string) (net.Conn, error) {
52-
return lis.Dial()
50+
conn, err := grpc.NewClient("passthrough:///bufconn",
51+
grpc.WithContextDialer(func(ctx context.Context, _ string) (net.Conn, error) {
52+
return lis.DialContext(ctx)
5353
}), grpc.WithTransportCredentials(insecure.NewCredentials()))
5454
if err != nil {
5555
log.Printf("error connecting to server: %v", err)

containers/licensing/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.21.3
1+
FROM golang:1.26.4
22

33
RUN apt-get update && apt-get install -y ruby git make
44
RUN gem install license_finder

doc/dependency_decisions.yml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,3 +241,111 @@
241241
:why:
242242
:versions: []
243243
:when: 2023-12-14 12:08:59.192694000 Z
244+
- - :approve
245+
- github.com/DataDog/go-sqllexer
246+
- :who:
247+
:why: Transitive dependency of Vitess v0.24.1; MIT.
248+
:versions: []
249+
:when: 2026-06-15 18:00:00.000000000 Z
250+
- - :approve
251+
- github.com/cenkalti/backoff/v5
252+
- :who:
253+
:why: Transitive dependency of Vitess v0.24.1; MIT.
254+
:versions: []
255+
:when: 2026-06-15 18:00:00.000000000 Z
256+
- - :approve
257+
- github.com/cilium/ebpf
258+
- :who:
259+
:why: Transitive dependency of Vitess v0.24.1; MIT/BSD.
260+
:versions: []
261+
:when: 2026-06-15 18:00:00.000000000 Z
262+
- - :approve
263+
- github.com/davecgh/go-spew
264+
- :who:
265+
:why: Transitive dependency of Vitess v0.24.1; ISC.
266+
:versions: []
267+
:when: 2026-06-15 18:00:00.000000000 Z
268+
- - :approve
269+
- github.com/go-viper/mapstructure/v2
270+
- :who:
271+
:why: Transitive dependency of Vitess v0.24.1; MIT.
272+
:versions: []
273+
:when: 2026-06-15 18:00:00.000000000 Z
274+
- - :approve
275+
- github.com/godbus/dbus/v5
276+
- :who:
277+
:why: Transitive dependency of Vitess v0.24.1; BSD.
278+
:versions: []
279+
:when: 2026-06-15 18:00:00.000000000 Z
280+
- - :approve
281+
- github.com/hashicorp/go-version
282+
- :who:
283+
:why: Transitive dependency of Vitess v0.24.1; MPL-2.0.
284+
:versions: []
285+
:when: 2026-06-15 18:00:00.000000000 Z
286+
- - :approve
287+
- github.com/json-iterator/go
288+
- :who:
289+
:why: Transitive dependency of Vitess v0.24.1; MIT.
290+
:versions: []
291+
:when: 2026-06-15 18:00:00.000000000 Z
292+
- - :approve
293+
- github.com/klauspost/cpuid/v2
294+
- :who:
295+
:why: Transitive dependency of Vitess v0.24.1; MIT.
296+
:versions: []
297+
:when: 2026-06-15 18:00:00.000000000 Z
298+
- - :approve
299+
- github.com/lmittmann/tint
300+
- :who:
301+
:why: Transitive dependency of Vitess v0.24.1; MIT.
302+
:versions: []
303+
:when: 2026-06-15 18:00:00.000000000 Z
304+
- - :approve
305+
- github.com/mattn/go-isatty
306+
- :who:
307+
:why: Transitive dependency of Vitess v0.24.1; MIT.
308+
:versions: []
309+
:when: 2026-06-15 18:00:00.000000000 Z
310+
- - :approve
311+
- github.com/sagikazarmark/locafero
312+
- :who:
313+
:why: Transitive dependency of Vitess v0.24.1; MIT.
314+
:versions: []
315+
:when: 2026-06-15 18:00:00.000000000 Z
316+
- - :approve
317+
- github.com/sirupsen/logrus
318+
- :who:
319+
:why: Transitive dependency of Vitess v0.24.1; MIT.
320+
:versions: []
321+
:when: 2026-06-15 18:00:00.000000000 Z
322+
- - :approve
323+
- github.com/stretchr/testify
324+
- :who:
325+
:why: Test dependency updated with Vitess v0.24.1; MIT.
326+
:versions: []
327+
:when: 2026-06-15 18:00:00.000000000 Z
328+
- - :approve
329+
- github.com/trailofbits/go-mutexasserts
330+
- :who:
331+
:why: Transitive dependency of Vitess v0.24.1; MIT.
332+
:versions: []
333+
:when: 2026-06-15 18:00:00.000000000 Z
334+
- - :approve
335+
- go.uber.org/multierr
336+
- :who:
337+
:why: Transitive dependency of Vitess v0.24.1; MIT.
338+
:versions: []
339+
:when: 2026-06-15 18:00:00.000000000 Z
340+
- - :approve
341+
- go.uber.org/zap
342+
- :who:
343+
:why: Transitive dependency of Vitess v0.24.1; MIT.
344+
:versions: []
345+
:when: 2026-06-15 18:00:00.000000000 Z
346+
- - :approve
347+
- go.yaml.in/yaml/v3
348+
- :who:
349+
:why: Transitive dependency of Vitess v0.24.1; MIT.
350+
:versions: []
351+
:when: 2026-06-15 18:00:00.000000000 Z

docker-compose.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,14 @@
1-
# Use root/example as user/password credentials
2-
version: '3.1'
3-
41
services:
52
ci:
63
build:
74
context: .
8-
args:
9-
- GH_TOKEN=${ACTIONS_BOT_TOKEN:?}
105
dockerfile: Dockerfile.ci
116
volumes:
127
- .:/fivetran-source
138
working_dir: /fivetran-source
149
licensing:
1510
build:
1611
context: containers/licensing
17-
args:
18-
- GH_TOKEN=${ACTIONS_BOT_TOKEN:?}
1912
volumes:
2013
- .:/work
2114
working_dir: /work

0 commit comments

Comments
 (0)