Skip to content

Commit 7aeb7c8

Browse files
authored
Bump Go to 1.26 and modernize codebase
- Bump Go version to 1.26 in go.mod and all Dockerfiles (pg15/16/17) - Run go fix: replace interface{} with any, use strings.SplitSeq, fmt.Appendf, drop legacy // +build constraints - Fix all golangci-lint issues: add missing package comments, fix exported function comment format - Add unparam linter - Improve CI: replace create trigger with push tags v*; build Docker images on pull requests without pushing
1 parent b54be13 commit 7aeb7c8

64 files changed

Lines changed: 287 additions & 376 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/dependabot.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,26 @@
1-
# Please see the documentation for all configuration options:
2-
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
31
version: 2
42
updates:
3+
- package-ecosystem: "gomod"
4+
directory: "/"
5+
labels:
6+
- "dependencies"
7+
schedule:
8+
interval: "weekly"
9+
cooldown:
10+
default-days: 7
11+
groups:
12+
tracing:
13+
patterns:
14+
- "go.opentelemetry.io/*"
15+
golangx:
16+
patterns:
17+
- "golang.org/x/*"
18+
519
- package-ecosystem: "github-actions"
620
directory: "/"
21+
labels:
22+
- "dependencies"
723
schedule:
824
interval: "weekly"
25+
cooldown:
26+
default-days: 7

.github/workflows/checks.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: "Checks"
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build:
10+
name: "Build and test"
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v6
14+
- uses: actions/setup-go@v6
15+
with:
16+
go-version-file: "go.mod"
17+
18+
- name: Run unit tests
19+
run: go test -v ./...
20+
21+
- name: Build binaries
22+
run: go install ./cmd/...
23+
24+
precommit:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v6
28+
- uses: actions/setup-go@v6
29+
with:
30+
go-version-file: "go.mod"
31+
32+
- uses: j178/prek-action@v1
33+
with:
34+
extra-args: --all-files --stage=manual
35+
36+
- uses: golangci/golangci-lint-action@v9
37+
with:
38+
version: latest
39+
40+
- name: generate command strings
41+
run: go generate ./... && git diff --exit-code

.github/workflows/ci.yaml

Lines changed: 46 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,142 +1,136 @@
11
name: Release
22

33
on:
4-
create:
4+
push:
5+
tags:
6+
- 'v*'
7+
pull_request:
58

69
jobs:
710
release:
8-
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
911
runs-on: ubuntu-latest
1012

