-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MINOR: Primitive implementation of Go OM client (#1)
* feature: primitive implementation of OM Go client * chore: implemented workflow gh actions
- Loading branch information
Showing
17 changed files
with
917 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Label when interacting with go client | ||
go-client: | ||
- "openmetadata-go-client/**/*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<!-- | ||
Thank you for your contribution! | ||
Unless your change is trivial, please create an issue to discuss the change before creating a PR. | ||
--> | ||
|
||
### Describe your changes: | ||
|
||
Fixes <issue-number> | ||
|
||
<!-- | ||
Short blurb explaining: | ||
- What changes did you make? | ||
- Why did you make them? | ||
- How did you test your changes? | ||
--> | ||
|
||
I worked on ... because ... | ||
|
||
<!-- For frontend related change, please add screenshots and/or videos of your changes preview! --> | ||
|
||
# | ||
### Type of change: | ||
<!-- You should choose 1 option and delete options that aren't relevant --> | ||
- [ ] Bug fix | ||
- [ ] Improvement | ||
- [ ] New feature | ||
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) | ||
- [ ] Documentation | ||
|
||
# | ||
### Checklist: | ||
<!-- add an x in [] if done, don't mark items that you didn't do !--> | ||
- [x] I have read the [**CONTRIBUTING**](https://docs.open-metadata.org/developers/contribute) document. | ||
- [ ] My PR title is `[Fixes <issue-number>|MINOR]: <short explanation>` | ||
- [ ] I have commented on my code, particularly in hard-to-understand areas. | ||
- [ ] For JSON Schema changes: I updated the migration scripts or explained why it is not needed. | ||
|
||
<!-- Based on the type(s) of your change, uncomment the required checklist 👇 --> | ||
|
||
<!-- Bug fix | ||
- [ ] I have added a test that covers the exact scenario we are fixing. For complex issues, comment the issue number in the test for future reference. | ||
--> | ||
|
||
<!-- Improvement | ||
- [ ] I have added tests around the new logic. | ||
- [ ] For connector/ingestion changes: I updated the documentation. | ||
--> | ||
|
||
<!-- New feature | ||
- [ ] The issue properly describes why the new feature is needed, what's the goal, and how we are building it. Any discussion | ||
or decision-making process is reflected in the issue. | ||
- [ ] I have updated the documentation. | ||
- [ ] I have added tests around the new logic. | ||
--> | ||
|
||
<!-- Breaking change | ||
- [ ] I have added the tag `Backward-Incompatible-Change`. | ||
--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Add here any member that should belong to either a specific team, | ||
# or that can have the tests automatically validated to run safely. | ||
|
||
"safe to test": | ||
- '@ayush-shah' | ||
- '@OnkarVO7' | ||
- '@TeddyCr' | ||
- '@ulixius9' | ||
- '@pmbrull' | ||
- '@aniketkatkar97' | ||
- '@Ashish8689' | ||
- '@chirag-madlani' | ||
- '@Sachin-chaurasiya' | ||
- '@shahsank3t' | ||
- '@ShaileshParmar11' | ||
- '@karanh37' | ||
- '@harshach' | ||
- '@mohityadav766' | ||
- '@sureshms' | ||
- '@akash-jain-10' | ||
- '@dhruvinmaniar123' | ||
- '@ShilpaVernekar' | ||
- '@07Himank' | ||
- '@Anuj359' | ||
- '@tutte' | ||
- '@snyk-bot' | ||
- '@dependabot' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
name: go-tests | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
- 'v[0-9]+.[0-9]+.[0-9]+' | ||
pull_request_target: | ||
types: [labeled, opened, synchronize, reopened] | ||
paths: | ||
- "openmetadata-go-client/**" | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
go-version: [1.21.x] | ||
steps: | ||
# begin: setup | ||
# TODO: Extra into action composition https://docs.github.com/en/actions/creating-actions/creating-a-composite-action | ||
- name: Free Disk Space (Ubuntu) | ||
uses: jlumbroso/free-disk-space@main | ||
with: | ||
tool-cache: false | ||
android: true | ||
dotnet: true | ||
haskell: true | ||
large-packages: false | ||
swap-storage: true | ||
docker-images: false | ||
- name: Wait for the labeler | ||
uses: lewagon/wait-on-check-action@v1.3.3 | ||
if: ${{ github.event_name == 'pull_request_target' }} | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
check-name: Team Label | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
wait-interval: 90 | ||
- name: Verify PR labels | ||
uses: jesusvasquez333/verify-pr-label-action@v1.4.0 | ||
if: ${{ github.event_name == 'pull_request_target' }} | ||
with: | ||
github-token: '${{ secrets.GITHUB_TOKEN }}' | ||
valid-labels: 'safe to test' | ||
pull-request-number: '${{ github.event.pull_request.number }}' | ||
disable-reviews: true # To not auto approve changes | ||
- name: Checkout OM Repo | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: open-metadata/OpenMetadata | ||
path: open-metadata | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.10 | ||
- name: Install Ubuntu dependencies | ||
run: | | ||
sudo apt-get update && sudo apt-get install -y unixodbc-dev python3-venv librdkafka-dev gcc libsasl2-dev build-essential libssl-dev libffi-dev \ | ||
unixodbc-dev libevent-dev python3-dev libkrb5-dev | ||
- name: Generate models | ||
run: | | ||
cd open-metadata | ||
python3 -m venv env | ||
source env/bin/activate | ||
sudo make install_antlr_cli | ||
make install_dev generate | ||
- name: Install open-metadata dependencies | ||
run: | | ||
cd open-metadata | ||
source env/bin/activate | ||
make install_all install_test | ||
- name: Start Server and Ingest Sample Data | ||
uses: nick-fields/retry@v2.8.3 | ||
env: | ||
INGESTION_DEPENDENCY: "mysql,elasticsearch" | ||
with: | ||
timeout_minutes: 60 | ||
max_attempts: 2 | ||
retry_on: error | ||
command: cd open-metadata && ./docker/run_local_docker.sh -m no-ui | ||
# end: setup | ||
|
||
- uses: actions/checkout@v4 | ||
- name: Setup Go ${{ matrix.go-version }} | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
- name: Get dependencies | ||
run: | | ||
make go_install_tools | ||
- name: Run tests | ||
run: | | ||
make go_tests_ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Labeler | ||
|
||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
- reopened | ||
- edited | ||
- synchronize | ||
|
||
jobs: | ||
pr-labels: | ||
# Job to assign PR labels | ||
name: pr-labels | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Assign labels | ||
uses: actions/labeler@v4 | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
configuration-path: .github/labels.yml | ||
sync-labels: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
on: | ||
pull_request_target: | ||
|
||
permissions: | ||
contents: read | ||
pull-requests: write | ||
|
||
name: Team Label | ||
jobs: | ||
labeler: | ||
runs-on: ubuntu-latest | ||
name: Team Label | ||
steps: | ||
- uses: JulienKode/team-labeler-action@v0.1.1 | ||
with: | ||
repo-token: "${{ secrets.GITHUB_TOKEN }}" | ||
|
||
- name: Verify PR labels | ||
id: verify | ||
continue-on-error: true | ||
uses: jesusvasquez333/verify-pr-label-action@v1.4.0 | ||
with: | ||
github-token: '${{ secrets.GITHUB_TOKEN }}' | ||
valid-labels: 'safe to test' | ||
pull-request-number: '${{ github.event.pull_request.number }}' | ||
disable-reviews: true # To not auto approve changes | ||
|
||
- name: Add verification comment | ||
if: steps.verify.outcome != 'success' | ||
uses: peter-evans/create-or-update-comment@v1 | ||
with: | ||
issue-number: ${{ github.event.pull_request.number }} | ||
body: | | ||
**Hi there 👋 Thanks for your contribution!** | ||
The OpenMetadata team will review the PR shortly! Once it has been labeled as `safe to test`, the CI workflows | ||
will start executing and we'll be able to make sure everything is working as expected. | ||
Let us know if you need any help! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.DEFAULT_GOAL := help | ||
include openmetadata-go-client/Makefile | ||
|
||
.PHONY: help | ||
help: | ||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":"}; {printf "\033[35m%-35s\033[0m %s\n", $$2, $$3}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# If you prefer the allow list template instead of the deny list, see community template: | ||
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore | ||
# | ||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
|
||
# Test binary, built with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# Dependency directories (remove the comment below to include it) | ||
# vendor/ | ||
|
||
# Go workspace file | ||
go.work |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
DIRECTORY_NAME := $(notdir $(CURDIR)) | ||
GO_DIRECTORY := openmetadata-go-client | ||
|
||
ifeq (openmetadata-go-client,$(DIRECTORY_NAME)) | ||
ROOT_DIR := .. | ||
else | ||
ROOT_DIR := . | ||
endif | ||
|
||
|
||
.PHONY: go_install_tools | ||
go_install_tools: ## Install go tools | ||
@echo "Installing go tools" | ||
go install github.com/mgechev/revive@latest | ||
go install golang.org/x/tools/cmd/cover@latest | ||
|
||
.PHONY: go_unit_tests | ||
go_unit_tests: ## Run go unit tests | ||
cd $(ROOT_DIR)/$(GO_DIRECTORY) && go test -v -cover ./... | ||
|
||
.PHONY: go_all_tests | ||
go_all_tests: ## Run go integration tests | ||
cd $(ROOT_DIR)/$(GO_DIRECTORY) && go test -v -cover -tags=integration ./... | ||
|
||
.PHONY: go_check_format | ||
go_check_format: ## Run go format check | ||
revive -formatter friendly $(ROOT_DIR)/$(GO_DIRECTORY)/... | ||
gofmt -l -d $(ROOT_DIR)/$(GO_DIRECTORY)/ | ||
|
||
.PHONY: go_code_format | ||
go_code_format: ## Run go code format | ||
gofmt -w $(ROOT_DIR)/$(GO_DIRECTORY)/ | ||
|
||
.PHONY: go_check_format_ci | ||
go_check_format_ci: ## Run go format check for CI/CD. Returns non-zero exit code if there are formatting issues | ||
files=$$(revive -formatter friendly $(ROOT_DIR)/$(GO_DIRECTORY)/...) && [ -z "$$files" ] | ||
files=$$(gofmt -l $(ROOT_DIR)/$(GO_DIRECTORY)/) && [ -z "$$files" ] | ||
|
||
.PHONY: go_tests | ||
go_tests: ## Run go tests | ||
$(MAKE) go_check_format | ||
$(MAKE) go_all_tests | ||
|
||
.PHONY: go_tests_ci | ||
go_tests_ci: ## Run go tests for CI/CD | ||
$(MAKE) go_check_format_ci | ||
$(MAKE) go_all_tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module github.com/open-metadata/openmetadata-sdk/openmetadata-go-client | ||
|
||
go 1.21 | ||
|
||
require github.com/stretchr/testify v1.8.4 | ||
|
||
require ( | ||
github.com/davecgh/go-spew v1.1.1 // indirect | ||
github.com/pmezard/go-difflib v1.0.0 // indirect | ||
gopkg.in/yaml.v3 v3.0.1 // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= | ||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= | ||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | ||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= | ||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= | ||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= | ||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= | ||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= |
Oops, something went wrong.