-
Notifications
You must be signed in to change notification settings - Fork 7
112 lines (94 loc) · 3.66 KB
/
Copy path_clone_linux.yml
File metadata and controls
112 lines (94 loc) · 3.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: Paddle-iluvatar Code Clone
description: "Clone Paddle-iluvatar repo with submodules and upload to BOS"
on:
workflow_call:
inputs:
branch:
type: string
required: false
default: 'develop'
outputs:
repo_archive_url:
description: "Compressed source code archive URL"
value: ${{ jobs.code-clone.outputs.repo_archive_url }}
jobs:
code-clone:
runs-on:
group: HK-Clone
outputs:
repo_archive_url: ${{ steps.upload.outputs.repo_archive_url }}
steps:
- name: Cleanup workspace
run: |
rm -rf Paddle-iluvatar || true
- name: Clone Paddle-iluvatar
run: |
set -x
REPO_URL="https://github.com/${{ github.repository }}.git"
BRANCH="${{ inputs.branch || github.ref_name }}"
echo "Cloning from: ${REPO_URL}"
echo "Branch: ${BRANCH}"
git clone --branch ${BRANCH} ${REPO_URL} Paddle-iluvatar
cd Paddle-iluvatar
echo "=== Updating submodules ==="
git submodule sync
git submodule update --init --recursive --force
# 获取 submodule 的 tags(参考 CI.yml)
cd Paddle/third_party/protobuf
git fetch --tags
cd ../pybind
git fetch --tags
cd ../gloo
git fetch --tags
cd ..
# 确保 sleef 存在
if [ ! -d "sleef" ]; then
git clone https://github.com/shibatch/sleef.git
fi
cd ../../
echo "=== Current HEAD Log ==="
git log --oneline -n 5
echo "=== Submodules Status ==="
git submodule status --recursive
echo "=== Directory Structure ==="
ls -la
- name: Download BOS client
env:
home_path: "/home/paddle/actions-runner/"
bos_file: "/home/paddle/actions-runner/bos/BosClient.py"
run: |
if [ ! -f "${bos_file}" ]; then
wget -q --no-proxy -O ${home_path}/bos_new.tar.gz https://xly-devops.bj.bcebos.com/home/bos_new.tar.gz --no-check-certificate
mkdir -p ${home_path}/bos
tar xf ${home_path}/bos_new.tar.gz -C ${home_path}/bos
fi
- name: Push to BOS
id: upload
env:
AK: paddle
SK: paddle
bos_file: "/home/paddle/actions-runner/bos/BosClient.py"
run: |
set -x
commit_id=${{ github.sha }}
branch_name=${{ inputs.branch || github.ref_name }}
# 使用 zstd 压缩(更快)
tar -I 'zstd -T0' -cf Paddle-iluvatar.tar.gz Paddle-iluvatar
echo "::group::Install bce-python-sdk"
python -m pip install bce-python-sdk==0.8.74
echo "::endgroup::"
# 确定上传路径
if [[ "${{ github.ref_type }}" == "tag" ]]; then
target_path="paddle-github-action/Paddle-iluvatar/TAG/${{ github.ref_name }}/${commit_id}"
else
target_path="paddle-github-action/Paddle-iluvatar/BRANCH/${branch_name}/${commit_id}"
fi
echo "Uploading to: ${target_path}"
python ${bos_file} Paddle-iluvatar.tar.gz ${target_path}
# 清理
rm Paddle-iluvatar.tar.gz
# 输出下载 URL
target_path_stripped="${target_path#paddle-github-action/}"
REPO_ARCHIVE_URL="https://paddle-github-action.bj.bcebos.com/${target_path_stripped}/Paddle-iluvatar.tar.gz"
echo "repo_archive_url=${REPO_ARCHIVE_URL}" >> $GITHUB_OUTPUT
echo "Archive URL: ${REPO_ARCHIVE_URL}"