|
| 1 | +name: CI_ILUVATAR |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: [ develop ] |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +concurrency: |
| 9 | + group: ${{ github.event.pull_request.number }}-iluvatar-ci |
| 10 | + cancel-in-progress: true |
| 11 | + |
| 12 | +jobs: |
| 13 | + CI_ILUVATAR: |
| 14 | + runs-on: [self-hosted, IXUCA] |
| 15 | + steps: |
| 16 | + - name: Print current runner name |
| 17 | + run: | |
| 18 | + echo "Current runner name: ${{ runner.name }}" |
| 19 | + # Because the system version is lower than 2.23, the checkout cannot be used. |
| 20 | + # - name: Checkout code |
| 21 | + # uses: actions/checkout@v4 |
| 22 | + |
| 23 | + - name: Code Checkout |
| 24 | + env: |
| 25 | + docker_image: ccr-2vdh3abv-pub.cnc.bj.baidubce.com/device/paddle-ixuca:latest |
| 26 | + run: | |
| 27 | + REPO="https://github.com/${{ github.repository }}.git" |
| 28 | + FULL_REPO="${{ github.repository }}" |
| 29 | + REPO_NAME="${FULL_REPO##*/}" |
| 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 | + ${docker_image} /bin/bash -c ' |
| 34 | + if [ -d ${REPO_NAME} ]; then |
| 35 | + echo "Directory ${REPO_NAME} exists, removing it..." |
| 36 | + rm -rf ${REPO_NAME} |
| 37 | + fi |
| 38 | + ' |
| 39 | + git config --global user.name "FastDeployCI" |
| 40 | + git config --global user.email "fastdeploy_ci@example.com" |
| 41 | + git clone ${REPO} ${REPO_NAME} |
| 42 | + cd FastDeploy |
| 43 | + if [ "${{ github.event_name }}" = "pull_request" ]; then |
| 44 | + git fetch origin pull/${{ github.event.pull_request.number }}/head:pr/${{ github.event.pull_request.number }} |
| 45 | + git merge pr/${{ github.event.pull_request.number }} |
| 46 | + git log -n 3 --oneline |
| 47 | + else |
| 48 | + git checkout ${{ github.sha }} |
| 49 | + git log -n 3 --oneline |
| 50 | + fi |
| 51 | +
|
| 52 | + - name: Run CI unittest |
| 53 | + env: |
| 54 | + docker_image: ccr-2vdh3abv-pub.cnc.bj.baidubce.com/device/paddle-ixuca:latest |
| 55 | + run: | |
| 56 | + runner_name="${{ runner.name }}" |
| 57 | + last_char="${runner_name: -1}" |
| 58 | +
|
| 59 | + if [[ "$last_char" =~ [0-3] ]]; then |
| 60 | + gpu_id="$last_char" |
| 61 | + else |
| 62 | + gpu_id="0" |
| 63 | + fi |
| 64 | + FD_API_PORT=$((9180 + gpu_id * 100)) |
| 65 | + FD_ENGINE_QUEUE_PORT=$((9150 + gpu_id * 100)) |
| 66 | + FD_METRICS_PORT=$((9170 + gpu_id * 100)) |
| 67 | +
|
| 68 | + PARENT_DIR=$(dirname "$WORKSPACE") |
| 69 | + echo "PARENT_DIR:$PARENT_DIR" |
| 70 | + docker run --rm --net=host --pid=host --cap-add=ALL --privileged --shm-size=64G \ |
| 71 | + -v /usr/src:/usr/src -v /lib/modules:/lib/modules -v /dev:/dev \ |
| 72 | + -v $(pwd):/workspace -w /workspace \ |
| 73 | + -v "/data1/fastdeploy:/data1/fastdeploy" \ |
| 74 | + -e "MODEL_PATH=/ssd3/model" \ |
| 75 | + -e "http_proxy=$(git config --global --get http.proxy)" \ |
| 76 | + -e "https_proxy=$(git config --global --get https.proxy)" \ |
| 77 | + -e "FD_API_PORT=${FD_API_PORT}" \ |
| 78 | + -e "FD_ENGINE_QUEUE_PORT=${FD_ENGINE_QUEUE_PORT}" \ |
| 79 | + -e "FD_METRICS_PORT=${FD_METRICS_PORT}" \ |
| 80 | + ${docker_image} /bin/bash -c " |
| 81 | + git config --global --add safe.directory /workspace/FastDeploy |
| 82 | + cd FastDeploy |
| 83 | + bash scripts/run_ci_iluvatar.sh |
| 84 | + " |
0 commit comments