Skip to content

Commit f123842

Browse files
authored
增加CE编译任务专用的代码缓存workflow,支持代码库的清理和压缩, (#3021)
* 使用PaddleQACheckout1.1版本替换1.0版本,增加workflow并发度控制 * 增加CE编译任务专用的代码缓存workflow * commit代码同步workflow支持代码库清理和压缩
1 parent 6882da3 commit f123842

File tree

2 files changed

+33
-18
lines changed

2 files changed

+33
-18
lines changed

.github/workflows/repo_sync_dispatch_test.yml renamed to .github/workflows/repo_sync_buildce_use.yml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
name: Paddle kits repos sync via repository_dispatch
2-
run-name: Paddle kits repos sync Runs on ${{ github.event_name }}
1+
name: Paddle Repos Sync Triggered by Commit Using Repository Dispatch
2+
run-name: Paddle repos sync runs triggered by commit using ${{ github.event_name }}
33
on:
44
repository_dispatch:
5-
types: [sync-event-test]
5+
types: [sync-event-commit]
66

77
jobs:
88
paddleqa-checkout:
@@ -25,6 +25,7 @@ jobs:
2525
fetch_depth: ${{ github.event.client_payload.fetch_depth }}
2626
path: ${{ github.event.client_payload.path }}
2727
commit_sha: ${{ github.event.client_payload.commit_sha }}
28+
repo_compress: ${{ github.event.client_payload.repo_compress }}
2829
- uses: actions/setup-python@v5
2930
with:
3031
python-version: '3.10'
@@ -34,8 +35,8 @@ jobs:
3435
SK: ${{ secrets.BOS_SK }}
3536
run: |
3637
git log -n 3
37-
current_commit=$(git rev-parse HEAD)
3838
tree -L 3
39+
current_commit=$(git rev-parse HEAD)
3940
REPO_NAME=${{ github.event.client_payload.repository }}
4041
REPO_NAME=${REPO_NAME##*/}
4142
file_name=$REPO_NAME.tar
@@ -46,18 +47,18 @@ jobs:
4647
tar -cf $REPO_NAME.tar ${{ github.event.client_payload.path }}
4748
python -m pip install bce-python-sdk==0.8.74
4849
# 获取远端的最新提交时间
49-
latest_commit_time_remote=$(curl --silent --fail https://paddle-qa.bj.bcebos.com/CodeSync/GitInfo/${{ github.event.client_payload.repository }}/${{ github.event.client_payload.ref }}/latest_commit_time) || latest_commit_time_remote=0
50+
latest_commit_time_remote=$(curl --silent --fail https://paddle-qa.bj.bcebos.com/CodeSync/GitInfo/${{ github.event.client_payload.repository }}/${{ github.event.client_payload.ref }}/${{ github.event.client_payload.commit_sha }}/latest_commit_time) || latest_commit_time_remote=0
5051
# 判断 latest_commit_time_remote 是否晚于 current_commit_time 时间
5152
if [ -n "$latest_commit_time_remote" ] && [ "$latest_commit_time_remote" -lt "$current_commit_time" ]; then
5253
echo "Executing upload as latest commit time ($latest_commit_time_remote) is earlier than current commit time ($current_commit_time)."
53-
python tools/bos_upload.py ${file_name} paddle-qa/CodeSync/${{ github.event.client_payload.ref }}/
54-
echo "Bos link: https://paddle-qa.bj.bcebos.com/CodeSync/${{ github.event.client_payload.ref }}/$file_name"
54+
python tools/bos_upload.py ${file_name} paddle-qa/CodeSync/${{ github.event.client_payload.ref }}/${{ github.event.client_payload.commit_sha }}
55+
echo "Bos link: https://paddle-qa.bj.bcebos.com/CodeSync/${{ github.event.client_payload.ref }}/${{ github.event.client_payload.commit_sha }}/$file_name"
5556
echo "${current_commit_time}" >> latest_commit_time
56-
python tools/bos_upload.py latest_commit_time paddle-qa/CodeSync/GitInfo/${{ github.event.client_payload.repository }}/${{ github.event.client_payload.ref }}
57+
python tools/bos_upload.py latest_commit_time paddle-qa/CodeSync/GitInfo/${{ github.event.client_payload.repository }}/${{ github.event.client_payload.ref }}/${{ github.event.client_payload.commit_sha }}
5758
echo "${current_commit}" >> latest_commit
58-
python tools/bos_upload.py latest_commit paddle-qa/CodeSync/GitInfo/${{ github.event.client_payload.repository }}/${{ github.event.client_payload.ref }}
59-
echo "GitInfo link: https://paddle-qa.bj.bcebos.com/CodeSync/GitInfo/${{ github.event.client_payload.repository }}/${{ github.event.client_payload.ref }}/latest_commit_sha"
60-
echo "GitInfo link: https://paddle-qa.bj.bcebos.com/CodeSync/GitInfo/${{ github.event.client_payload.repository }}/${{ github.event.client_payload.ref }}/latest_commit_time"
59+
python tools/bos_upload.py latest_commit paddle-qa/CodeSync/GitInfo/${{ github.event.client_payload.repository }}/${{ github.event.client_payload.ref }}/${{ github.event.client_payload.commit_sha }}
60+
echo "GitInfo link: https://paddle-qa.bj.bcebos.com/CodeSync/GitInfo/${{ github.event.client_payload.repository }}/${{ github.event.client_payload.ref }}/${{ github.event.client_payload.commit_sha }}/latest_commit_sha"
61+
echo "GitInfo link: https://paddle-qa.bj.bcebos.com/CodeSync/GitInfo/${{ github.event.client_payload.repository }}/${{ github.event.client_payload.ref }}/${{ github.event.client_payload.commit_sha }}/latest_commit_time"
6162
else
6263
echo "The latest commit time is later than the current commit. Skipping the commit operation."
6364
fi

.github/workflows/repo_sync_dispatch.yml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ jobs:
88
paddleqa-checkout:
99
environment: CodeSync
1010
runs-on: ubuntu-latest
11+
concurrency:
12+
group: exclusive-group-${{ github.workflow }}-${{ github.event.client_payload.repository }}-${{ github.event.client_payload.ref }}
13+
cancel-in-progress: false
1114
name: Repo Checkout and Upload
1215
steps:
1316
- name: PaddleTest Checkout
@@ -17,13 +20,14 @@ jobs:
1720
tools
1821
- name: Code Checkout
1922
id: checkout
20-
uses: XieYunshen/PaddleQACheckout@v1.0.0
23+
uses: XieYunshen/PaddleQACheckout@v1.1.0
2124
with:
2225
repository: ${{ github.event.client_payload.repository }}
2326
ref: ${{ github.event.client_payload.ref }}
2427
submodules: ${{ github.event.client_payload.submodules }}
2528
fetch_depth: ${{ github.event.client_payload.fetch_depth }}
2629
path: ${{ github.event.client_payload.path }}
30+
commit_sha: ${{ github.event.client_payload.commit_sha }}
2731
- uses: actions/setup-python@v5
2832
with:
2933
python-version: '3.10'
@@ -44,9 +48,19 @@ jobs:
4448
cd -
4549
tar -cf $REPO_NAME.tar ${{ github.event.client_payload.path }}
4650
python -m pip install bce-python-sdk==0.8.74
47-
python tools/bos_upload.py ${file_name} paddle-qa/CodeSync/${{ github.event.client_payload.ref }}/
48-
echo "Bos link: https://paddle-qa.bj.bcebos.com/CodeSync/${{ github.event.client_payload.ref }}/$file_name"
49-
echo "${current_commit}" >> ${current_commit}
50-
python tools/bos_upload.py ${current_commit} paddle-qa/CodeSync/${{ github.event.client_payload.repository }}/${{ github.event.client_payload.ref }}
51-
echo "${current_commit_time}" >> latest_commit_time
52-
python tools/bos_upload.py latest_commit_time paddle-qa/CodeSync/${{ github.event.client_payload.repository }}/${{ github.event.client_payload.ref }}
51+
# 获取远端的最新提交时间
52+
latest_commit_time_remote=$(curl --silent --fail https://paddle-qa.bj.bcebos.com/CodeSync/GitInfo/${{ github.event.client_payload.repository }}/${{ github.event.client_payload.ref }}/latest_commit_time) || latest_commit_time_remote=0
53+
# 判断 latest_commit_time_remote 是否晚于 current_commit_time 时间
54+
if [ -n "$latest_commit_time_remote" ] && [ "$latest_commit_time_remote" -lt "$current_commit_time" ]; then
55+
echo "Executing upload as latest commit time ($latest_commit_time_remote) is earlier than current commit time ($current_commit_time)."
56+
python tools/bos_upload.py ${file_name} paddle-qa/CodeSync/${{ github.event.client_payload.ref }}/
57+
echo "Bos link: https://paddle-qa.bj.bcebos.com/CodeSync/${{ github.event.client_payload.ref }}/$file_name"
58+
echo "${current_commit_time}" >> latest_commit_time
59+
python tools/bos_upload.py latest_commit_time paddle-qa/CodeSync/GitInfo/${{ github.event.client_payload.repository }}/${{ github.event.client_payload.ref }}
60+
echo "${current_commit}" >> latest_commit
61+
python tools/bos_upload.py latest_commit paddle-qa/CodeSync/GitInfo/${{ github.event.client_payload.repository }}/${{ github.event.client_payload.ref }}
62+
echo "GitInfo link: https://paddle-qa.bj.bcebos.com/CodeSync/GitInfo/${{ github.event.client_payload.repository }}/${{ github.event.client_payload.ref }}/latest_commit_sha"
63+
echo "GitInfo link: https://paddle-qa.bj.bcebos.com/CodeSync/GitInfo/${{ github.event.client_payload.repository }}/${{ github.event.client_payload.ref }}/latest_commit_time"
64+
else
65+
echo "The latest commit time is later than the current commit. Skipping the commit operation."
66+
fi

0 commit comments

Comments
 (0)