Skip to content

Commit d58d65d

Browse files
authored
Merge pull request #1848 from yutiansut/upgrade-2.1.0
feat: 更新setup.py和__init__.py以反映v2.1.0新特性
2 parents 8179021 + 4629b45 commit d58d65d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+9410
-2670
lines changed
Lines changed: 62 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,75 @@
1-
name: qa-community-rust-go docker
1+
# QUANTAXIS 2.1.0 Docker镜像构建和发布
2+
#
3+
# 触发条件:
4+
# - 推送到master分支
5+
# - 创建tag (v*.*.*)
6+
# - 手动触发
7+
#
8+
# 作者: @yutiansut @quantaxis
9+
10+
name: Build and Publish Docker Images
211

312
on:
413
push:
5-
# Publish `master` as Docker `latest` image.
614
branches:
715
- master
8-
9-
# Publish `v1.2.3` tags as releases.
16+
- develop
1017
tags:
11-
- v*
12-
13-
# Run tests for any PRs.
18+
- 'v*.*.*'
1419
pull_request:
20+
branches:
21+
- master
22+
workflow_dispatch:
1523

1624
env:
17-
# TODO: Change variable to your image's name.
18-
IMAGE_NAME: qa-community-rust-go
25+
REGISTRY: docker.io
26+
IMAGE_NAME: quantaxis/quantaxis
1927

2028
jobs:
21-
22-
# Push image to GitHub Packages.
23-
# See also https://docs.docker.com/docker-hub/builds/
24-
push:
25-
# Ensure test job passes before pushing image.
26-
27-
29+
# 测试任务
30+
test:
31+
name: Run Tests
2832
runs-on: ubuntu-latest
29-
if: github.event_name == 'push'
30-
3133
steps:
32-
- uses: actions/checkout@v2
33-
34-
- name: Build image
35-
run: cd docker/qa-community-rust/ && docker build . --file Dockerfile --tag $IMAGE_NAME
36-
37-
- name: Log into registry
38-
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
39-
40-
- name: Push image
41-
run: |
42-
IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME
43-
44-
# Change all uppercase to lowercase
45-
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
46-
47-
# Strip git ref prefix from version
48-
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
49-
50-
# Strip "v" prefix from tag name
51-
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
52-
53-
# Use Docker `latest` tag convention
54-
[ "$VERSION" == "master" ] && VERSION=latest
55-
56-
echo IMAGE_ID=$IMAGE_ID
57-
echo VERSION=$VERSION
58-
59-
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
60-
docker push $IMAGE_ID:$VERSION
34+
- name: Checkout代码
35+
uses: actions/checkout@v4
36+
37+
- name: 设置Python环境
38+
uses: actions/setup-python@v5
39+
with:
40+
python-version: '3.11'
41+
cache: 'pip'
42+
43+
- name: 运行兼容性验证
44+
run: python scripts/verify_compatibility.py
45+
46+
# 构建Docker镜像
47+
build:
48+
name: Build Docker Image
49+
needs: test
50+
runs-on: ubuntu-latest
51+
permissions:
52+
contents: read
53+
packages: write
54+
steps:
55+
- name: Checkout代码
56+
uses: actions/checkout@v4
57+
58+
- name: 设置Docker Buildx
59+
uses: docker/setup-buildx-action@v3
60+
61+
- name: 登录到Docker Hub
62+
if: github.event_name != 'pull_request'
63+
uses: docker/login-action@v3
64+
with:
65+
username: \${{ secrets.DOCKER_USERNAME }}
66+
password: \${{ secrets.DOCKER_PASSWORD }}
67+
68+
- name: 构建并推送Docker镜像
69+
uses: docker/build-push-action@v5
70+
with:
71+
context: .
72+
platforms: linux/amd64,linux/arm64
73+
push: \${{ github.event_name != 'pull_request' }}
74+
cache-from: type=gha
75+
cache-to: type=gha,mode=max
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# QUANTAXIS 文档自动构建与发布
2+
#
3+
# 功能说明:
4+
# - 当推送到master分支时自动触发
5+
# - 使用mdbook构建中文文档
6+
# - 发布到GitHub Pages
7+
#
8+
# 作者: @yutiansut @quantaxis
9+
# 更新日期: 2025-10-25
10+
11+
name: 部署mdbook文档
12+
13+
on:
14+
push:
15+
branches:
16+
- master
17+
paths:
18+
- 'doc/**'
19+
- 'book.toml'
20+
- '.github/workflows/mdbook-deploy.yml'
21+
workflow_dispatch:
22+
23+
# 设置GITHUB_TOKEN权限
24+
permissions:
25+
contents: read
26+
pages: write
27+
id-token: write
28+
29+
# 确保同一时间只运行一个部署任务
30+
concurrency:
31+
group: "pages"
32+
cancel-in-progress: false
33+
34+
jobs:
35+
# 构建文档
36+
build:
37+
name: 构建mdbook文档
38+
runs-on: ubuntu-latest
39+
40+
steps:
41+
- name: 检出代码
42+
uses: actions/checkout@v4
43+
with:
44+
fetch-depth: 0
45+
46+
- name: 安装mdbook
47+
run: |
48+
mkdir -p ~/bin
49+
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.40/mdbook-v0.4.40-x86_64-unknown-linux-gnu.tar.gz | tar -xz -C ~/bin
50+
echo "$HOME/bin" >> $GITHUB_PATH
51+
52+
- name: 安装mdbook插件
53+
run: |
54+
# mdbook-mermaid: 支持Mermaid图表
55+
cargo install mdbook-mermaid
56+
57+
# mdbook-toc: 生成目录
58+
cargo install mdbook-toc
59+
60+
# mdbook-linkcheck: 检查链接有效性
61+
cargo install mdbook-linkcheck
62+
63+
- name: 验证文档链接
64+
run: |
65+
mdbook build
66+
continue-on-error: true
67+
68+
- name: 构建mdbook
69+
run: mdbook build
70+
71+
- name: 上传构建产物
72+
uses: actions/upload-pages-artifact@v3
73+
with:
74+
path: ./book
75+
76+
# 部署到GitHub Pages
77+
deploy:
78+
name: 部署到GitHub Pages
79+
needs: build
80+
runs-on: ubuntu-latest
81+
82+
environment:
83+
name: github-pages
84+
url: ${{ steps.deployment.outputs.page_url }}
85+
86+
steps:
87+
- name: 部署到GitHub Pages
88+
id: deployment
89+
uses: actions/deploy-pages@v4
90+
91+
- name: 输出部署URL
92+
run: |
93+
echo "📚 文档已成功部署!"
94+
echo "🌐 访问地址: ${{ steps.deployment.outputs.page_url }}"

