Skip to content

Commit e566f9b

Browse files
committed
wip
1 parent b54be13 commit e566f9b

5 files changed

Lines changed: 112 additions & 244 deletions

File tree

.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: 28 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,21 @@ jobs:
99
runs-on: ubuntu-latest
1010

1111
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
12+
- uses: docker/setup-qemu-action@v3
13+
- uses: docker/setup-buildx-action@v3
1814
with:
1915
version: v0.9.1
20-
-
21-
name: Login to DockerHub
22-
uses: docker/login-action@v3
16+
17+
- uses: docker/login-action@v3
2318
with:
2419
username: ${{ secrets.DOCKERHUB_USERNAME }}
2520
password: ${{ secrets.DOCKERHUB_TOKEN }}
21+
2622
- uses: actions/checkout@v6
27-
with:
28-
fetch-depth: 0
29-
-
30-
name: "Fetch latest tag"
31-
id: get-latest-tag
23+
- id: get-latest-tag
3224
uses: "WyriHaximus/github-action-get-previous-tag@v2"
33-
-
34-
name: Build and push Postgres 15
25+
26+
- name: Build and push Postgres 15
3527
id: docker_build_15
3628
uses: docker/build-push-action@v6
3729
with:
@@ -45,8 +37,8 @@ jobs:
4537
tags: |
4638
flyio/postgres-flex:15
4739
flyio/postgres-flex:15.10
48-
-
49-
name: Build and push Postgres 15 Timescale DB
40+
41+
- name: Build and push Postgres 15 Timescale DB
5042
id: docker_build_15_timescaledb
5143
uses: docker/build-push-action@v6
5244
with:
@@ -61,8 +53,7 @@ jobs:
6153
flyio/postgres-flex-timescaledb:15
6254
flyio/postgres-flex-timescaledb:15.10
6355
64-
-
65-
name: Build and push Postgres 16
56+
- name: Build and push Postgres 16
6657
id: docker_build_16
6758
uses: docker/build-push-action@v6
6859
with:
@@ -76,8 +67,8 @@ jobs:
7667
tags: |
7768
flyio/postgres-flex:16
7869
flyio/postgres-flex:16.6
79-
-
80-
name: Build and push Postgres 16 Timescale DB
70+
71+
- name: Build and push Postgres 16 Timescale DB
8172
id: docker_build_16_timescaledb
8273
uses: docker/build-push-action@v6
8374
with:
@@ -92,8 +83,7 @@ jobs:
9283
flyio/postgres-flex-timescaledb:16
9384
flyio/postgres-flex-timescaledb:16.6
9485
95-
-
96-
name: Build and push Postgres 17
86+
- name: Build and push Postgres 17
9787
id: docker_build_17
9888
uses: docker/build-push-action@v6
9989
with:
@@ -107,8 +97,8 @@ jobs:
10797
tags: |
10898
flyio/postgres-flex:17
10999
flyio/postgres-flex:17.2
110-
-
111-
name: Build and push Postgres 17 Timescale DB
100+
101+
- name: Build and push Postgres 17 Timescale DB
112102
id: docker_build_17_timescaledb
113103
uses: docker/build-push-action@v6
114104
with:
@@ -122,21 +112,21 @@ jobs:
122112
tags: |
123113
flyio/postgres-flex-timescaledb:17
124114
flyio/postgres-flex-timescaledb:17.2
125-
-
126-
name: Postgres 15 Image digest
115+
116+
- name: Postgres 15 Image digest
127117
run: echo ${{ steps.docker_build_15.outputs.digest }}
128-
-
129-
name: Postgres 15 TimescaleDB Image digest
118+
119+
- name: Postgres 15 TimescaleDB Image digest
130120
run: echo ${{ steps.docker_build_15_timescaledb.outputs.digest }}
131-
-
132-
name: Postgres 16 Image digest
121+
122+
- name: Postgres 16 Image digest
133123
run: echo ${{ steps.docker_build_16.outputs.digest }}
134-
-
135-
name: Postgres 16 TimescaleDB Image digest
124+
125+
- name: Postgres 16 TimescaleDB Image digest
136126
run: echo ${{ steps.docker_build_16_timescaledb.outputs.digest }}
137-
-
138-
name: Postgres 17 Image digest
127+
128+
- name: Postgres 17 Image digest
139129
run: echo ${{ steps.docker_build_17.outputs.digest }}
140-
-
141-
name: Postgres 17 TimescaleDB Image digest
130+
131+
- name: Postgres 17 TimescaleDB Image digest
142132
run: echo ${{ steps.docker_build_17_timescaledb.outputs.digest }}

.github/workflows/push.yml

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

.golangci.yml

