chore(.github): add github ci
This commit is contained in:
parent
c03ecb8d7e
commit
a016ca92e7
|
|
@ -0,0 +1,25 @@
|
|||
header:
|
||||
license:
|
||||
spdx-id: Apache-2.0
|
||||
copyright-owner: coze-dev
|
||||
|
||||
paths:
|
||||
- '**/*.go'
|
||||
- frontend/apps/**/*.{ts,tsx}
|
||||
- frontend/packages/**/*.{ts,tsx}
|
||||
paths-ignore:
|
||||
- 'dist'
|
||||
- 'licenses'
|
||||
- '**/*.md'
|
||||
- '**/testdata/**'
|
||||
- '**/go.mod'
|
||||
- '**/go.sum'
|
||||
- 'LICENSE'
|
||||
- 'NOTICE'
|
||||
- '**/assets/languages.yaml'
|
||||
- '**/assets/assets.gen.go'
|
||||
- '**/gorm_gen/**'
|
||||
- '**/kitex_gen/**'
|
||||
- '**/*.gen.go'
|
||||
files:
|
||||
- ../backend/go.mod
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Version:**
|
||||
|
||||
Please provide the version of {project_name} you are using.
|
||||
|
||||
**Environment:**
|
||||
|
||||
The output of `go env`.
|
||||
|
||||
**Additional context**
|
||||
|
||||
Add any other context about the problem here.
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
|
||||
Add any other context or screenshots about the feature request here.
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
#### What type of PR is this?
|
||||
<!--
|
||||
Add one of the following kinds:
|
||||
|
||||
build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
|
||||
ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
|
||||
docs: Documentation only changes
|
||||
feat: A new feature
|
||||
optimize: A new optimization
|
||||
fix: A bug fix
|
||||
perf: A code change that improves performance
|
||||
refactor: A code change that neither fixes a bug nor adds a feature
|
||||
style: Changes that do not affect the meaning of the code (white space, formatting, missing semi-colons, etc)
|
||||
test: Adding missing tests or correcting existing tests
|
||||
chore: Changes to the build process or auxiliary tools and libraries such as documentation generation
|
||||
-->
|
||||
|
||||
#### Check the PR title.
|
||||
<!--
|
||||
The description of the title will be attached in Release Notes,
|
||||
so please describe it from user-oriented, what this PR does / why we need it.
|
||||
Please check your PR title with the below requirements:
|
||||
-->
|
||||
- [ ] This PR title match the format: \<type\>(optional scope): \<description\>
|
||||
- [ ] The description of this PR title is user-oriented and clear enough for others to understand.
|
||||
- [ ] Add documentation if the current PR requires user awareness at the usage level.
|
||||
|
||||
|
||||
#### (Optional) Translate the PR title into Chinese.
|
||||
|
||||
|
||||
#### (Optional) More detailed description for this PR(en: English/zh: Chinese).
|
||||
<!--
|
||||
Provide more detailed info for review(e.g., it's recommended to provide perf data if this is a perf type PR).
|
||||
-->
|
||||
en:
|
||||
zh(optional):
|
||||
|
||||
|
||||
#### (Optional) Which issue(s) this PR fixes:
|
||||
<!--
|
||||
Automatically closes linked issue when PR is merged.
|
||||
Eg: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
|
||||
-->
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
name: Thrift Syntax Validation
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ['main']
|
||||
paths:
|
||||
- 'idl/**'
|
||||
- '.github/workflows/idl.yaml'
|
||||
pull_request:
|
||||
branches: ['main']
|
||||
paths:
|
||||
- 'idl/**'
|
||||
- '.github/workflows/idl.yaml'
|
||||
|
||||
jobs:
|
||||
validate-thrift:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: '1.21'
|
||||
|
||||
- name: Install kitex tools
|
||||
run: |
|
||||
go install github.com/cloudwego/thriftgo@v0.4.1
|
||||
go install github.com/cloudwego/kitex/tool/cmd/kitex@v0.13.1
|
||||
go install github.com/cloudwego/thrift-gen-validator@v0.2.6
|
||||
|
||||
- name: Validate Thrift Files via kitex
|
||||
run: |
|
||||
# Initialize error flag
|
||||
ERROR_FOUND=0
|
||||
|
||||
# Create temporary working directory
|
||||
TEMP_DIR=$(mktemp -d)
|
||||
echo "Created temporary working directory: $TEMP_DIR"
|
||||
|
||||
# Initialize go mod in temp directory
|
||||
cd "$TEMP_DIR"
|
||||
go mod init dummy
|
||||
|
||||
# Find all thrift files and validate them
|
||||
while IFS= read -r -d '' thrift_file; do
|
||||
echo "Validating $thrift_file..."
|
||||
if ! kitex -streamx -thrift ignore_initialisms=false -module=dummy "$thrift_file" 2>&1; then
|
||||
echo "IDL gen code error in file: $thrift_file"
|
||||
ERROR_FOUND=1
|
||||
fi
|
||||
done < <(find "$GITHUB_WORKSPACE/idl" -name '*.thrift' -print0)
|
||||
|
||||
# Clean up temporary directory
|
||||
cd "$GITHUB_WORKSPACE"
|
||||
rm -rf "$TEMP_DIR"
|
||||
echo "Cleaned up temporary working directory"
|
||||
|
||||
# Exit with appropriate status
|
||||
if [ $ERROR_FOUND -eq 1 ]; then
|
||||
echo "Thrift validation failed. Please check the errors above."
|
||||
exit 1
|
||||
else
|
||||
echo "All Thrift files validated successfully!"
|
||||
exit 0
|
||||
fi
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
name: License Check
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ['main']
|
||||
pull_request:
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
license-check:
|
||||
name: License Check
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.23
|
||||
|
||||
- name: Install license-eye
|
||||
run: |
|
||||
go install github.com/apache/skywalking-eyes/cmd/license-eye@v0.4.0
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: License Header Check
|
||||
run: |
|
||||
license-eye header check -c .github/.licenserc.yaml
|
||||
|
||||
- name: License Dependency Check
|
||||
run: |
|
||||
license-eye dependency check -c .github/.licenserc.yaml
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
name: Semantic Pull Request
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- reopened
|
||||
- edited
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.number }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
main:
|
||||
name: Check Pull Request Title
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: amannn/action-semantic-pull-request@v5.5.2
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
# see https://github.com/angular/angular/blob/22b96b9/CONTRIBUTING.md#type
|
||||
types: |
|
||||
build
|
||||
ci
|
||||
docs
|
||||
feat
|
||||
fix
|
||||
perf
|
||||
refactor
|
||||
style
|
||||
test
|
||||
chore
|
||||
# idl: idl
|
||||
# infra:
|
||||
# - go version update, lint, database, etc
|
||||
# - rush update, {eslint,ts,vitest}-config, prettier etc
|
||||
# frontend
|
||||
# backend
|
||||
# workflow: gh workflow
|
||||
# prompt, evaluation, trace, model, dataset, foundation
|
||||
scopes: |
|
||||
idl
|
||||
frontend
|
||||
backend
|
||||
infra
|
||||
app
|
||||
singleagent
|
||||
memory
|
||||
search
|
||||
workflow
|
||||
prompt
|
||||
knowledge
|
||||
plugin
|
||||
middleware
|
||||
model
|
||||
database
|
||||
foundation
|
||||
|
||||
# The pull request's title should be fulfilled the following pattern:
|
||||
#
|
||||
# [<type>][<optional scope>] <description>
|
||||
#
|
||||
# ... where valid types and scopes can be found above; for example:
|
||||
#
|
||||
# [fix][test] flaky test V1_ProxyAuthenticationTest.anonymousSocketTest
|
||||
headerPattern: '^\[(\w*?)\](?:\[(.*?)\])?(?:\s*)(.*)$'
|
||||
headerPatternCorrespondence: type, scope, subject
|
||||
|
|
@ -40,6 +40,13 @@ import (
|
|||
"github.com/cloudwego/hertz/pkg/common/ut"
|
||||
"github.com/cloudwego/hertz/pkg/protocol"
|
||||
"github.com/cloudwego/hertz/pkg/protocol/sse"
|
||||
"github.com/redis/go-redis/v9"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.uber.org/mock/gomock"
|
||||
"gorm.io/driver/mysql"
|
||||
"gorm.io/gorm"
|
||||
|
||||
modelknowledge "github.com/coze-dev/coze-studio/backend/api/model/crossdomain/knowledge"
|
||||
plugin2 "github.com/coze-dev/coze-studio/backend/api/model/crossdomain/plugin"
|
||||
pluginmodel "github.com/coze-dev/coze-studio/backend/api/model/crossdomain/plugin"
|
||||
|
|
@ -76,8 +83,8 @@ import (
|
|||
"github.com/coze-dev/coze-studio/backend/domain/workflow/entity"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/entity/vo"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/service"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/modelmgr"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/coderunner"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/modelmgr"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/impl/checkpoint"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/impl/coderunner/direct"
|
||||
mockCrossUser "github.com/coze-dev/coze-studio/backend/internal/mock/crossdomain/crossuser"
|
||||
|
|
@ -93,12 +100,6 @@ import (
|
|||
"github.com/coze-dev/coze-studio/backend/pkg/sonic"
|
||||
"github.com/coze-dev/coze-studio/backend/types/consts"
|
||||
"github.com/coze-dev/coze-studio/backend/types/errno"
|
||||
"github.com/redis/go-redis/v9"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.uber.org/mock/gomock"
|
||||
"gorm.io/driver/mysql"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type wfTestRunner struct {
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ func initModelByEnv(wd, templatePath string) (modelEntities []*modelmgr.Model, e
|
|||
modelEntity.Meta.ConnConfig.Model = info.modelID
|
||||
modelEntity.Meta.ConnConfig.APIKey = info.apiKey
|
||||
modelEntity.Meta.ConnConfig.BaseURL = info.baseURL
|
||||
|
||||
|
||||
modelEntities = append(modelEntities, modelEntity)
|
||||
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -29,10 +29,11 @@ import (
|
|||
|
||||
"github.com/bytedance/mockey"
|
||||
"github.com/cloudwego/eino/schema"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/coderunner"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/mock/gomock"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/coderunner"
|
||||
|
||||
userentity "github.com/coze-dev/coze-studio/backend/domain/user/entity"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/crossdomain/code"
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import (
|
|||
"strings"
|
||||
|
||||
einoCompose "github.com/cloudwego/eino/compose"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/crossdomain/database"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/crossdomain/knowledge"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/crossdomain/model"
|
||||
|
|
|
|||
|
|
@ -23,9 +23,10 @@ import (
|
|||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/coderunner"
|
||||
"golang.org/x/exp/maps"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/coderunner"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/entity/vo"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/internal/nodes"
|
||||
"github.com/coze-dev/coze-studio/backend/pkg/ctxcache"
|
||||
|
|
|
|||
|
|
@ -21,10 +21,11 @@ import (
|
|||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/coderunner"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/mock/gomock"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/coderunner"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/entity/vo"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/internal/nodes"
|
||||
mockcode "github.com/coze-dev/coze-studio/backend/internal/mock/domain/workflow/crossdomain/code"
|
||||
|
|
|
|||
|
|
@ -458,6 +458,9 @@ services:
|
|||
container_name: coze-mysql-setup-schema
|
||||
profiles: ['middleware', 'mysql-setup', 'run-server']
|
||||
env_file: *env_file
|
||||
depends_on:
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
volumes:
|
||||
- ./atlas/opencoze_latest_schema.hcl:/opencoze_latest_schema.hcl
|
||||
entrypoint:
|
||||
|
|
@ -493,6 +496,9 @@ services:
|
|||
container_name: coze-mysql-setup-init-sql
|
||||
profiles: ['middleware', 'mysql-setup', 'run-server', 'volcano-setup']
|
||||
env_file: *env_file
|
||||
depends_on:
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
|
|
|
|||
Loading…
Reference in New Issue