Skip to content

[CICD] Add Hygon BW1000 CI support #408

[CICD] Add Hygon BW1000 CI support

[CICD] Add Hygon BW1000 CI support #408

Workflow file for this run

# Copyright 2026 FlagOS Contributors
#
# 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.
name: all_tests
on:
push:
branches: ["main"]
paths-ignore:
- 'docs/**'
- 'docker/cuda/**'
- 'docker/hygon/**'
- 'docker/musa/**'
- 'docker/build.sh'
- 'tools/install/**'
- 'requirements/**'
- '.github/workflows/build_image_cuda.yml'
- '.github/workflows/build_image_common.yml'
- '.github/workflows/build_image_hygon.yml'
- '.github/workflows/build_image_musa.yml'
- '.github/workflows/push_image_harbor.yml'
pull_request:
branches: ["main"]
paths-ignore:
- 'docs/**'
- 'docker/cuda/**'
- 'docker/hygon/**'
- 'docker/musa/**'
- 'docker/build.sh'
- 'tools/install/**'
- 'requirements/**'
- '.github/workflows/build_image_cuda.yml'
- '.github/workflows/build_image_common.yml'
- '.github/workflows/build_image_hygon.yml'
- '.github/workflows/build_image_musa.yml'
- '.github/workflows/push_image_harbor.yml'
workflow_dispatch:
inputs:
platform:
description: Platform test suite to run
required: true
default: all
type: choice
options:
- all
- cuda
- ascend
- hygon
- metax
- musa
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ github.actor }}
cancel-in-progress: true
jobs:
# ---------------------------------------------------------------------------
# Guard: skip CUDA tests when PR contains docker-related changes, because
# build_image_cuda.yml will handle build + test for those PRs.
# paths-ignore alone cannot guarantee mutual exclusivity when a PR touches
# both docker files and non-docker files, so we need this job-level check.
# ---------------------------------------------------------------------------
check_docker_changes:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
outputs:
has_docker_changes: ${{ steps.check.outputs.has_docker_changes }}
has_hygon_changes: ${{ steps.check.outputs.has_hygon_changes }}
steps:
- name: Check for docker-related file changes
id: check
env:
GH_TOKEN: ${{ github.token }}
run: |
CHANGED=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files --paginate --jq '.[].filename')
if echo "$CHANGED" | grep -qE '^(docker/cuda/|docker/build\.sh$|tools/install/|requirements/|\.github/workflows/build_image_cuda\.yml$)'; then
echo "has_docker_changes=true" >> $GITHUB_OUTPUT
else
echo "has_docker_changes=false" >> $GITHUB_OUTPUT
fi
if echo "$CHANGED" | grep -qE '^(\.github/configs/hygon\.yml$|tests/test_utils/config/platforms/hygon\.yaml$|tests/functional_tests/train/qwen3/.+hygon)'; then
echo "has_hygon_changes=true" >> $GITHUB_OUTPUT
else
echo "has_hygon_changes=false" >> $GITHUB_OUTPUT
fi
cuda_tests:
name: CUDA tests
needs: check_docker_changes
if: >-
(github.event_name != 'workflow_dispatch' || inputs.platform == 'all' || inputs.platform == 'cuda') &&
(github.event_name == 'push' || github.event_name == 'workflow_dispatch' || needs.check_docker_changes.outputs.has_docker_changes != 'true')
uses: ./.github/workflows/all_tests_common.yml
with:
platform: cuda
# Disable util the new devices ready
# ascend_tests:
# name: Ascend tests
# if: github.event_name != 'workflow_dispatch' || inputs.platform == 'all' || inputs.platform == 'ascend'
# uses: ./.github/workflows/all_tests_common.yml
# with:
# platform: ascend
metax_tests:
name: MetaX tests
if: github.event_name != 'workflow_dispatch' || inputs.platform == 'all' || inputs.platform == 'metax'
uses: ./.github/workflows/all_tests_common.yml
with:
platform: metax
musa_tests:
name: MThreads MUSA tests
# Use the verified MUSA image from the platform config for PR/push tests.
# New image builds remain an explicit concern of build_image_musa.yml.
if: github.event_name != 'workflow_dispatch' || inputs.platform == 'all' || inputs.platform == 'musa'
uses: ./.github/workflows/all_tests_common.yml
with:
platform: musa
hygon_tests:
name: Hygon BW1000 tests
needs: check_docker_changes
if: >-
always() &&
((github.event_name == 'workflow_dispatch' && (inputs.platform == 'all' || inputs.platform == 'hygon')) ||
(github.event_name == 'pull_request' && needs.check_docker_changes.outputs.has_hygon_changes == 'true'))
uses: ./.github/workflows/all_tests_common.yml
with:
platform: hygon
all_tests:
name: all_tests
needs:
- check_docker_changes
- cuda_tests
# - ascend_tests
- metax_tests
- musa_tests
- hygon_tests
runs-on: ubuntu-latest
if: always()
steps:
- name: Verify workflow status
run: |
failed=false
# if [ "${{ needs.check_docker_changes.outputs.has_docker_changes }}" = "true" ]; then
# echo "⏭️ CUDA tests skipped - docker changes detected, handled by build_image_cuda workflow"
# elif [ "${{ needs.cuda_tests.result }}" != "success" ] && \
# [ "${{ needs.cuda_tests.result }}" != "skipped" ]; then
# echo "❌ CUDA tests failed"
# failed=true
# fi
# echo "❌ Ascend tests failed"
if [ "${{ needs.metax_tests.result }}" != "success" ] && \
[ "${{ needs.metax_tests.result }}" != "skipped" ]; then
echo "❌ MetaX C550 tests failed"
failed=true
fi
if [ "${{ needs.musa_tests.result }}" != "success" ] && \
[ "${{ needs.musa_tests.result }}" != "skipped" ]; then
echo "MThreads MUSA tests failed"
failed=true
fi
if [ "${{ needs.hygon_tests.result }}" != "success" ] && \
[ "${{ needs.hygon_tests.result }}" != "skipped" ]; then
echo "Hygon BW1000 tests failed"
failed=true
fi
if [ "$failed" = "true" ]; then
exit 1
fi
echo "✅ All requested platform tests passed!"