chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,161 @@
|
||||
name: Clone-linux
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
workflow-name:
|
||||
type: string
|
||||
required: false
|
||||
clone_dir:
|
||||
type: string
|
||||
required: false
|
||||
default: "Paddle"
|
||||
is_pr:
|
||||
type: string
|
||||
required: false
|
||||
default: "true"
|
||||
skill-can-skip:
|
||||
type: string
|
||||
required: false
|
||||
default: "false"
|
||||
outputs:
|
||||
can-skip:
|
||||
value: ${{ jobs.clone.outputs.can-skip }}
|
||||
slice-check:
|
||||
value: ${{ jobs.clone.outputs.slice-check }}
|
||||
xpu-only:
|
||||
value: ${{ jobs.clone.outputs.xpu-only }}
|
||||
|
||||
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:
|
||||
check-bypass:
|
||||
name: Check bypass
|
||||
if: ${{ github.repository_owner == 'PaddlePaddle' }}
|
||||
uses: ./.github/workflows/check-bypass.yml
|
||||
with:
|
||||
workflow-name: ${{ inputs.workflow-name }}
|
||||
secrets:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
clone:
|
||||
name: Clone Paddle
|
||||
if: ${{ github.repository_owner == 'PaddlePaddle' }}
|
||||
needs: [check-bypass]
|
||||
outputs:
|
||||
can-skip: ${{ needs.check-bypass.outputs.can-skip == 'true' || inputs.skill-can-skip == 'true' }}
|
||||
slice-check: ${{ steps.check-execution.outputs.slice-check }}
|
||||
xpu-only: ${{ steps.xpu-only-check.outputs.xpu-only }}
|
||||
runs-on:
|
||||
group: HK-Clone
|
||||
timeout-minutes: 30
|
||||
|
||||
steps:
|
||||
- name: Debug - Print inputs values
|
||||
run: |
|
||||
echo "=== Debug Info ==="
|
||||
echo "inputs.skill-can-skip: '${{ inputs.skill-can-skip }}'"
|
||||
echo "inputs.skill-can-skip length: $(echo '${{ inputs.skill-can-skip }}' | wc -c)"
|
||||
echo "==="
|
||||
|
||||
- name: Set environment variables and print
|
||||
id: set-vars
|
||||
run: |
|
||||
# Determine if can skip based on check-bypass and skill-can-skip
|
||||
if [[ "${{ needs.check-bypass.outputs.can-skip }}" == "true" ]] || [[ "${{ inputs.skill-can-skip }}" == "true" ]]; then
|
||||
echo "CAN_SKIP=true" >> $GITHUB_ENV
|
||||
else
|
||||
echo "CAN_SKIP=false" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Print can-skip value
|
||||
run: |
|
||||
echo "can-skip output: ${{ env.CAN_SKIP }}"
|
||||
|
||||
- name: Check submodules status
|
||||
run: git submodule foreach --recursive 'git rev-parse HEAD || rm -rf $PWD' || true
|
||||
|
||||
- name: Clone paddle
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.base.ref }}
|
||||
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 sync --recursive
|
||||
git submodule update --init --recursive
|
||||
git branch -d pr
|
||||
source ${ci_scripts}/check_execution.sh
|
||||
bash ${ci_scripts}/third_party_tag.sh
|
||||
|
||||
- name: Check if XPU-only PR
|
||||
id: xpu-only-check
|
||||
if: ${{ inputs.is_pr == 'true' }}
|
||||
env:
|
||||
DISABLE_HW_CI_SKIP: ${{ vars.DISABLE_HW_CI_SKIP || 'false' }}
|
||||
run: |
|
||||
if bash ci/check_xpu_only.sh; then
|
||||
echo "xpu-only=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "xpu-only=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- 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 paddle-action.tar.gz to bos
|
||||
env:
|
||||
AK: paddle
|
||||
SK: paddle
|
||||
bos_file: "/home/paddle/actions-runner/bos/BosClient.py"
|
||||
run: |
|
||||
cd ..
|
||||
tar -I 'zstd -T0' -cf Paddle.tar.gz Paddle
|
||||
echo "::group::Install bce-python-sdk"
|
||||
python -m pip install bce-python-sdk==0.8.74
|
||||
echo "::endgroup::"
|
||||
python ${bos_file} Paddle.tar.gz paddle-github-action/PR/${{ inputs.clone_dir }}/${PR_ID}/${COMMIT_ID}
|
||||
rm Paddle.tar.gz
|
||||
cd -
|
||||
git switch ${BRANCH}
|
||||
set +e
|
||||
git branch -D test
|
||||
git gc
|
||||
|
||||
# - name: Clean environment
|
||||
# if: always()
|
||||
# run: |
|
||||
# cd ${{ github.workspace }}
|
||||
# rm -rf * .[^.]*
|
||||
Reference in New Issue
Block a user