chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,299 @@
|
||||
name: CI
|
||||
on:
|
||||
pull_request:
|
||||
branches: ['main']
|
||||
paths:
|
||||
- 'github/**'
|
||||
- 'idl/**'
|
||||
- 'frontend/**'
|
||||
- 'common/**'
|
||||
- 'rush.json'
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
actions: read
|
||||
|
||||
jobs:
|
||||
setup:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- NodeVersion: 22.16.0
|
||||
NodeVersionDisplayName: 22
|
||||
OS: ubuntu-latest
|
||||
name: Setup and Install Dependencies
|
||||
runs-on: ${{ matrix.OS }}
|
||||
outputs:
|
||||
cache_file: ${{ steps.process-files.outputs.cache_file }}
|
||||
matrix_node_version: ${{ matrix.NodeVersion }}
|
||||
matrix_os: ${{ matrix.OS }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v45
|
||||
|
||||
- name: Process changed files
|
||||
id: process-files
|
||||
run: |
|
||||
# Get all change files
|
||||
all_files="${{ steps.changed-files.outputs.all_changed_files }}"
|
||||
|
||||
# Filter out files in the common/changes directory
|
||||
filtered_files=""
|
||||
for file in $all_files; do
|
||||
if [[ ! "$file" =~ ^common/changes/.* ]]; then
|
||||
if [ -z "$filtered_files" ]; then
|
||||
filtered_files="$file"
|
||||
else
|
||||
filtered_files="$filtered_files $file"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# Create cached files in JSON format
|
||||
echo "[$( echo "$filtered_files" | sed 's/ /", "/g' | sed 's/^/"/' | sed 's/$/"/' )]" > changed-files-cache.json
|
||||
|
||||
# Output cache file path for subsequent steps
|
||||
echo "cache_file=changed-files-cache.json" >> $GITHUB_OUTPUT
|
||||
|
||||
echo "过滤前文件数量: $(echo $all_files | wc -w)"
|
||||
echo "过滤后文件数量: $(echo $filtered_files | wc -w)"
|
||||
echo "已生成缓存文件: changed-files-cache.json"
|
||||
|
||||
- name: Config Git User
|
||||
# should be turn to ci user
|
||||
run: |
|
||||
git config --local user.name "flow_bot"
|
||||
git config --local user.email "flow_bot@bytedance.com"
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.NodeVersion }}
|
||||
|
||||
- name: Upload changed files cache
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: changed-files-cache
|
||||
path: changed-files-cache.json
|
||||
retention-days: 1
|
||||
|
||||
build:
|
||||
needs: setup
|
||||
runs-on: ${{ needs.setup.outputs.matrix_os }}
|
||||
name: Increment Build
|
||||
env:
|
||||
BUILD_BRANCH: ${{ github.head_ref || github.ref_name }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ needs.setup.outputs.matrix_node_version }}
|
||||
|
||||
- name: Cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
common/temp/pnpm-local
|
||||
common/temp/pnpm-store
|
||||
common/temp/install-run
|
||||
key: ${{ runner.os }}-rush-store-${{ hashFiles('common/config/subspaces/**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-rush-store-main
|
||||
${{ runner.os }}-rush-store
|
||||
|
||||
- name: Download changed files cache
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: changed-files-cache
|
||||
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libasound2-dev
|
||||
node common/scripts/install-run-rush.js install --to tag:core
|
||||
node common/scripts/install-run-rush.js update-autoinstaller --name plugins
|
||||
node common/scripts/install-run-rush.js increment --action install -p "${{ needs.setup.outputs.cache_file }}"
|
||||
|
||||
- name: Increment Build
|
||||
run: node common/scripts/install-run-rush.js increment --action build -p "${{ needs.setup.outputs.cache_file }}"
|
||||
|
||||
test:
|
||||
needs: setup
|
||||
runs-on: ${{ needs.setup.outputs.matrix_os }}
|
||||
name: Increment Test Coverage
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ needs.setup.outputs.matrix_node_version }}
|
||||
|
||||
- name: Cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
common/temp/pnpm-local
|
||||
common/temp/pnpm-store
|
||||
common/temp/install-run
|
||||
key: ${{ runner.os }}-rush-store-${{ hashFiles('common/config/subspaces/**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-rush-store-main
|
||||
${{ runner.os }}-rush-store
|
||||
|
||||
- name: Download changed files cache
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: changed-files-cache
|
||||
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libasound2-dev
|
||||
node common/scripts/install-run-rush.js install --to tag:core
|
||||
node common/scripts/install-run-rush.js update-autoinstaller --name plugins
|
||||
node common/scripts/install-run-rush.js increment --action install -p "${{ needs.setup.outputs.cache_file }}"
|
||||
|
||||
- name: Increment Test:cov
|
||||
run: node common/scripts/install-run-rush.js increment --action test:cov -p "${{ needs.setup.outputs.cache_file }}"
|
||||
|
||||
# TODO: should resolve later
|
||||
# - name: Upload coverage reports
|
||||
# uses: codecov/codecov-action@v4
|
||||
# with:
|
||||
# token: ${{ secrets.CODECOV_TOKEN }}
|
||||
# fail_ci_if_error: true
|
||||
# verbose: true
|
||||
|
||||
lint:
|
||||
needs: setup
|
||||
runs-on: ${{ needs.setup.outputs.matrix_os }}
|
||||
name: Increment Lint
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ needs.setup.outputs.matrix_node_version }}
|
||||
|
||||
- name: Cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
common/temp/pnpm-local
|
||||
common/temp/pnpm-store
|
||||
common/temp/install-run
|
||||
key: ${{ runner.os }}-rush-store-${{ hashFiles('common/config/subspaces/**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-rush-store-main
|
||||
${{ runner.os }}-rush-store
|
||||
|
||||
- name: Download changed files cache
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: changed-files-cache
|
||||
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libasound2-dev
|
||||
node common/scripts/install-run-rush.js install --to tag:core
|
||||
node common/scripts/install-run-rush.js update-autoinstaller --name plugins
|
||||
node common/scripts/install-run-rush.js increment --action install -p "${{ needs.setup.outputs.cache_file }}"
|
||||
|
||||
- name: Increment Lint
|
||||
run: node common/scripts/install-run-rush.js increment --action lint -p "${{ needs.setup.outputs.cache_file }}"
|
||||
|
||||
ts-check:
|
||||
needs: setup
|
||||
runs-on: ${{ needs.setup.outputs.matrix_os }}
|
||||
name: Increment TS Check
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ needs.setup.outputs.matrix_node_version }}
|
||||
|
||||
- name: Cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
common/temp/pnpm-local
|
||||
common/temp/pnpm-store
|
||||
common/temp/install-run
|
||||
key: ${{ runner.os }}-rush-store-${{ hashFiles('common/config/subspaces/**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-rush-store-main
|
||||
${{ runner.os }}-rush-store
|
||||
|
||||
- name: Download changed files cache
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: changed-files-cache
|
||||
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libasound2-dev
|
||||
node common/scripts/install-run-rush.js install --to tag:core
|
||||
node common/scripts/install-run-rush.js update-autoinstaller --name plugins
|
||||
node common/scripts/install-run-rush.js increment --action install -p "${{ needs.setup.outputs.cache_file }}"
|
||||
|
||||
- name: Increment TS Check
|
||||
run: node common/scripts/install-run-rush.js increment --action ts-check -p "${{ needs.setup.outputs.cache_file }}"
|
||||
|
||||
package-audit:
|
||||
needs: setup
|
||||
runs-on: ${{ needs.setup.outputs.matrix_os }}
|
||||
name: Increment Package Audit
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ needs.setup.outputs.matrix_node_version }}
|
||||
|
||||
- name: Cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
common/temp/pnpm-local
|
||||
common/temp/pnpm-store
|
||||
common/temp/install-run
|
||||
key: ${{ runner.os }}-rush-store-${{ hashFiles('common/config/subspaces/**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-rush-store-main
|
||||
${{ runner.os }}-rush-store
|
||||
|
||||
- name: Download changed files cache
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: changed-files-cache
|
||||
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libasound2-dev
|
||||
node common/scripts/install-run-rush.js install --to tag:core
|
||||
node common/scripts/install-run-rush.js update-autoinstaller --name plugins
|
||||
node common/scripts/install-run-rush.js increment --action install -p "${{ needs.setup.outputs.cache_file }}"
|
||||
|
||||
- name: Increment Package Audit
|
||||
run: node common/scripts/install-run-rush.js increment --action package-audit -p "${{ needs.setup.outputs.cache_file }}"
|
||||
@@ -0,0 +1,125 @@
|
||||
name: Backend Tests
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'backend/**'
|
||||
- 'docker/atlas/**'
|
||||
- '.github/workflows/ci@backend.yml'
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'backend/**'
|
||||
- 'docker/atlas/**'
|
||||
- '.github/workflows/ci@backend.yml'
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
|
||||
env:
|
||||
DEFAULT_GO_VERSION: "1.24"
|
||||
|
||||
jobs:
|
||||
backend-unit-test:
|
||||
name: backend-unit-test
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
repository-projects: write
|
||||
env:
|
||||
COVERAGE_FILE: coverage.out
|
||||
BREAKDOWN_FILE: main.breakdown
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.DEFAULT_GO_VERSION }}
|
||||
|
||||
# - name: Shutdown Ubuntu MySQL
|
||||
# run: service mysql stop
|
||||
|
||||
- name: Set Up MySQL
|
||||
uses: mirromutth/mysql-action@v1.1
|
||||
with:
|
||||
host port: 3306
|
||||
container port: 3306
|
||||
character set server: 'utf8mb4'
|
||||
collation server: 'utf8mb4_general_ci'
|
||||
mysql version: '8.4.5'
|
||||
mysql database: 'opencoze'
|
||||
mysql root password: 'root'
|
||||
|
||||
- name: Verify MySQL Startup
|
||||
run: |
|
||||
echo "Waiting for MySQL to be ready..."
|
||||
for i in {1..60}; do
|
||||
if cat /proc/net/tcp | grep 0CEA; then
|
||||
echo "MySQL port 3306 is listening!"
|
||||
break
|
||||
fi
|
||||
echo "Waiting for MySQL port... ($i/60)"
|
||||
sleep 1
|
||||
done
|
||||
echo "Final verification: MySQL port 3306 is accessible"
|
||||
|
||||
- name: Install MySQL Client
|
||||
run: sudo apt-get update && sudo apt-get install -y mysql-client
|
||||
|
||||
- name: Initialize Database
|
||||
uses: nick-fields/retry@v3
|
||||
with:
|
||||
timeout_minutes: 10
|
||||
max_attempts: 20
|
||||
command: mysql -h 127.0.0.1 -P 3306 -u root -proot opencoze < docker/volumes/mysql/schema.sql
|
||||
|
||||
- name: Run Go Test
|
||||
run: |
|
||||
modules=`find . -name "go.mod" -exec dirname {} \;`
|
||||
echo $modules
|
||||
list=""
|
||||
coverpkg=""
|
||||
if [[ ! -f "go.work" ]];then go work init;fi
|
||||
for module in $modules; do go work use $module; list=$module"/... "$list; coverpkg=$module"/...,"$coverpkg; done
|
||||
go work sync
|
||||
go test -race -v -coverprofile=${{ env.COVERAGE_FILE }} -gcflags="all=-l -N" -coverpkg=$coverpkg $list
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v5
|
||||
with:
|
||||
name: coze-studio-backend
|
||||
env_vars: GOLANG,Coze-Studio,BACKEND
|
||||
fail_ci_if_error: 'false'
|
||||
files: ${{ env.COVERAGE_FILE }}
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
- name: Shutdown MySQL
|
||||
if: always()
|
||||
continue-on-error: true
|
||||
run: docker rm -f $(docker ps -q --filter "ancestor=mysql:8.4.5")
|
||||
benchmark-test:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
repository-projects: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.DEFAULT_GO_VERSION }}
|
||||
|
||||
- name: Run Go Benchmark
|
||||
run: |
|
||||
modules=`find . -name "go.mod" -exec dirname {} \;`
|
||||
echo $modules
|
||||
list=""
|
||||
coverpkg=""
|
||||
if [[ ! -f "go.work" ]];then go work init;fi
|
||||
for module in $modules; do go work use $module; list=$module"/... "$list; coverpkg=$module"/...,"$coverpkg; done
|
||||
go work sync
|
||||
go test -race -v -bench=. -benchmem -run=none -gcflags="all=-l -N" $list
|
||||
@@ -0,0 +1,76 @@
|
||||
# should be optimize as increment build & test
|
||||
name: CI@main
|
||||
on:
|
||||
push:
|
||||
# test only
|
||||
branches: ['main',"chore/setup-ci"]
|
||||
paths:
|
||||
- 'github/**'
|
||||
- 'idl/**'
|
||||
- 'frontend/**'
|
||||
- 'common/**'
|
||||
- 'rush.json'
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- NodeVersion: 22.16.0
|
||||
NodeVersionDisplayName: 22
|
||||
OS: ubuntu-latest
|
||||
name: Node.js v${{ matrix.NodeVersionDisplayName }} (${{ matrix.OS }})
|
||||
runs-on: ${{ matrix.OS }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Config Git User
|
||||
# should be turn to ci user
|
||||
run: |
|
||||
git config --local user.name "flow_bot"
|
||||
git config --local user.email "flow_bot@bytedance.com"
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.NodeVersion }}
|
||||
|
||||
- name: Cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
common/temp/pnpm-local
|
||||
common/temp/pnpm-store
|
||||
common/temp/install-run
|
||||
key: ${{ runner.os }}-rush-store-main
|
||||
restore-keys: |
|
||||
${{ runner.os }}-rush-store-main
|
||||
${{ runner.os }}-rush-store
|
||||
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libasound2-dev
|
||||
node common/scripts/install-run-rush.js install
|
||||
|
||||
- name: Build all
|
||||
run: node common/scripts/install-run-rush.js build --verbose
|
||||
|
||||
- name: Test:cov all
|
||||
run: node common/scripts/install-run-rush.js test:cov --verbose
|
||||
|
||||
- name: Upload coverage reports
|
||||
uses: codecov/codecov-action@v4
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
fail_ci_if_error: true
|
||||
verbose: true
|
||||
|
||||
- name: Lint all
|
||||
run: node common/scripts/install-run-rush.js lint --verbose
|
||||
@@ -0,0 +1,48 @@
|
||||
name: Claude PR Assistant
|
||||
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
pull_request_review_comment:
|
||||
types: [created]
|
||||
issues:
|
||||
types: [opened, assigned]
|
||||
pull_request_review:
|
||||
types: [submitted]
|
||||
|
||||
jobs:
|
||||
claude-code-action:
|
||||
if: |
|
||||
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
|
||||
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
|
||||
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
|
||||
(github.event_name == 'issues' && contains(github.event.issue.body, '@claude'))
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
issues: read
|
||||
id-token: write
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Run Claude PR Action
|
||||
uses: anthropics/claude-code-action@beta
|
||||
with:
|
||||
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
|
||||
# Or use OAuth token instead:
|
||||
# claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
||||
timeout_minutes: '60'
|
||||
# mode: tag # Default: responds to @claude mentions
|
||||
# Optional: Restrict network access to specific domains only
|
||||
# experimental_allowed_domains: |
|
||||
# .anthropic.com
|
||||
# .github.com
|
||||
# api.github.com
|
||||
# .githubusercontent.com
|
||||
# bun.sh
|
||||
# registry.npmjs.org
|
||||
# .blob.core.windows.net
|
||||
@@ -0,0 +1,48 @@
|
||||
name: PR Common Checks
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'github/**'
|
||||
- 'idl/**'
|
||||
- 'frontend/**'
|
||||
- 'common/**'
|
||||
- 'rush.json'
|
||||
types: [opened, edited, synchronize, reopened]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
common-checks:
|
||||
name: PR Common Checks
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Config Git User
|
||||
run: |
|
||||
git config --local user.name "flow_bot"
|
||||
git config --local user.email "flow_bot@bytedance.com"
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 22.16.0
|
||||
|
||||
- name: Install Dependencies
|
||||
run: node common/scripts/install-run-rush.js install
|
||||
|
||||
# PR Title Format Check
|
||||
- name: Check PR Title Format
|
||||
if: ${{ !contains(github.event.pull_request.title, 'WIP') && !contains(github.event.pull_request.title, 'wip') }}
|
||||
env:
|
||||
PR_TITLE: ${{ github.event.pull_request.title }}
|
||||
run: |
|
||||
node common/scripts/install-run-rush.js update-autoinstaller --name rush-commitlint && \
|
||||
pushd common/autoinstallers/rush-commitlint && \
|
||||
echo "$PR_TITLE" | npx commitlint --config commitlint.config.js && \
|
||||
popd
|
||||
|
||||
# Add more common checks here
|
||||
# For example: file size checks, specific file format validations, etc.
|
||||
@@ -0,0 +1,70 @@
|
||||
name: Thrift Syntax Validation
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ['main']
|
||||
paths:
|
||||
- 'idl/**'
|
||||
- '.github/workflows/idl.yaml'
|
||||
pull_request:
|
||||
branches: ['main']
|
||||
paths:
|
||||
- 'idl/**'
|
||||
- '.github/workflows/idl.yaml'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
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,38 @@
|
||||
name: License Check
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ['main']
|
||||
pull_request:
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
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,74 @@
|
||||
name: Semantic Pull Request
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- reopened
|
||||
- edited
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.number }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
pull-requests: read
|
||||
|
||||
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
|
||||
comment
|
||||
ci
|
||||
|
||||
# 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
|
||||
Reference in New Issue
Block a user