Skip to content

Commit 825d89d

Browse files
fix postgres (ConduitIO#1)
* fix imports * add github workflows, linting, and license * add docker-compose, take out integration tag * add makefile * delete multierror import from conduit..delete mock * use matryer/is instead of assert * add codeowners, dependapot and pull reuqest template * mini fixes * add go.mod * delete generate * pin postgres docker image to version 11 * remove second postgres container (optimize) * make different tests use different table names * rename docker compose file * add postgres healthcheck Co-authored-by: Lovro Mažgon <[email protected]>
1 parent 711464b commit 825d89d

27 files changed

+1068
-238
lines changed

.github/CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @ConduitIO/conduit-core

.github/dependabot.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Docs: https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates
2+
version: 2
3+
updates:
4+
5+
# Maintain dependencies for GitHub Actions
6+
- package-ecosystem: "github-actions"
7+
directory: "/"
8+
schedule:
9+
interval: "daily"
10+
commit-message:
11+
prefix: ".github:"
12+
13+
# Maintain dependencies for Go
14+
- package-ecosystem: "gomod"
15+
directory: "/"
16+
schedule:
17+
interval: "daily"
18+
commit-message:
19+
prefix: "go.mod:"

.github/pull_request_template.md

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
### Description
2+
3+
Please include a summary of the change and what type of change it is (new feature, bug fix, refactoring, documentation).
4+
Please also include relevant motivation and context.
5+
List any dependencies that are required for this change.
6+
7+
Fixes # (issue)
8+
9+
### Quick checks:
10+
11+
- [ ] I have followed the [Code Guidelines](https://github.com/ConduitIO/conduit/blob/main/docs/code_guidelines.md).
12+
- [ ] There is no other [pull request](https://github.com/ConduitIO/conduit-connector-postgres/pulls) for the same update/change.
13+
- [ ] I have written unit tests.
14+
- [ ] I have made sure that the PR is of reasonable size and can be easily reviewed.

.github/workflows/build.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: build
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
14+
- name: Set up Go
15+
uses: actions/setup-go@v2
16+
with:
17+
go-version: 1.17
18+
19+
- name: Test
20+
run: make test GOTEST_FLAGS="-v -count=1"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# This action automatically merges dependabot PRs that update go dependencies (only patch and minor updates).
2+
# Based on: https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/automating-dependabot-with-github-actions#enable-auto-merge-on-a-pull-request
3+
4+
name: Dependabot auto-merge
5+
on:
6+
pull_request:
7+
# Run this action when dependabot labels the PR, we care about the 'go' label.
8+
types: [labeled]
9+
10+
permissions:
11+
pull-requests: write
12+
contents: write
13+
14+
jobs:
15+
dependabot-go:
16+
runs-on: ubuntu-latest
17+
if: ${{ github.actor == 'dependabot[bot]' && contains(github.event.pull_request.labels.*.name, 'go') }}
18+
steps:
19+
- name: Dependabot metadata
20+
id: metadata
21+
uses: dependabot/[email protected]
22+
with:
23+
github-token: "${{ secrets.GITHUB_TOKEN }}"
24+
25+
- name: Approve PR
26+
# Approve only patch and minor updates
27+
if: ${{ steps.metadata.outputs.update-type != 'version-update:semver-major' }}
28+
run: gh pr review --approve "$PR_URL"
29+
env:
30+
PR_URL: ${{ github.event.pull_request.html_url }}
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
33+
- name: Enable auto-merge for Dependabot PRs
34+
# Enable auto-merging only for patch and minor updates
35+
if: ${{ steps.metadata.outputs.update-type != 'version-update:semver-major' }}
36+
run: gh pr merge --auto --squash "$PR_URL"
37+
env:
38+
PR_URL: ${{ github.event.pull_request.html_url }}
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/lint.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: lint
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
8+
jobs:
9+
golangci-lint:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- name: golangci-lint
14+
uses: golangci/golangci-lint-action@v2
15+
with:
16+
version: v1.42.1

.golangci.goheader.template

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright © {{ YEAR }} Meroxa, Inc.
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.

.golangci.yml

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
linters-settings:
2+
gofmt:
3+
simplify: false
4+
govet:
5+
check-shadowing: false
6+
nolintlint:
7+
allow-unused: false # report any unused nolint directives
8+
require-explanation: true # require an explanation for nolint directives
9+
require-specific: true # require nolint directives to mention the specific linter being suppressed
10+
gocyclo:
11+
min-complexity: 20
12+
goconst:
13+
ignore-tests: true
14+
goheader:
15+
template-path: '.golangci.goheader.template'
16+
17+
linters:
18+
# please, do not use `enable-all`: it's deprecated and will be removed soon.
19+
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
20+
disable-all: true
21+
enable:
22+
- bodyclose
23+
- deadcode
24+
# - depguard
25+
- dogsled
26+
- durationcheck
27+
- errcheck
28+
- errname
29+
# - errorlint
30+
# - exhaustive
31+
# - exhaustivestruct
32+
- exportloopref
33+
# - forbidigo
34+
# - forcetypeassert
35+
# - funlen
36+
# - gochecknoinits
37+
- goconst
38+
- gocritic
39+
- gocyclo
40+
# - cyclop # not interested in package complexities at the moment
41+
# - godot
42+
- gofmt
43+
# - gofumpt
44+
- goheader
45+
- goimports
46+
- revive
47+
# - gomnd
48+
- gomoddirectives
49+
- gomodguard
50+
- goprintffuncname
51+
- gosec
52+
- gosimple
53+
- govet
54+
# - ifshort
55+
- ineffassign
56+
# - importas
57+
# - lll
58+
# - misspell
59+
- makezero
60+
# - nakedret
61+
# - nilerr
62+
# - nilnil
63+
# - nlreturn
64+
- noctx
65+
- nolintlint
66+
# - paralleltest
67+
- predeclared
68+
- rowserrcheck
69+
- staticcheck
70+
- structcheck
71+
- stylecheck
72+
- sqlclosecheck
73+
# - tagliatelle
74+
# - tenv
75+
# - thelper
76+
# - tparallel
77+
- typecheck
78+
- unconvert
79+
# - unparam
80+
- unused
81+
- varcheck
82+
- wastedassign
83+
- whitespace
84+
# - wrapcheck
85+
# - wsl
86+
87+
# don't enable:
88+
# - asciicheck
89+
# - dupl
90+
# - gochecknoglobals
91+
# - gocognit
92+
# - godox
93+
# - goerr113
94+
# - maligned
95+
# - nestif
96+
# - prealloc
97+
# - testpackage
98+
# - wsl

0 commit comments

Comments
 (0)