Skip to content

Commit

Permalink
chore: fork for open source
Browse files Browse the repository at this point in the history
  • Loading branch information
siyul-park committed Nov 20, 2023
0 parents commit 3b997b8
Show file tree
Hide file tree
Showing 166 changed files with 19,397 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/codecov.yml
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
13 changes: 13 additions & 0 deletions .github/renovate.json
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"]
}
]
}
99 changes: 99 additions & 0 deletions .github/workflows/check.yml
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
38 changes: 38 additions & 0 deletions .gitignore
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
75 changes: 75 additions & 0 deletions Makefile
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
99 changes: 99 additions & 0 deletions README.md
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
14 changes: 14 additions & 0 deletions cmd/flag/convert.go
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]
}
Loading

0 comments on commit 3b997b8

Please sign in to comment.