Initial commit: Pipeline Database
This commit is contained in:
250
.gitea/workflows/release.yml
Normal file
250
.gitea/workflows/release.yml
Normal file
@@ -0,0 +1,250 @@
|
||||
name: 发布流程
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: 发布前测试
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: 检出代码
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: 设置 Go 环境
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: 1.24.x
|
||||
|
||||
- name: 运行完整测试套件
|
||||
run: |
|
||||
go test -v -race -coverprofile=coverage.out ./...
|
||||
|
||||
- name: 运行基准测试验证
|
||||
run: |
|
||||
go test -bench=. -benchtime=1s -run=^$ ./...
|
||||
|
||||
- name: 检查测试覆盖率
|
||||
run: |
|
||||
COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | sed 's/%//')
|
||||
echo "测试覆盖率: ${COVERAGE}%"
|
||||
if (( $(echo "$COVERAGE < 80" | bc -l) )); then
|
||||
echo "❌ 测试覆盖率低于 80%,无法发布"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
build:
|
||||
name: 构建发布包
|
||||
runs-on: ubuntu-latest
|
||||
needs: test
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- goos: linux
|
||||
goarch: amd64
|
||||
- goos: linux
|
||||
goarch: arm64
|
||||
- goos: darwin
|
||||
goarch: amd64
|
||||
- goos: darwin
|
||||
goarch: arm64
|
||||
- goos: windows
|
||||
goarch: amd64
|
||||
|
||||
steps:
|
||||
- name: 检出代码
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: 设置 Go 环境
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: 1.24.x
|
||||
|
||||
- name: 获取版本信息
|
||||
id: version
|
||||
run: |
|
||||
VERSION=${GITHUB_REF#refs/tags/}
|
||||
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
|
||||
echo "发布版本: $VERSION"
|
||||
|
||||
- name: 构建示例程序
|
||||
env:
|
||||
GOOS: ${{ matrix.goos }}
|
||||
GOARCH: ${{ matrix.goarch }}
|
||||
CGO_ENABLED: 0
|
||||
run: |
|
||||
VERSION=${{ steps.version.outputs.VERSION }}
|
||||
LDFLAGS="-s -w -X main.version=$VERSION"
|
||||
|
||||
mkdir -p dist/${{ matrix.goos }}_${{ matrix.goarch }}
|
||||
|
||||
# 构建所有示例程序
|
||||
cd examples/basic-usage
|
||||
go build -ldflags="$LDFLAGS" -o ../../dist/${{ matrix.goos }}_${{ matrix.goarch }}/basic-usage${{ matrix.goos == 'windows' && '.exe' || '' }} .
|
||||
|
||||
cd ../group-management
|
||||
go build -ldflags="$LDFLAGS" -o ../../dist/${{ matrix.goos }}_${{ matrix.goarch }}/group-management${{ matrix.goos == 'windows' && '.exe' || '' }} .
|
||||
|
||||
cd ../external-handler
|
||||
go build -ldflags="$LDFLAGS" -o ../../dist/${{ matrix.goos }}_${{ matrix.goarch }}/external-handler${{ matrix.goos == 'windows' && '.exe' || '' }} .
|
||||
|
||||
cd ../data-analytics
|
||||
go build -ldflags="$LDFLAGS" -o ../../dist/${{ matrix.goos }}_${{ matrix.goarch }}/data-analytics${{ matrix.goos == 'windows' && '.exe' || '' }} .
|
||||
|
||||
cd ../concurrent-processing
|
||||
go build -ldflags="$LDFLAGS" -o ../../dist/${{ matrix.goos }}_${{ matrix.goarch }}/concurrent-processing${{ matrix.goos == 'windows' && '.exe' || '' }} .
|
||||
|
||||
cd ../high-concurrency
|
||||
go build -ldflags="$LDFLAGS" -o ../../dist/${{ matrix.goos }}_${{ matrix.goarch }}/high-concurrency${{ matrix.goos == 'windows' && '.exe' || '' }} .
|
||||
|
||||
- name: 创建发布包
|
||||
run: |
|
||||
cd dist/${{ matrix.goos }}_${{ matrix.goarch }}
|
||||
|
||||
# 复制文档文件
|
||||
cp ../../README.md .
|
||||
cp ../../LICENSE .
|
||||
cp -r ../../examples .
|
||||
|
||||
# 创建压缩包
|
||||
if [ "${{ matrix.goos }}" = "windows" ]; then
|
||||
zip -r ../pipelinedb-${{ steps.version.outputs.VERSION }}-${{ matrix.goos }}-${{ matrix.goarch }}.zip .
|
||||
else
|
||||
tar -czf ../pipelinedb-${{ steps.version.outputs.VERSION }}-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz .
|
||||
fi
|
||||
|
||||
- name: 上传构建产物
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: pipelinedb-${{ steps.version.outputs.VERSION }}-${{ matrix.goos }}-${{ matrix.goarch }}
|
||||
path: dist/pipelinedb-${{ steps.version.outputs.VERSION }}-${{ matrix.goos }}-${{ matrix.goarch }}.*
|
||||
|
||||
release:
|
||||
name: 创建发布
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
|
||||
steps:
|
||||
- name: 检出代码
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: 获取版本信息
|
||||
id: version
|
||||
run: |
|
||||
VERSION=${GITHUB_REF#refs/tags/}
|
||||
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: 下载所有构建产物
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
path: release-assets
|
||||
|
||||
- name: 生成发布说明
|
||||
run: |
|
||||
VERSION=${{ steps.version.outputs.VERSION }}
|
||||
|
||||
cat > release_notes.md << EOF
|
||||
# Pipeline Database $VERSION
|
||||
|
||||
## 🚀 新特性
|
||||
|
||||
- 基于页面的高性能存储引擎
|
||||
- 支持分组数据管理和统计
|
||||
- Hot → Warm → Cold 三级数据状态流转
|
||||
- 自定义 Handler 接口支持
|
||||
- 高并发线程安全操作
|
||||
- 内置页面缓存系统
|
||||
|
||||
## 📊 性能指标
|
||||
|
||||
- 并发写入:~1,900 QPS
|
||||
- 缓存操作:~7,700,000 QPS
|
||||
- 索引操作:~6,200,000 QPS
|
||||
- 支持 TB 级数据存储
|
||||
|
||||
## 📦 下载
|
||||
|
||||
选择适合您系统的版本:
|
||||
|
||||
- **Linux (x64)**: pipelinedb-$VERSION-linux-amd64.tar.gz
|
||||
- **Linux (ARM64)**: pipelinedb-$VERSION-linux-arm64.tar.gz
|
||||
- **macOS (Intel)**: pipelinedb-$VERSION-darwin-amd64.tar.gz
|
||||
- **macOS (Apple Silicon)**: pipelinedb-$VERSION-darwin-arm64.tar.gz
|
||||
- **Windows (x64)**: pipelinedb-$VERSION-windows-amd64.zip
|
||||
|
||||
## 🛠️ 快速开始
|
||||
|
||||
\`\`\`bash
|
||||
# 安装
|
||||
go get code.tczkiot.com/wlw/pipelinedb@$VERSION
|
||||
|
||||
# 运行示例
|
||||
./basic-usage
|
||||
\`\`\`
|
||||
|
||||
## 📚 文档
|
||||
|
||||
- [README](https://code.tczkiot.com/wlw/pipelinedb/src/branch/main/README.md)
|
||||
- [示例代码](https://code.tczkiot.com/wlw/pipelinedb/src/branch/main/examples)
|
||||
- [API 文档](https://pkg.go.dev/code.tczkiot.com/wlw/pipelinedb)
|
||||
|
||||
## 🔄 更新日志
|
||||
|
||||
查看完整的更新日志和技术细节,请参考 [CHANGELOG.md](https://code.tczkiot.com/wlw/pipelinedb/src/branch/main/CHANGELOG.md)
|
||||
EOF
|
||||
|
||||
- name: 创建 GitHub Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
name: Pipeline Database ${{ steps.version.outputs.VERSION }}
|
||||
body_path: release_notes.md
|
||||
files: |
|
||||
release-assets/**/*.tar.gz
|
||||
release-assets/**/*.zip
|
||||
draft: false
|
||||
prerelease: false
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
docker:
|
||||
name: 构建 Docker 镜像
|
||||
runs-on: ubuntu-latest
|
||||
needs: test
|
||||
|
||||
steps:
|
||||
- name: 检出代码
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: 获取版本信息
|
||||
id: version
|
||||
run: |
|
||||
VERSION=${GITHUB_REF#refs/tags/}
|
||||
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: 设置 Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: 登录 Docker Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: 构建并推送 Docker 镜像
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: |
|
||||
bourdon/pipelinedb:${{ steps.version.outputs.VERSION }}
|
||||
bourdon/pipelinedb:latest
|
||||
labels: |
|
||||
org.opencontainers.image.title=Pipeline Database
|
||||
org.opencontainers.image.description=集成数据库存储和业务管道处理的一体化解决方案
|
||||
org.opencontainers.image.version=${{ steps.version.outputs.VERSION }}
|
||||
org.opencontainers.image.source=https://code.tczkiot.com/wlw/pipelinedb
|
||||
Reference in New Issue
Block a user