1113
steps:
12-
-
13-
name: Set up QEMU
14-
uses: docker/setup-qemu-action@v3
15-
-
16-
name: Set up Docker Buildx
17-
uses: docker/setup-buildx-action@v3
14+
- uses: docker/setup-qemu-action@v3
15+
- uses: docker/setup-buildx-action@v3
1816
with:
1917
version: v0.9.1
20-
-
21-
name: Login to DockerHub
22-
uses: docker/login-action@v3
18+
19+
- uses: docker/login-action@v3
20+
if: github.event_name != 'pull_request'
2321
with:
2422
username: ${{ secrets.DOCKERHUB_USERNAME }}
2523
password: ${{ secrets.DOCKERHUB_TOKEN }}
24+
2625
- uses: actions/checkout@v6
27-
with:
28-
fetch-depth: 0
29-
-
30-
name: "Fetch latest tag"
31-
id: get-latest-tag
26+
- id: get-latest-tag
27+
if: github.event_name != 'pull_request'
3228
uses: "WyriHaximus/github-action-get-previous-tag@v2"
33-
-
34-
name: Build and push Postgres 15
29+
30+
- name: Build and push Postgres 15
3531
id: docker_build_15
3632
uses: docker/build-push-action@v6
3733
with:
3834
build-args: |
3935
PG_VERSION=15.10
4036
PG_MAJOR_VERSION=15
41-
VERSION=${{ steps.get-latest-tag.outputs.tag }}
37+
VERSION=${{ steps.get-latest-tag.outputs.tag || 'pr-build' }}
4238
context: .
4339
file: ./pg15/Dockerfile
44-
push: true
40+
push: ${{ github.event_name != 'pull_request' }}
4541
tags: |
4642
flyio/postgres-flex:15
4743
flyio/postgres-flex:15.10
48-
-
49-
name: Build and push Postgres 15 Timescale DB
44+
45+
- name: Build and push Postgres 15 Timescale DB
5046
id: docker_build_15_timescaledb
5147
uses: docker/build-push-action@v6
5248
with:
5349
build-args: |
5450
PG_VERSION=15.10
5551
PG_MAJOR_VERSION=15
56-
VERSION=${{ steps.get-latest-tag.outputs.tag }}
52+
VERSION=${{ steps.get-latest-tag.outputs.tag || 'pr-build' }}
5753
context: .
5854
file: ./pg15/Dockerfile-timescaledb
59-
push: true
55+
push: ${{ github.event_name != 'pull_request' }}
6056
tags: |
6157
flyio/postgres-flex-timescaledb:15
6258
flyio/postgres-flex-timescaledb:15.10
6359
64-
-
65-
name: Build and push Postgres 16
60+
- name: Build and push Postgres 16
6661
id: docker_build_16
6762
uses: docker/build-push-action@v6
6863
with:
6964
build-args: |
7065
PG_VERSION=16.6
7166
PG_MAJOR_VERSION=16
72-
VERSION=${{ steps.get-latest-tag.outputs.tag }}
67+
VERSION=${{ steps.get-latest-tag.outputs.tag || 'pr-build' }}
7368
context: .
7469
file: ./pg16/Dockerfile
75-
push: true
70+
push: ${{ github.event_name != 'pull_request' }}
7671
tags: |
7772
flyio/postgres-flex:16
7873
flyio/postgres-flex:16.6
79-
-
80-
name: Build and push Postgres 16 Timescale DB
74+
75+
- name: Build and push Postgres 16 Timescale DB
8176
id: docker_build_16_timescaledb
8277
uses: docker/build-push-action@v6
8378
with:
8479
build-args: |
8580
PG_VERSION=16.6
8681
PG_MAJOR_VERSION=16
87-
VERSION=${{ steps.get-latest-tag.outputs.tag }}
82+
VERSION=${{ steps.get-latest-tag.outputs.tag || 'pr-build' }}
8883
context: .
8984
file: ./pg16/Dockerfile-timescaledb
90-
push: true
85+
push: ${{ github.event_name != 'pull_request' }}
9186
tags: |
9287
flyio/postgres-flex-timescaledb:16
9388
flyio/postgres-flex-timescaledb:16.6
9489
95-
-
96-
name: Build and push Postgres 17
90+
- name: Build and push Postgres 17
9791
id: docker_build_17
9892
uses: docker/build-push-action@v6
9993
with:
10094
build-args: |
10195
PG_VERSION=17.2
10296
PG_MAJOR_VERSION=17
103-
VERSION=${{ steps.get-latest-tag.outputs.tag }}
97+
VERSION=${{ steps.get-latest-tag.outputs.tag || 'pr-build' }}
10498
context: .
10599
file: ./pg17/Dockerfile
106-
push: true
100+
push: ${{ github.event_name != 'pull_request' }}
107101
tags: |
108102
flyio/postgres-flex:17
109103
flyio/postgres-flex:17.2
110-
-
111-
name: Build and push Postgres 17 Timescale DB
104+
105+
- name: Build and push Postgres 17 Timescale DB
112106
id: docker_build_17_timescaledb
113107
uses: docker/build-push-action@v6
114108
with:
115109
build-args: |
116110
PG_VERSION=17.2
117111
PG_MAJOR_VERSION=17
118-
VERSION=${{ steps.get-latest-tag.outputs.tag }}
112+
VERSION=${{ steps.get-latest-tag.outputs.tag || 'pr-build' }}
119113
context: .
120114
file: ./pg17/Dockerfile-timescaledb
121-
push: true
115+
push: ${{ github.event_name != 'pull_request' }}
122116
tags: |
123117
flyio/postgres-flex-timescaledb:17
124118
flyio/postgres-flex-timescaledb:17.2
125-
-
126-
name: Postgres 15 Image digest
119+
120+
- name: Postgres 15 Image digest
127121
run: echo ${{ steps.docker_build_15.outputs.digest }}
128-
-
129-
name: Postgres 15 TimescaleDB Image digest
122+
123+
- name: Postgres 15 TimescaleDB Image digest
130124
run: echo ${{ steps.docker_build_15_timescaledb.outputs.digest }}
131-
-
132-
name: Postgres 16 Image digest
125+
126+
- name: Postgres 16 Image digest
133127
run: echo ${{ steps.docker_build_16.outputs.digest }}
134-
-
135-
name: Postgres 16 TimescaleDB Image digest
128+
129+
- name: Postgres 16 TimescaleDB Image digest
136130
run: echo ${{ steps.docker_build_16_timescaledb.outputs.digest }}
137-
-
138-
name: Postgres 17 Image digest
131+
132+
- name: Postgres 17 Image digest
139133
run: echo ${{ steps.docker_build_17.outputs.digest }}
140-
-
141-
name: Postgres 17 TimescaleDB Image digest
134+
135+
- name: Postgres 17 TimescaleDB Image digest
142136
run: echo ${{ steps.docker_build_17_timescaledb.outputs.digest }}

.github/workflows/push.yml

Lines changed: 0 additions & 76 deletions
This file was deleted.

0 commit comments

Comments
 (0)