Skip to content

Commit 54efe14

Browse files
committed
fix:build cicd
1 parent 0ea3e17 commit 54efe14

File tree

2 files changed

+65
-30
lines changed

2 files changed

+65
-30
lines changed

.github/workflows/build_linux_only.yml

Lines changed: 65 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- name: Checkout code
15-
uses: actions/checkout@v2
15+
uses: actions/checkout@v4
1616
with:
1717
repository: dataelement/bisheng-telemetry-search
1818
token: ${{ secrets.CROSS_REPO_TOKEN }}
1919
path: bisheng-telemetry-search
2020

2121
- name: Set up Python
22-
uses: actions/setup-python@v4
22+
uses: actions/setup-python@v5
2323
with:
2424
python-version: '3.10'
2525

@@ -30,15 +30,26 @@ jobs:
3030
pip install --upgrade pip setuptools wheel
3131
pip install cython
3232
33-
- name: Build the project
33+
- name: Build and Clean Artifacts
3434
working-directory: ./bisheng-telemetry-search/telemetry_search
3535
run: |
36-
pwd
36+
# 1. 执行构建
3737
python build_all.py --delete-source
38-
mkdir ../../build_output
38+
39+
# 2. [关键] 在上传前彻底清理源代码和中间文件
40+
# 即使 build_all.py 做了清理,这里再次强制清理,防止 .c 文件泄露
41+
find . -name "*.c" -delete
42+
find . -name "*.cpp" -delete
43+
find . -name "__pycache__" -exec rm -rf {} +
3944
rm -rf ./build
45+
rm -f build_all.py setup.py # 删除构建脚本本身
46+
47+
# 3. 准备输出
48+
mkdir ../../build_output
4049
cp -r ./* ../../build_output/
41-
ls -lh ../../build_output/
50+
51+
echo "Listing artifacts to be uploaded:"
52+
ls -R ../../build_output/
4253
4354
- name: Upload x86_64 build artifacts
4455
uses: actions/upload-artifact@v4
@@ -51,14 +62,14 @@ jobs:
5162
runs-on: ubuntu-22.04-arm
5263
steps:
5364
- name: Checkout code
54-
uses: actions/checkout@v2
65+
uses: actions/checkout@v4
5566
with:
5667
repository: dataelement/bisheng-telemetry-search
5768
token: ${{ secrets.CROSS_REPO_TOKEN }}
5869
path: bisheng-telemetry-search
5970

6071
- name: Set up Python
61-
uses: actions/setup-python@v4
72+
uses: actions/setup-python@v5
6273
with:
6374
python-version: '3.10'
6475

@@ -69,35 +80,47 @@ jobs:
6980
pip install --upgrade pip setuptools wheel
7081
pip install cython
7182
72-
- name: Build the project
83+
- name: Build and Clean Artifacts
7384
working-directory: ./bisheng-telemetry-search/telemetry_search
7485
run: |
75-
pwd
86+
# 1. 执行构建
7687
python build_all.py --delete-source
77-
mkdir ../../build_output
88+
89+
# 2. [关键] 强制清理 .c / .cpp / __pycache__
90+
find . -name "*.c" -delete
91+
find . -name "*.cpp" -delete
92+
find . -name "__pycache__" -exec rm -rf {} +
7893
rm -rf ./build
94+
rm -f build_all.py setup.py
95+
96+
# 3. 准备输出
97+
mkdir ../../build_output
7998
cp -r ./* ../../build_output/
80-
ls -lh ../../build_output/
99+
100+
echo "Listing artifacts to be uploaded:"
101+
ls -R ../../build_output/
81102
82103
- name: Upload ARM build artifacts
83104
uses: actions/upload-artifact@v4
84105
with:
85106
name: telemetry_search-arm
86107
path: ./build_output/*
87108

88-
89109
deploy_to_sso_project:
90110
name: Deploy Artifacts to SSO Project
91111
needs: [ build_x86_64, build_arm ]
92112
runs-on: ubuntu-latest
93113
steps:
94114
- name: Checkout SSO Project
95-
uses: actions/checkout@v2
115+
uses: actions/checkout@v4
96116
with:
97117
repository: dataelement/bisheng
98118
token: ${{ secrets.CROSS_REPO_TOKEN }}
99-
base: feat/2.3.0
119+
# [关键修改] 使用 ref 指定分支,而不是 base
120+
ref: feat/2.3.0
100121
path: bisheng
122+
# 确保拉取完整的历史以便正确提交
123+
fetch-depth: 0
101124

102125
- name: Download x86_64 build artifacts
103126
uses: actions/download-artifact@v4
@@ -111,28 +134,43 @@ jobs:
111134
name: telemetry_search-arm
112135
path: ./telemetry_search_arm
113136

114-
- name: copy files
137+
- name: Merge and Place Files
115138
run: |
116-
ls -lh ./telemetry_search_x86_64
117-
ls -lh ./telemetry_search_arm
139+
# 创建临时合并目录
140+
mkdir -p ./telemetry_search
141+
142+
# 1. 先复制 x86_64 文件
143+
cp -r ./telemetry_search_x86_64/* ./telemetry_search_merged/
144+
145+
# 2. 再复制 ARM 文件 (不会覆盖 .so,因为文件名包含架构信息;会覆盖 .py,但应该是一样的)
146+
cp -r ./telemetry_search_arm/* ./telemetry_search_merged/
118147
119-
mkdir ./telemetry_search
120-
cp -r ./telemetry_search_x86_64/* ./telemetry_search/
121-
cp -r ./telemetry_search_arm/* ./telemetry_search/
122-
ls -lh ./telemetry_search
148+
# 3. [最后一道防线] 再次清理可能的垃圾文件
149+
find ./telemetry_search -name "*.c" -delete
150+
151+
# 4. 移动到目标仓库目录
123152
cp -r ./telemetry_search ./bisheng/src/backend/bisheng/
153+
154+
echo "Final content of target directory:"
124155
ls -lh ./bisheng/src/backend/bisheng/telemetry_search
125156
126157
- name: Commit and Push changes
127158
working-directory: ./bisheng
128159
run: |
129160
git config --global user.name "github-actions[bot]"
130161
git config --global user.email "github-actions[bot]@users.noreply.github.com"
131-
git checkout -b feat/2.3.0
132-
git add .
133-
git commit -m "chore: update telemetry_search build artifacts [skip ci]" || echo "No changes to commit"
134-
git push origin feat/2.3.0
135162
163+
# [关键修改] 不要使用 git checkout -b (这是新建分支)
164+
# 因为上面 actions/checkout 已经拉取了 ref: feat/2.3.0
165+
# 我们只需要确认当前就在这个分支上
136166
137-
167+
git add .
138168
169+
# 检查是否有变更,有才提交
170+
if git diff --staged --quiet; then
171+
echo "No changes to commit"
172+
else
173+
git commit -m "chore: update telemetry_search build artifacts [skip ci]"
174+
# 不需要 --force,因为我们是基于最新远程分支修改的
175+
git push origin feat/2.3.0
176+
fi

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,6 @@ __pycache__/
123123
*$py.class
124124
notebooks
125125

126-
# C extensions
127-
*.so
128-
129126
# Distribution / packaging
130127
.Python
131128
build/

0 commit comments

Comments
 (0)