name: CI_XPU

on:
  pull_request:
    types: [opened, synchronize]
    branches: [develop, release/**]
permissions: read-all

concurrency:
  group: ${{ github.event.pull_request.number }}-${{ github.workflow }}
  cancel-in-progress: true

jobs:
  clone:
    name: FD-Clone-Linux-XPU
    uses: ./.github/workflows/_clone_linux.yml
    secrets:
      github-token: ${{ secrets.GITHUB_TOKEN }}

  xpu_build_test:
    name: xpu_build_test
    needs: [clone]
    uses: ./.github/workflows/_build_xpu.yml
    with:
      FASTDEPLOY_ARCHIVE_URL: ${{ needs.clone.outputs.repo_archive_url }}
      DOCKER_IMAGE: ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/fastdeploy-xpu:ci
    secrets:
      github-token: ${{ secrets.GITHUB_TOKEN }}

  xpu_4cards_case_test:
    name: xpu_4cards_case_test
    needs: [clone, xpu_build_test]
    uses: ./.github/workflows/_xpu_4cards_case_test.yml
    with:
      FASTDEPLOY_ARCHIVE_URL: ${{ needs.clone.outputs.repo_archive_url }}
      DOCKER_IMAGE: ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/fastdeploy-xpu:ci
      FASTDEPLOY_WHEEL_URL: ${{ needs.xpu_build_test.outputs.wheel_path }}
      MODEL_PATH: /ssd3/model
    secrets:
      github-token: ${{ secrets.GITHUB_TOKEN }}

  xpu_8cards_case_test:
    name: xpu_8cards_case_test
    needs: [clone, xpu_build_test]
    uses: ./.github/workflows/_xpu_8cards_case_test.yml
    with:
      FASTDEPLOY_ARCHIVE_URL: ${{ needs.clone.outputs.repo_archive_url }}
      DOCKER_IMAGE: ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/fastdeploy-xpu:ci
      FASTDEPLOY_WHEEL_URL: ${{ needs.xpu_build_test.outputs.wheel_path }}
      MODEL_PATH: /ssd3/model
    secrets:
      github-token: ${{ secrets.GITHUB_TOKEN }}
