-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 89f1c78
Showing
167 changed files
with
19,418 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,11 @@ | ||
coverage: | ||
status: | ||
project: | ||
default: | ||
threshold: 1% | ||
patch: | ||
default: | ||
threshold: 1% | ||
|
||
comment: | ||
require_changes: 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,13 @@ | ||
{ | ||
"$schema": "https://docs.renovatebot.com/renovate-schema.json", | ||
"extends": ["config:base"], | ||
"baseBranches": ["main"], | ||
"branchPrefix": "dependency/", | ||
"rangeStrategy": "bump", | ||
"lockFileMaintenance": { "enabled": true }, | ||
"packageRules": [ | ||
{ | ||
"matchUpdateTypes": ["minor", "patch", "digest"] | ||
} | ||
] | ||
} |
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,99 @@ | ||
name: check | ||
|
||
concurrency: | ||
group: ${{ github.uniflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
on: ["push"] | ||
|
||
jobs: | ||
check: | ||
strategy: | ||
matrix: | ||
os: [ ubuntu-20.04, macos-latest ] | ||
go: [ '1.21' ] | ||
name: Check ${{ matrix.os }} @ Go ${{ matrix.go }} | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ matrix.go }} | ||
- uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cache/go-build | ||
~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- run: make init | ||
- run: make check test-options="-race --coverprofile=coverage.coverprofile --covermode=atomic" | ||
|
||
- name: Upload coverage to Codecov | ||
if: success() && matrix.go == '1.21' && matrix.os == 'ubuntu-20.04' | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
file: ./coverage.coverprofile | ||
fail_ci_if_error: false | ||
|
||
benchmark: | ||
needs: check | ||
strategy: | ||
matrix: | ||
os: [ ubuntu-20.04 ] | ||
go: [ '1.21' ] | ||
name: Benchmark comparison ${{ matrix.os }} @ Go ${{ matrix.go }} | ||
runs-on: ${{ matrix.os }} | ||
continue-on-error: true | ||
steps: | ||
- name: Maximize build space | ||
uses: easimon/maximize-build-space@master | ||
with: | ||
root-reserve-mb: 512 | ||
swap-size-mb: 1024 | ||
remove-dotnet: 'true' | ||
|
||
- name: Checkout Code (Previous) | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.base_ref }} | ||
path: previous | ||
|
||
- name: Checkout Code (New) | ||
uses: actions/checkout@v4 | ||
with: | ||
path: new | ||
|
||
- name: Set up Go ${{ matrix.go }} | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ matrix.go }} | ||
|
||
- name: Install Dependencies | ||
run: go install golang.org/x/perf/cmd/benchstat@latest | ||
|
||
- name: Init (Previous) | ||
run: | | ||
cd previous | ||
make init | ||
- name: Run Benchmark (Previous) | ||
run: | | ||
cd previous | ||
go test -run="-" -bench=".*" -count=7 ./... | tee benchmark.txt | ||
- name: Init (New) | ||
run: | | ||
cd new | ||
make init | ||
- name: Run Benchmark (New) | ||
run: | | ||
cd new | ||
go test -run="-" -bench=".*" -count=7 ./... | tee benchmark.txt | ||
- name: Run Benchstat | ||
run: benchstat previous/benchmark.txt new/benchmark.txt |
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,38 @@ | ||
# Created by https://www.toptal.com/developers/gitignore/api/go,intellij | ||
# Edit at https://www.toptal.com/developers/gitignore?templates=go,intellij | ||
|
||
### Go ### | ||
# 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 | ||
|
||
# Intellij | ||
.idea | ||
|
||
# VS Code | ||
.vscode | ||
|
||
# | ||
dist | ||
|
||
.*.toml | ||
|
||
.boot.yaml |
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 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 Ara Park | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,75 @@ | ||
-include .env | ||
|
||
PACKAGE := "github.com/siyul-park/uniflow" | ||
|
||
GO_PACKAGE := $(shell go list ${PACKAGE}/...) | ||
|
||
.PHONY: init | ||
init: | ||
@go install -v ${GO_PACKAGE} | ||
|
||
.PHONY: init-staticcheck | ||
init-staticcheck: | ||
@go install honnef.co/go/tools/cmd/staticcheck@latest | ||
|
||
.PHONY: init-godoc | ||
init-godoc: | ||
@go install golang.org/x/tools/cmd/godoc@latest | ||
|
||
.PHONY: generate | ||
generate: | ||
@go generate ${GO_PACKAGE} | ||
|
||
.PHONY: build | ||
build: | ||
@go clean -cache | ||
@mkdir -p dist | ||
@go build -o dist ./... | ||
|
||
.PHONY: clean | ||
clean: | ||
@go clean -cache | ||
@rm -rf dist | ||
|
||
.PHONY: tidy | ||
tidy: | ||
@go mod tidy | ||
|
||
.PHONY: check | ||
check: lint test | ||
|
||
.PHONY: test | ||
test: | ||
@go test $(test-options) ${GO_PACKAGE} | ||
|
||
.PHONY: race | ||
race: | ||
@go test -race $(test-options) ${GO_PACKAGE} | ||
|
||
.PHONY: coverage | ||
coverage: | ||
@go test -coverprofile coverage.out -covermode count ${GO_PACKAGE} | ||
@go tool cover -func=coverage.out | grep total | ||
|
||
.PHONY: benchmark | ||
benchmark: | ||
@go test -run="-" -bench=".*" -benchmem ${GO_PACKAGE} | ||
|
||
.PHONY: lint | ||
lint: fmt vet staticcheck | ||
|
||
.PHONY: vet | ||
vet: | ||
@go vet ${GO_PACKAGE} | ||
|
||
.PHONY: fmt | ||
fmt: | ||
@go fmt ${GO_PACKAGE} | ||
|
||
.PHONY: staticcheck | ||
staticcheck: init-staticcheck | ||
@staticcheck ${GO_PACKAGE} | ||
|
||
.PHONY: doc | ||
doc: init-godoc | ||
@godoc -http=:6060 |
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,99 @@ | ||
# uniflow | ||
|
||
[![go report][go_report_img]][go_report_url] | ||
[![code coverage][go_code_coverage_img]][go_code_coverage_url] | ||
[![check][repo_check_img]][repo_check_url] | ||
[![release][repo_releases_img]][repo_releases_url] | ||
|
||
> Create your uniflow and integrate it anywhere! | ||
Uniflow is a low-code engine for the backend. You can connect the nodes to create a flow and run it. | ||
|
||
## Getting Started | ||
### Installation | ||
First, [download][go_download_url] and install **Go**. Version `1.21` or higher is required. | ||
|
||
Clone the repository by using the `git clone` command: | ||
```shell | ||
git clone https://github.com/siyul-park/uniflow | ||
``` | ||
|
||
And then init the project: | ||
```shell | ||
cd uniflow | ||
make init | ||
``` | ||
|
||
### Build | ||
|
||
Build the project using the following command: | ||
```shell | ||
make build | ||
``` | ||
|
||
The build result is created in the `/dist`. | ||
```shell | ||
ls /dist | ||
uniflow | ||
``` | ||
|
||
If you want to test the project. then run the following command: | ||
```shell | ||
make test | ||
``` | ||
|
||
### Configuration | ||
Before use any command. You can configure environment variables. | ||
|
||
You can set environment variables to use `.uniflow.toml` or system environment variables. | ||
|
||
| TOML Key | Env Key | Default | | ||
|---|---|---| | ||
| database.url | DATABASE.URL | memdb:// | | ||
| database.name | DATABASE.NAME | | | ||
|
||
### Start | ||
|
||
Uniflow is now ready to be used. Let's start the [ping](/examples/ping.yaml). | ||
|
||
To start uniflow, using the following command: | ||
```shell | ||
./dist/uniflow start --boot example/ping.yaml | ||
``` | ||
`--boot` is install initially if the node does not exist in namespace. | ||
|
||
Let's check if the started uniflow is providing a http endpoint normally. | ||
```shell | ||
curl localhost:8000/ping | ||
pong# | ||
``` | ||
|
||
If you wish to apply nodes to a running server, use the `apply`. | ||
|
||
Run the following command for more information. | ||
```shell | ||
./dist/uniflow start --help | ||
``` | ||
|
||
<!-- Go --> | ||
|
||
[go_download_url]: https://golang.org/dl/ | ||
[go_version_img]: https://img.shields.io/badge/Go-1.21+-00ADD8?style=for-the-badge&logo=go | ||
[go_code_coverage_img]: https://codecov.io/gh/siyul-park/uniflow/graph/badge.svg?token=quEl9AbBcW | ||
[go_code_coverage_url]: https://codecov.io/gh/siyul-park/uniflow | ||
[go_report_img]: https://goreportcard.com/badge/github.com/siyul-park/uniflow | ||
[go_report_url]: https://goreportcard.com/report/github.com/siyul-park/uniflow | ||
|
||
<!-- Repository --> | ||
|
||
[repo_url]: https://github.com/siyul-park/uniflow | ||
[repo_issues_url]: https://github.com/siyul-park/uniflow/issues | ||
[repo_pull_request_url]: https://github.com/siyul-park/uniflow/pulls | ||
[repo_discussions_url]: https://github.com/siyul-park/uniflow/discussions | ||
[repo_releases_img]: https://img.shields.io/github/release/siyul-park/uniflow.svg | ||
[repo_releases_url]: https://github.com/siyul-park/uniflow/releases | ||
[repo_wiki_url]: https://github.com/siyul-park/uniflow/wiki | ||
[repo_wiki_img]: https://img.shields.io/badge/docs-wiki_page-blue?style=for-the-badge&logo=none | ||
[repo_wiki_faq_url]: https://github.com/siyul-park/uniflow/wiki/FAQ | ||
[repo_check_img]: https://github.com/siyual-park/uniflow/actions/uniflows/check.yml/badge.svg | ||
[repo_check_url]: https://github.com/siyual-park/uniflow/actions/uniflows/check.yml |
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,14 @@ | ||
package flag | ||
|
||
import "github.com/iancoleman/strcase" | ||
|
||
func ToKey(flag string) string { | ||
return strcase.ToSnake(flag) | ||
} | ||
|
||
func ToShorthand(flag string) string { | ||
if flag == "" { | ||
return "" | ||
} | ||
return flag[0:1] | ||
} |
Oops, something went wrong.