forked from flagos-ai/FlagScale
-
Notifications
You must be signed in to change notification settings - Fork 0
143 lines (130 loc) · 4.89 KB
/
Copy pathall_tests.yml
File metadata and controls
143 lines (130 loc) · 4.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# 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/build.sh'
- 'tools/install/**'
- 'requirements/**'
- '.github/workflows/build_image_cuda.yml'
- '.github/workflows/push_image_harbor.yml'
pull_request:
branches: ["main"]
paths-ignore:
- 'docs/**'
- 'docker/cuda/**'
- 'docker/build.sh'
- 'tools/install/**'
- 'requirements/**'
- '.github/workflows/build_image_cuda.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
- metax
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 }}
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
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
all_tests:
name: all_tests
needs:
- check_docker_changes
- cuda_tests
# - ascend_tests
- metax_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
# if [ "${{ needs.ascend_tests.result }}" != "success" ] && \
# [ "${{ needs.ascend_tests.result }}" != "skipped" ]; then
# echo "❌ Ascend tests failed"
# failed=true
# fi
if [ "${{ needs.metax_tests.result }}" != "success" ] && \
[ "${{ needs.metax_tests.result }}" != "skipped" ]; then
echo "❌ MetaX C550 tests failed"
failed=true
fi
if [ "$failed" = "true" ]; then
exit 1
fi
echo "✅ All requested platform tests passed!"