Skip to content

Commit

Permalink
Initial Amazon SQS Connector (#1)
Browse files Browse the repository at this point in the history
* Initial Amazon SQS Connector Draft

* nit attributes

* Add readme

* Add tests, cleanup, seperate configs for src and dest

* lint

* Update go.mod

* linter

* Remove token, cleanup

* lint

* Update .golangci.yml

* test config

* update readme and makefile

* Update README.md

* Update .golangci.yml

* Update .golangci.yml

* lint lint

* lint lint

* more updates on src + dst + lint

* sleep?

* Update some tests and config files

* source test update

* draft

* remove go:generate statement

---------

Co-authored-by: Lovro Mažgon <[email protected]>
  • Loading branch information
anna-cross and lovromazgon authored Dec 18, 2023
1 parent 61da971 commit 8156a30
Show file tree
Hide file tree
Showing 32 changed files with 1,877 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Define code owners (individuals or teams that are responsible for code in this repository)
# More about code owners at https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
* @conduitio-labs/conduit-core
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/1-feature-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: 🚀 Feature Request
description: Request a new feature.
title: "Feature: <title>"
labels: [feature, triage]
body:
- type: textarea
attributes:
label: Feature description
description: A clear and concise description of what you want to happen and what problem will this solve.
validations:
required: true
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/2-bug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: 🐛 Bug
description: Report a bug.
title: "Bug: <title>"
labels: [bug, triage]
body:
- type: textarea
attributes:
label: Bug description
description: A concise description of what you're experiencing and what you expected to happen instead.
validations:
required: true
- type: textarea
attributes:
label: Steps to reproduce
description: Steps to reproduce the behavior.
placeholder: |
1. In this environment...
2. With this config...
3. Run '...'
4. See error...
validations:
required: true
- type: input
attributes:
label: Version
description: "Version of connector"
placeholder: v0.1.0 darwin/amd64
validations:
required: true
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: true
contact_links:
- name: ❓ Ask a Question
url: https://github.com/ConduitIO/conduit/discussions
about: Please ask and answer questions here.
19 changes: 19 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Docs: https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates
version: 2
updates:

# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
commit-message:
prefix: ".github:"

# Maintain dependencies for Go
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"
commit-message:
prefix: "go.mod:"
13 changes: 13 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
### Description

Please include a summary of the change and what type of change it is (new feature, bug fix, refactoring, documentation).
Please also include relevant motivation and context.
List any dependencies that are required for this change.

Fixes # (issue)

### Quick checks:

- [ ] There is no other [pull request](https://github.com/conduitio-labs/conduit-connector-sqs/pulls) for the same update/change.
- [ ] I have written unit tests.
- [ ] I have made sure that the PR is of reasonable size and can be easily reviewed.
24 changes: 24 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: build

on:
push:
branches: [ main ]
pull_request:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
- name: Test
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_MESSAGE_DELAY: ${{ secrets.AWS_MESSAGE_DELAY }}
AWS_VISIBILITY: ${{ secrets.AWS_VISIBILITY }}
run: make test
39 changes: 39 additions & 0 deletions .github/workflows/dependabot-auto-merge-go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This action automatically merges dependabot PRs that update go dependencies (only patch and minor updates).
# 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

name: Dependabot auto-merge
on:
pull_request:
# Run this action when dependabot labels the PR, we care about the 'go' label.
types: [labeled]

permissions:
pull-requests: write
contents: write

jobs:
dependabot-go:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' && contains(github.event.pull_request.labels.*.name, 'go') }}
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/[email protected]
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

- name: Approve PR
# Approve only patch and minor updates
if: ${{ steps.metadata.outputs.update-type != 'version-update:semver-major' }}
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Enable auto-merge for Dependabot PRs
# Enable auto-merging only for patch and minor updates
if: ${{ steps.metadata.outputs.update-type != 'version-update:semver-major' }}
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20 changes: 20 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: lint

on:
push:
branches: [ main ]
pull_request:

jobs:
golangci-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
- name: golangci-lint
uses: golangci/[email protected]
with:
version: v1.55.2
args: --timeout=2m
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: release

on:
push:
tags:
- v*

permissions:
contents: write

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
*.out

# Dependency directories (remove the comment below to include it)
# vendor/
vendor/

# Go workspace file
go.work

/connectors/conduit-connector-sqs
conduit-connector-sqs
13 changes: 13 additions & 0 deletions .golangci.goheader.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright © {{ copyright-year }} Meroxa, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
106 changes: 106 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
linters-settings:
gofmt:
simplify: false
govet:
check-shadowing: false
nolintlint:
allow-unused: false # report any unused nolint directives
require-explanation: true # require an explanation for nolint directives
require-specific: true # require nolint directives to mention the specific linter being suppressed
gocyclo:
min-complexity: 20
goconst:
ignore-tests: true
goheader:
template-path: '.golangci.goheader.template'
values:
regexp:
copyright-year: 20[2-9]\d

issues:
exclude-rules:
- path: _test\.go
linters:
- dogsled
- gosec
- revive

linters:
# please, do not use `enable-all`: it's deprecated and will be removed soon.
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
disable-all: true
enable:
- bodyclose
# - depguard
- dogsled
- durationcheck
- errcheck
- errname
# - errorlint
# - exhaustive
# - exhaustivestruct
- exportloopref
# - forbidigo
# - forcetypeassert
# - funlen
# - gochecknoinits
- goconst
- gocritic
- gocyclo
# - cyclop # not interested in package complexities at the moment
# - godot
- gofmt
# - gofumpt
- goheader
- goimports
- revive
# - gomnd
- gomoddirectives
- gomodguard
- goprintffuncname
- gosec
- gosimple
- govet
# - ifshort
- ineffassign
# - importas
# - lll
# - misspell
- makezero
# - nakedret
# - nilerr
# - nilnil
# - nlreturn
- noctx
- nolintlint
# - paralleltest
- predeclared
- rowserrcheck
- staticcheck
- stylecheck
- sqlclosecheck
# - tagliatelle
# - tenv
# - thelper
# - tparallel
- typecheck
- unconvert
# - unparam
- unused
- wastedassign
- whitespace
# - wrapcheck
# - wsl

# don't enable:
# - asciicheck
# - dupl
# - gochecknoglobals
# - gocognit
# - godox
# - goerr113
# - maligned
# - nestif
# - prealloc
# - testpackage
# - wsl
30 changes: 30 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
builds:
- main: ./cmd/connector/main.go
goos:
- darwin
- linux
- windows
env:
- CGO_ENABLED=0
ldflags:
- "-s -w -X 'github.com/conduitio-labs/conduit-connector-sqs.version={{ .Tag }}'"
checksum:
name_template: checksums.txt
archives:
- name_template: >-
{{ .ProjectName }}_
{{- .Version }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
changelog:
sort: asc
use: github
filters:
exclude:
- '^docs:'
- '^test:'
- '^go.mod:'
- '^.github:'
- Merge branch
19 changes: 19 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
VERSION=$(shell git describe --tags --dirty --always)
.PHONY:
build:
go build -ldflags "-X 'github.com/conduitio-labs/conduit-connector-sqs.version=${VERSION}'" -o conduit-connector-sqs cmd/connector/main.go

.PHONY:
test:
go test $(GOTEST_FLAGS) -race -v ./...

.PHONY: golangci-lint-install
golangci-lint-install:
go install github.com/golangci/golangci-lint/cmd/golangci-lint

.PHONY:
lint:
golangci-lint run

install-paramgen:
go install github.com/conduitio/conduit-connector-sdk/cmd/paramgen@latest
Loading

0 comments on commit 8156a30

Please sign in to comment.