.github/workflows/qabook-build.yml

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
# QUANTAXIS QABook PDF自动编译与发布
2+
#
3+
# 功能说明:
4+
# - 当qabook/目录有更新时自动触发
5+
# - 使用XeLaTeX编译生成PDF
6+
# - 自动发布到GitHub Releases
7+
#
8+
# 作者: @yutiansut @quantaxis
9+
# 更新日期: 2025-10-25
10+
11+
name: 编译QABook PDF
12+
13+
on:
14+
push:
15+
branches:
16+
- master
17+
paths:
18+
- 'qabook/**'
19+
- '.github/workflows/qabook-build.yml'
20+
workflow_dispatch:
21+
22+
permissions:
23+
contents: write
24+
25+
jobs:
26+
build-pdf:
27+
name: 编译LaTeX为PDF
28+
runs-on: ubuntu-latest
29+
30+
steps:
31+
- name: 检出代码
32+
uses: actions/checkout@v4
33+
with:
34+
fetch-depth: 0
35+
36+
- name: 安装TeX Live
37+
run: |
38+
echo "📦 安装TeX Live..."
39+
sudo apt-get update
40+
sudo apt-get install -y \
41+
texlive-xetex \
42+
texlive-latex-extra \
43+
texlive-lang-chinese \
44+
texlive-fonts-recommended \
45+
texlive-science \
46+
fonts-wqy-microhei \
47+
fonts-wqy-zenhei
48+
49+
- name: 验证XeLaTeX安装
50+
run: |
51+
echo "✅ 验证XeLaTeX..."
52+
xelatex --version
53+
54+
- name: 编译PDF (第一次)
55+
working-directory: qabook
56+
run: |
57+
echo "📄 第一次编译..."
58+
xelatex -interaction=nonstopmode quantaxis.tex || {
59+
echo "❌ 编译失败,查看日志:"
60+
tail -50 quantaxis.log
61+
exit 1
62+
}
63+
64+
- name: 编译PDF (第二次)
65+
working-directory: qabook
66+
run: |
67+
echo "📄 第二次编译..."
68+
xelatex -interaction=nonstopmode quantaxis.tex
69+
70+
- name: 编译PDF (第三次)
71+
working-directory: qabook
72+
run: |
73+
echo "📄 第三次编译..."
74+
xelatex -interaction=nonstopmode quantaxis.tex
75+
76+
- name: 检查PDF生成
77+
working-directory: qabook
78+
run: |
79+
if [ -f "quantaxis.pdf" ]; then
80+
FILE_SIZE=$(du -h quantaxis.pdf | cut -f1)
81+
echo "✅ PDF生成成功!"
82+
echo "📊 文件大小: ${FILE_SIZE}"
83+
ls -lh quantaxis.pdf
84+
else
85+
echo "❌ PDF生成失败!"
86+
exit 1
87+
fi
88+
89+
- name: 生成版本标签
90+
id: version
91+
run: |
92+
# 使用日期作为版本号
93+
VERSION="qabook-$(date +'%Y%m%d-%H%M%S')"
94+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
95+
echo "📌 版本: ${VERSION}"
96+
97+
- name: 创建Release
98+
id: create_release
99+
uses: actions/create-release@v1
100+
env:
101+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
102+
with:
103+
tag_name: ${{ steps.version.outputs.version }}
104+
release_name: QABook PDF - ${{ steps.version.outputs.version }}
105+
body: |
106+
# QUANTAXIS QABook PDF
107+
108+
**自动编译生成**
109+
110+
- 📅 编译时间: ${{ github.event.head_commit.timestamp }}
111+
- 🔖 提交: ${{ github.sha }}
112+
- 👤 作者: ${{ github.actor }}
113+
- 💬 提交信息: ${{ github.event.head_commit.message }}
114+
115+
---
116+
117+
## 📥 下载
118+
119+
点击下方的 `quantaxis.pdf` 下载完整文档。
120+
121+
## 📚 内容
122+
123+
QABook包含QUANTAXIS的完整技术文档,涵盖:
124+
- 量化交易理论基础
125+
- 数学和统计学知识
126+
- 现代资产管理理论
127+
- 组合优化策略
128+
- 期权定价理论
129+
130+
---
131+
132+
**自动生成 by GitHub Actions**
133+
draft: false
134+
prerelease: false
135+
136+
- name: 上传PDF到Release
137+
uses: actions/upload-release-asset@v1
138+
env:
139+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
140+
with:
141+
upload_url: ${{ steps.create_release.outputs.upload_url }}
142+
asset_path: ./qabook/quantaxis.pdf
143+
asset_name: quantaxis.pdf
144+
asset_content_type: application/pdf
145+
146+
- name: 清理临时文件
147+
if: always()
148+
working-directory: qabook
149+
run: |
150+
echo "🧹 清理临时文件..."
151+
rm -f *.aux *.log *.out *.toc *.gz *.fdb_latexmk *.fls *.synctex.gz || true
152+
153+
- name: 完成
154+
run: |
155+
echo "✅ QABook PDF编译完成!"
156+
echo "📦 已发布到Release: ${{ steps.version.outputs.version }}"

.gitignore

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,10 @@ ENV/
143143

144144

145145

146-
146+
CLAUDE.md
147+
.claude/
148+
.archive/
149+
run/
147150
# jupyter-kernel
148151

149152
kernel*.json
@@ -195,4 +198,8 @@ celerybeat*
195198
*.toc
196199
.synctex(busy)
197200
*.fdb_latexmk
198-
*.fls
201+
*.fls
202+
203+
# mdbook构建输出
204+
book/
205+
*.bak

0 commit comments

Comments
 (0)