Lines changed: 21 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -1,125 +1,29 @@
1-
issues:
2-
# List of regexps of issue texts to exclude, empty list by default.
3-
# But independently from this option we use default exclude patterns,
4-
# it can be disabled by `exclude-use-default: false`. To list all
5-
# excluded by default patterns execute `golangci-lint run --help`
6-
7-
exclude-rules:
8-
# Exclude gosimple bool check
9-
- linters:
10-
- gosimple
11-
text: "S(1002|1008|1021)"
12-
# Exclude failing staticchecks for now
13-
- linters:
14-
- staticcheck
15-
text: "SA(1006|1019|4006|4010|4017|5007|6005|9004):"
16-
# Exclude lll issues for long lines with go:generate
17-
- linters:
18-
- lll
19-
source: "^//go:generate "
20-
21-
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
22-
max-issues-per-linter: 0
23-
24-
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
25-
max-same-issues: 0
1+
version: "2"
2+
run:
3+
issues-exit-code: 1
4+
tests: true
265

276
linters:
28-
disable-all: true
297
enable:
30-
# - gofumpt
31-
# - goimports
32-
- gosimple
338
- govet
349
- ineffassign
3510
- staticcheck
3611
- unconvert
3712
- unused
38-
fast: true
39-
40-
# options for analysis running
41-
run:
42-
go: "1.19"
43-
44-
# default concurrency is a available CPU number
45-
concurrency: 4
46-
47-
# timeout for analysis, e.g. 30s, 5m, default is 1m
48-
timeout: 10m
49-
50-
# exit code when at least one issue was found, default is 1
51-
issues-exit-code: 1
52-
53-
# include test files or not, default is true
54-
tests: true
55-
56-
# list of build tags, all linters use it. Default is empty list.
57-
#build-tags:
58-
# - mytag
59-
60-
# which dirs to skip: issues from them won't be reported;
61-
# can use regexp here: generated.*, regexp is applied on full path;
62-
# default value is empty list, but default dirs are skipped independently
63-
# from this option's value (see skip-dirs-use-default).
64-
#skip-dirs:
65-
# - src/external_libs
66-
# - autogenerated_by_my_lib
67-
68-
# default is true. Enables skipping of directories:
69-
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
70-
skip-dirs-use-default: true
71-
72-
# which files to skip: they will be analyzed, but issues from them
73-
# won't be reported. Default value is empty list, but there is
74-
# no need to include all autogenerated files, we confidently recognize
75-
# autogenerated files. If it's not please let us know.
76-
skip-files:
77-
- ".*\\.hcl2spec\\.go$"
78-
- "docstrings/gen.go"
79-
# - lib/bad.go
80-
81-
# by default isn't set. If set we pass it to "go list -mod={option}". From "go help modules":
82-
# If invoked with -mod=readonly, the go command is disallowed from the implicit
83-
# automatic updating of go.mod described above. Instead, it fails when any changes
84-
# to go.mod are needed. This setting is most useful to check that go.mod does
85-
# not need updates, such as in a continuous integration and testing system.
86-
# If invoked with -mod=vendor, the go command assumes that the vendor
87-
# directory holds the correct copies of dependencies and ignores
88-
# the dependency descriptions in go.mod.
89-
# modules-download-mode: vendor
90-
91-
# output configuration options
92-
output:
93-
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
94-
format: colored-line-number
95-
96-
# print lines of code with issue, default is true
97-
print-issued-lines: true
98-
99-
# print linter name in the end of issue text, default is true
100-
print-linter-name: true
101-
102-
# make issues output unique by line, default is true
103-
uniq-by-line: true
104-
105-
# all available settings of specific linters
106-
linters-settings:
107-
gofumpt:
108-
module-path: github.com/fly-apps/postgres-flex
109-
errcheck:
110-
# report about not checking of errors in type assetions: `a := b.(MyStruct)`;
111-
# default is false: such cases aren't reported by default.
112-
check-type-assertions: false
113-
114-
# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
115-
# default is false: such cases aren't reported by default.
116-
check-blank: false
117-
118-
# [deprecated] comma-separated list of pairs of the form pkg:regex
119-
# the regex is used to ignore names within pkg. (default "fmt:.*").
120-
# see https://github.com/kisielk/errcheck#the-deprecated-method for details
121-
ignore: fmt:.*,io/ioutil:^Read.*,io:Close
122-
123-
# path to a file containing a list of functions to exclude from checking
124-
# see https://github.com/kisielk/errcheck#excluding-functions for details
125-
#exclude: /path/to/file.txt
13+
- nlreturn
14+
- bodyclose
15+
- gocheckcompilerdirectives
16+
- errname
17+
- errchkjson
18+
settings:
19+
nlreturn:
20+
block-size: 3
21+
22+
staticcheck:
23+
checks:
24+
- all
25+
- -ST1003 # struct field ... should be ... (mostly acronyms such as Http -> HTTP)
26+
27+
formatters:
28+
enable:
29+
- gofumpt

0 commit comments

Comments
 (0)