-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
84 changed files
with
18,869 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,12 @@ | ||
# Folders | ||
.git | ||
.github/ | ||
.postgres/ | ||
docs/ | ||
|
||
# Files | ||
.dockerignore | ||
.gitignore | ||
docker-compose.yml | ||
Dockerfile | ||
README.md |
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,19 @@ | ||
root = true | ||
|
||
[*.proto] | ||
indent_size = 2 | ||
indent_style = space | ||
insert_final_newline = true | ||
|
||
[*.yaml] | ||
indent_size = 2 | ||
indent_style = space | ||
insert_final_newline = true | ||
|
||
[*.go] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 4 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = 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,144 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
env: | ||
STORE_PATH: "" | ||
|
||
jobs: | ||
build-test: | ||
name: Build Test | ||
runs-on: "ubuntu-latest" | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: "^1.22.0" | ||
cache: true | ||
|
||
- name: Setup Go Cache PATH | ||
id: go-cache-paths | ||
run: | | ||
echo "go-build=$(go env GOCACHE)" >> $GITHUB_OUTPUT | ||
echo "go-mod=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT | ||
- name: Go Build Cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.go-cache-paths.outputs.go-build }} | ||
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }} | ||
|
||
- name: Go Mod Cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.go-cache-paths.outputs.go-mod }} | ||
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }} | ||
|
||
- name: Test Build | ||
run: go build ./... | ||
|
||
ent_check: | ||
name: Check entgo.io codegen | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: "^1.22.0" | ||
- uses: ent/contrib/ci@master | ||
|
||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: "^1.22.0" | ||
cache: true | ||
|
||
- uses: actions/checkout@v3 | ||
- name: golangci-lint | ||
uses: golangci/[email protected] | ||
with: | ||
# Optional: golangci-lint command line arguments. | ||
version: v1.56.2 | ||
args: "--timeout=10m" | ||
|
||
unittest: | ||
name: Unit Test | ||
runs-on: ubuntu-latest | ||
|
||
services: | ||
# Label used to access the service container | ||
postgres: | ||
# Docker Hub image | ||
image: postgres | ||
# Provide the password for postgres | ||
env: | ||
POSTGRES_PASSWORD: "123456" | ||
# Set health checks to wait until postgres has started | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
ports: | ||
# Maps tcp port 5432 on service container to the host | ||
- 5432:5432 | ||
# Label used to access the service container | ||
redis: | ||
# Docker Hub image | ||
image: redis | ||
# Set health checks to wait until redis has started | ||
options: >- | ||
--health-cmd "redis-cli ping" | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
ports: | ||
# Maps tcp port 6379 on service container to the host | ||
- 6379:6379 | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: "^1.22.0" | ||
cache: true | ||
|
||
# Get values for cache paths to be used in later steps | ||
- name: Setup Go Cache PATH | ||
id: go-cache-paths | ||
run: | | ||
echo "go-build=$(go env GOCACHE)" >> $GITHUB_OUTPUT | ||
echo "go-mod=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT | ||
# Cache go build cache, used to speedup go test | ||
- name: Go Build Cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.go-cache-paths.outputs.go-build }} | ||
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }} | ||
|
||
# Cache go mod cache, used to speedup builds | ||
- name: Go Mod Cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.go-cache-paths.outputs.go-mod }} | ||
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }} | ||
|
||
- name: Unit tests | ||
run: | | ||
go test ./... -coverprofile=coverage.out -covermode=atomic -p=1 | ||
go tool cover -func coverage.out |
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,49 @@ | ||
name: Release Build | ||
|
||
on: | ||
push: | ||
tags: | ||
- "**" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
hub_build: | ||
name: Build for Docker Hub | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Fetch version | ||
id: version | ||
run: | | ||
export LAST_TAGGED_COMMIT=$(git rev-list --tags --max-count=1) | ||
export LAST_TAG=$(git describe --tags $LAST_TAGGED_COMMIT) | ||
echo "version=${LAST_TAG#v}" >> $GITHUB_OUTPUT | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
platforms: linux/amd64,linux/arm64 | ||
|
||
- name: Sign in to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.DOCKER_ACCESS_TOKEN }} | ||
|
||
- name: Create image tags | ||
id: dockerinfo | ||
run: | | ||
echo "taglatest=${{ github.repository }}:latest" >> $GITHUB_OUTPUT | ||
echo "tag=${{ github.repository }}:${{ steps.version.outputs.version }}" >> $GITHUB_OUTPUT | ||
- name: Build and Push | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: ./ | ||
file: ./Dockerfile | ||
push: true | ||
no-cache: false | ||
tags: | | ||
${{ steps.dockerinfo.outputs.taglatest }} | ||
${{ steps.dockerinfo.outputs.tag }} |
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,37 @@ | ||
name: Unstable Build | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
hub_build: | ||
name: Build for Docker Hub | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
platforms: linux/amd64,linux/arm64 | ||
|
||
- name: Sign in to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.DOCKER_ACCESS_TOKEN }} | ||
|
||
- name: Create image tags | ||
id: dockerinfo | ||
run: | | ||
echo "tagunstable=${{ github.repository }}:unstable" >> $GITHUB_OUTPUT | ||
- name: Build and Push | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: ./ | ||
file: ./Dockerfile | ||
push: true | ||
no-cache: false | ||
tags: | | ||
${{ steps.dockerinfo.outputs.tagunstable }} |
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,72 @@ | ||
# IDE | ||
.idea/ | ||
|
||
# Created by https://www.gitignore.io/api/visualstudiocode | ||
# Edit at https://www.gitignore.io/?templates=visualstudiocode | ||
|
||
### VisualStudioCode ### | ||
# Maybe .vscode/**/* instead - see comments | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
|
||
### VisualStudioCode Patch ### | ||
# Ignore all local history of files | ||
**/.history | ||
|
||
# End of https://www.gitignore.io/api/visualstudiocode | ||
|
||
# Build / Release | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
*.db | ||
*.bin | ||
*.tar.gz | ||
/release/ | ||
|
||
# Runtime / Compile Temporary Assets | ||
vendor/ | ||
logs/ | ||
|
||
# Credentials | ||
cert*/ | ||
*.pem | ||
*.crt | ||
*.cer | ||
*.key | ||
*.p12 | ||
|
||
# Test binary, build with `go test -c` | ||
*.test | ||
cover* | ||
coverage* | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# macOS | ||
.DS_Store | ||
|
||
# Configurations | ||
config.yaml | ||
config.yml | ||
.env | ||
|
||
# Local Configuration | ||
config.local.yaml | ||
|
||
# Temporary | ||
temp/ | ||
.cache | ||
.temp | ||
|
||
# Local pgSQL db | ||
.postgres/ | ||
|
||
# Debug | ||
__debug* |
Oops, something went wrong.