#
# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This file is a part of the vllm-ascend project.
#

# This test will be triggered:
# - PR labeled with: 'accuracy-test' & 'ready-for-test'
name: ascend test / accuracy

on:
  pull_request:
    branches:
      - 'main'
      - '*-dev'
    types: [ labeled, synchronize ]

# Bash shells do not use ~/.profile or ~/.bashrc so these shells need to be explicitly
# declared as "shell: bash -el {0}" on steps that need to be properly activated.
# It's used to activate ascend-toolkit environment variables.
defaults:
  run:
    shell: bash -el {0}

# only cancel in-progress runs of the same workflow
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  run:
    name: ""
    strategy:
      matrix:
        # Only top series models should be listed in here
        include:
          - runner: a2-1
            model_name: Qwen3-8B
          - runner: a2-1
            model_name: Qwen2.5-VL-7B-Instruct
          - runner: a2-1
            model_name: Qwen2-Audio-7B-Instruct
          - runner: a2-2
            model_name: Qwen3-30B-A3B
          - runner: a2-2
            model_name: Qwen3-VL-30B-A3B-Instruct
          - runner: a2-2
            model_name: DeepSeek-V2-Lite
      fail-fast: false
    # test will be triggered when tag 'accuracy-test' & 'ready-for-test'
    if:  >-
      ${{
      contains(github.event.pull_request.labels.*.name, 'accuracy-test') &&
      contains(github.event.pull_request.labels.*.name, 'ready-for-test')
      }}
    uses: ./.github/workflows/_accuracy_test.yaml
    with:
      vllm: v0.11.0
      runner:  linux-aarch64-${{ matrix.runner }}
      image: swr.cn-southwest-2.myhuaweicloud.com/base_image/ascend-ci/cann:8.2.rc1-910b-ubuntu22.04-py3.11
      model_name: ${{ matrix.model_name }}
