Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement command and reply #2

Merged
merged 39 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
4619451
Init
hariso Dec 8, 2023
56a3a9c
Add tools, main
hariso Dec 8, 2023
51a9cb5
fix workflow
hariso Dec 8, 2023
114c289
add serve
hariso Dec 8, 2023
eecf566
Implement command and reply
hariso Dec 11, 2023
5d064e8
add linter
hariso Dec 11, 2023
29124ee
go mod
hariso Dec 11, 2023
8bf700b
remove nolint
hariso Dec 13, 2023
591c663
linter fix
hariso Dec 13, 2023
b3ac25c
rename flags
hariso Dec 13, 2023
89f12c2
add import alias
hariso Dec 13, 2023
5118ab6
rename build tags, add comments
hariso Dec 13, 2023
f7d2f27
comments
hariso Dec 13, 2023
725f91c
comments
hariso Dec 13, 2023
bb5ec14
comments
hariso Dec 13, 2023
c9f44b6
add build tag
hariso Dec 19, 2023
348f7f7
add issue
hariso Dec 19, 2023
d025bb2
comments
hariso Dec 19, 2023
65b2453
rename
hariso Dec 19, 2023
d279597
comments
hariso Dec 19, 2023
2ca6a69
Update plugin.go
hariso Dec 20, 2023
ff14d8b
PR feedback, generate mock
hariso Dec 20, 2023
41b6273
Merge branch 'haris/init' of ssh://github.com/ConduitIO/conduit-proce…
hariso Dec 20, 2023
542f7e2
gh action for validating gen. files
hariso Dec 20, 2023
9cf2911
rename plugin to processor, add gh action to validate generated files
hariso Dec 20, 2023
97f5c64
bump version
hariso Dec 20, 2023
e4af863
rename serve to run
hariso Dec 20, 2023
75d4049
Merge branch 'haris/init' into haris/command-basics
hariso Dec 20, 2023
b8eb3ef
simplify package structure
hariso Dec 20, 2023
f12af89
rename
hariso Dec 20, 2023
fea0803
linter
hariso Dec 20, 2023
f23c47d
validate
hariso Dec 20, 2023
d5c9a81
linter
hariso Dec 20, 2023
fc5d142
remove unused fn
hariso Dec 20, 2023
bc63d1c
validate
hariso Dec 20, 2023
81bd741
Merge branch 'haris/init' into haris/command-basics
hariso Dec 20, 2023
4a417cc
Merge branch 'main' into haris/command-basics
hariso Dec 20, 2023
14ace42
Merge branch 'main' into haris/command-basics
hariso Jan 4, 2024
d9d7041
re-generate
hariso Jan 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/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 SDK"
placeholder: v0.1.0 darwin/amd64
validations:
required: true
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: true
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: "weekly"
commit-message:
prefix: ".github:"

# Maintain dependencies for Go
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "weekly"
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/conduit-processor-sdk/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.
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 }}
30 changes: 30 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
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'

# This step sets up the variable steps.golangci-lint-version.outputs.v
# to contain the version of golangci-lint (e.g. v1.54.2).
# The version is taken from go.mod.
- name: Golangci-lint version
id: golangci-lint-version
run: |
GOLANGCI_LINT_VERSION=$( go list -m -f '{{.Version}}' github.com/golangci/golangci-lint )
echo "v=$GOLANGCI_LINT_VERSION" >> "$GITHUB_OUTPUT"

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: ${{ steps.golangci-lint-version.outputs.v }}
skip-pkg-cache: true
20 changes: 20 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
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
run: make test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea/
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.
117 changes: 117 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
run:
timeout: 3m
build-tags:
- lint

linters-settings:
gofmt:
simplify: false
govet:
check-shadowing: false # TODO enable
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: '(.+)acceptance_testing\.go'
linters:
- stylecheck
text: "ST1003: should not use underscores in Go names"
# Exclude some linters from running on tests files.
- path: _test\.go
linters:
- dogsled
- gosec

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:
# We plan to enable all of the linters which are commented out.
# However, we want to enable them one by one (so we don't have to fix many issues at once).
lovromazgon marked this conversation as resolved.
Show resolved Hide resolved
- 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
21 changes: 21 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.PHONY: test
test:
go test $(GOTEST_FLAGS) -race ./...

.PHONY: lint
lint:
golangci-lint run

.PHONY: fmt
fmt:
gofumpt -l -w .

.PHONY: install-tools
install-tools:
@echo Installing tools from tools.go
@go list -e -f '{{ join .Imports "\n" }}' tools.go | xargs -tI % go install %
@go mod tidy

.PHONY: generate
generate:
go generate ./...
19 changes: 19 additions & 0 deletions command.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright © 2023 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.

package sdk

type Command struct {
lovromazgon marked this conversation as resolved.
Show resolved Hide resolved
Name string `json:"name"`
}
Loading
Loading