|
| 1 | +name: CI_HPU |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - develop |
| 7 | + - 'release/*' |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +concurrency: |
| 11 | + group: ${{ github.event.pull_request.number }}-hpu-ci |
| 12 | + cancel-in-progress: true |
| 13 | + |
| 14 | +jobs: |
| 15 | + CI_HPU: |
| 16 | + runs-on: [self-hosted, HPU-8Card] |
| 17 | + steps: |
| 18 | + - name: Print current runner name |
| 19 | + run: | |
| 20 | + echo "Current runner name: ${{ runner.name }}" |
| 21 | +
|
| 22 | + - name: Code Checkout |
| 23 | + env: |
| 24 | + docker_image: ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/fastdeploy-hpu:latest |
| 25 | + run: | |
| 26 | + REPO="https://github.com/${{ github.repository }}.git" |
| 27 | + FULL_REPO="${{ github.repository }}" |
| 28 | + REPO_NAME="${FULL_REPO##*/}" |
| 29 | + BASE_BRANCH="${{ github.base_ref }}" |
| 30 | + # Clean the repository directory before starting |
| 31 | + docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ |
| 32 | + -e "REPO_NAME=${REPO_NAME}" \ |
| 33 | + -e "BASE_BRANCH=${BASE_BRANCH}" \ |
| 34 | + ${docker_image} /bin/bash -c ' |
| 35 | + if [ -d ${REPO_NAME} ]; then |
| 36 | + echo "Directory ${REPO_NAME} exists, removing it..." |
| 37 | + rm -rf ${REPO_NAME} |
| 38 | + fi |
| 39 | + ' |
| 40 | + git config --global user.name "FastDeployCI" |
| 41 | + git config --global user.email "[email protected]" |
| 42 | + git clone ${REPO} ${REPO_NAME} -b ${BASE_BRANCH} |
| 43 | + cd FastDeploy |
| 44 | + if [ "${{ github.event_name }}" = "pull_request" ]; then |
| 45 | + git fetch origin pull/${{ github.event.pull_request.number }}/head:pr/${{ github.event.pull_request.number }} |
| 46 | + git merge pr/${{ github.event.pull_request.number }} |
| 47 | + git log -n 3 --oneline |
| 48 | + else |
| 49 | + git checkout ${{ github.sha }} |
| 50 | + git log -n 3 --oneline |
| 51 | + fi |
| 52 | +
|
| 53 | + - name: Run CI unittest |
| 54 | + env: |
| 55 | + docker_image: ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/fastdeploy-hpu:latest |
| 56 | + run: | |
| 57 | + runner_name="${{ runner.name }}" |
| 58 | + last_char="${runner_name: -1}" |
| 59 | +
|
| 60 | + if [[ "$last_char" =~ [0-3] ]]; then |
| 61 | + hpu_id="$last_char" |
| 62 | + else |
| 63 | + hpu_id="0" |
| 64 | + fi |
| 65 | + FD_API_PORT=8388 |
| 66 | + FD_ENGINE_QUEUE_PORT=8902 |
| 67 | + FD_METRICS_PORT=8202 |
| 68 | +
|
| 69 | + PARENT_DIR=$(dirname "$WORKSPACE") |
| 70 | + echo "PARENT_DIR:$PARENT_DIR" |
| 71 | + docker run --rm --net=host --cap-add=SYS_PTRACE --privileged --shm-size=64G \ |
| 72 | + -v $(pwd):/workspace -w /workspace \ |
| 73 | + -v "/ssd1:/ssd1" \ |
| 74 | + -e "MODEL_PATH=/ssd1" \ |
| 75 | + -e "http_proxy=$(git config --global --get http.proxy)" \ |
| 76 | + -e "https_proxy=$(git config --global --get https.proxy)" \ |
| 77 | + -e "no_proxy=bcebos.com,mirrors.tuna.tsinghua.edu.cn,localhost,127.0.0.1,0.0.0.0,10.0.0.0/8,192.168.1.0/24" \ |
| 78 | + -e "FD_API_PORT=${FD_API_PORT}" \ |
| 79 | + -e "FD_ENGINE_QUEUE_PORT=${FD_ENGINE_QUEUE_PORT}" \ |
| 80 | + -e "FD_METRICS_PORT=${FD_METRICS_PORT}" \ |
| 81 | + ${docker_image} /bin/bash -c " |
| 82 | + git config --global --add safe.directory /workspace/FastDeploy |
| 83 | + cd FastDeploy |
| 84 | + bash scripts/run_ci_hpu.sh |
| 85 | + " |
0 commit comments