forked from PaddlePaddle/PaddleFleet
-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (92 loc) · 3 KB
/
Copy path_clone.yml
File metadata and controls
101 lines (92 loc) · 3 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
name: Clone
on:
workflow_call:
inputs:
clone_dir:
type: string
required: false
default: 'develop'
is_pr:
type: string
required: false
default: 'false'
ref:
required: true
type: string
commit:
type: string
required: false
submodule:
type: string
required: false
default: 'recursive'
permissions: read-all
defaults:
run:
shell: bash
env:
PR_ID: ${{ github.event.pull_request.number || '0' }}
COMMIT_ID: ${{ github.event.pull_request.head.sha || github.sha }}
ci_scripts: ${{ github.workspace }}/ci
BRANCH: ${{ github.event.pull_request.base.ref || github.ref_name }}
jobs:
clone:
name: Clone Paddle
if: ${{ github.repository_owner == 'PaddlePaddle' }}
runs-on:
group: HK-Clone
steps:
- name: Clone paddle
uses: actions/checkout@v6
with:
ref: ${{ inputs.ref }}
submodules: ${{ inputs.submodule }}
fetch-depth: 1000
- name: Merge PR to test branch
id: check-execution
if: ${{ inputs.is_pr == 'true' }}
run: |
git submodule foreach --recursive sh -c "git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'"
git switch ${{ github.event.pull_request.base.ref }}
set +e
git branch -D test
set -e
git gc
git switch -c test
git config user.name "PaddleCI"
git config user.email "paddle_ci@example.com"
git fetch origin pull/${{ github.event.pull_request.number }}/head:pr
git merge --no-ff pr
git submodule update --init
git branch -d pr
- 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 ${home_path}/bos
tar xf ${home_path}/bos_new.tar.gz -C ${home_path}/bos
fi
- name: Push PaddleFleet.tar.gz to bos
env:
AK: paddle
SK: paddle
bos_file: "/home/paddle/actions-runner/bos/BosClient.py"
run: |
cd ..
tar -zcf PaddleFleet.tar.gz PaddleFleet
echo "::group::Install bce-python-sdk"
python -m pip install bce-python-sdk==0.8.74
echo "::endgroup::"
if [ -n "${{ inputs.commit }}" ]; then
python ${bos_file} PaddleFleet.tar.gz paddle-github-action/PaddleFleet/${{ inputs.clone_dir }}/${PR_ID}/${{ inputs.commit }}
else
python ${bos_file} PaddleFleet.tar.gz paddle-github-action/PaddleFleet/${{ inputs.clone_dir }}/${PR_ID}/${COMMIT_ID}
fi
- name: Clean environment
if: always()
run: |
cd ${{ github.workspace }}
rm -rf * .[^.]*