|
| 1 | +name: Clone-linux |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + workflow-name: |
| 7 | + type: string |
| 8 | + required: false |
| 9 | + clone_dir: |
| 10 | + type: string |
| 11 | + required: false |
| 12 | + default: 'PaddlecustomDevice' |
| 13 | + is_pr: |
| 14 | + type: string |
| 15 | + required: false |
| 16 | + default: 'true' |
| 17 | + outputs: |
| 18 | + can-skip: |
| 19 | + value: ${{ jobs.clone.outputs.can-skip }} |
| 20 | + slice-check: |
| 21 | + value: ${{ jobs.clone.outputs.slice-check }} |
| 22 | + |
| 23 | +permissions: read-all |
| 24 | + |
| 25 | +defaults: |
| 26 | + run: |
| 27 | + shell: bash |
| 28 | + |
| 29 | +env: |
| 30 | + PR_ID: ${{ github.event.pull_request.number || '0' }} |
| 31 | + COMMIT_ID: ${{ github.event.pull_request.head.sha || github.sha }} |
| 32 | + ci_scripts: ${{ github.workspace }}/ci |
| 33 | + BRANCH: ${{ github.event.pull_request.base.ref || github.ref_name }} |
| 34 | + |
| 35 | +jobs: |
| 36 | + clone: |
| 37 | + name: Clone PaddlecustomDevice |
| 38 | + if: ${{ github.repository_owner == 'PaddlePaddle' }} |
| 39 | + outputs: |
| 40 | + can-skip: ${{ steps.check-bypass.outputs.can-skip }} |
| 41 | + slice-check: ${{ steps.check-execution.outputs.slice-check }} |
| 42 | + runs-on: |
| 43 | + group: HK-Clone |
| 44 | + |
| 45 | + steps: |
| 46 | + - name: Clone paddle |
| 47 | + uses: actions/checkout@v4 |
| 48 | + with: |
| 49 | + ref: ${{ github.event.pull_request.base.ref }} |
| 50 | + submodules: 'recursive' |
| 51 | + fetch-depth: 1000 |
| 52 | + |
| 53 | + - name: Merge PR to test branch |
| 54 | + id: check-execution |
| 55 | + if: ${{ inputs.is_pr == 'true' }} |
| 56 | + run: | |
| 57 | + git config --unset http.https://github.com/.extraheader |
| 58 | + git submodule foreach --recursive sh -c "git config --local --unset-all 'http.https://github.com/.extraheader'" |
| 59 | + git submodule foreach --recursive sh -c "git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'" |
| 60 | + git switch ${{ github.event.pull_request.base.ref }} |
| 61 | + set +e |
| 62 | + git branch -D test |
| 63 | + set -e |
| 64 | + git gc |
| 65 | + git switch -c test |
| 66 | + git config user.name "PaddleCI" |
| 67 | + git config user.email "paddle_ci@example.com" |
| 68 | + git fetch origin pull/${{ github.event.pull_request.number }}/head:pr |
| 69 | + git merge --no-ff pr |
| 70 | + git submodule update --init |
| 71 | + git branch -d pr |
| 72 | + source ${ci_scripts}/check_execution.sh |
| 73 | + bash ${ci_scripts}/third_party_tag.sh |
| 74 | +
|
| 75 | + - name: Check bypass |
| 76 | + id: check-bypass |
| 77 | + uses: ./.github/actions/check-bypass |
| 78 | + with: |
| 79 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 80 | + workflow-name: ${{ inputs.workflow-name }} |
| 81 | + |
| 82 | + - name: Download bos client |
| 83 | + env: |
| 84 | + home_path: "/home/paddle/actions-runner/" |
| 85 | + bos_file: "/home/paddle/actions-runner/bos/BosClient.py" |
| 86 | + run: | |
| 87 | + if [ ! -f "${bos_file}" ]; then |
| 88 | + 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 |
| 89 | + mkdir ${home_path}/bos |
| 90 | + tar xf ${home_path}/bos_new.tar.gz -C ${home_path}/bos |
| 91 | + fi |
| 92 | +
|
| 93 | + - name: Push paddle-action.tar.gz to bos |
| 94 | + env: |
| 95 | + AK: paddle |
| 96 | + SK: paddle |
| 97 | + bos_file: "/home/paddle/actions-runner/bos/BosClient.py" |
| 98 | + run: | |
| 99 | + cd .. |
| 100 | + tar -I 'zstd -T0' -cf PaddlecustomDevice.tar.gz PaddlecustomDevice |
| 101 | + echo "::group::Install bce-python-sdk" |
| 102 | + python -m pip install bce-python-sdk==0.8.74 |
| 103 | + echo "::endgroup::" |
| 104 | + python ${bos_file} PaddlecustomDevice.tar.gz paddle-github-action/PaddleCustomDevice/PR/${{ inputs.clone_dir }}/${PR_ID}/${COMMIT_ID} |
| 105 | + rm PaddlecustomDevice.tar.gz |
| 106 | + cd - |
| 107 | + git switch ${BRANCH} |
| 108 | + set +e |
| 109 | + git branch -D test |
| 110 | + git gc |
0 commit comments