forked from flagos-ai/TransformerEngine-FL
-
Notifications
You must be signed in to change notification settings - Fork 2
150 lines (127 loc) · 5.29 KB
/
Copy pathall_tests_common.yml
File metadata and controls
150 lines (127 loc) · 5.29 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
144
145
146
147
148
149
150
name: Common All Tests
on:
workflow_call:
inputs:
platform:
required: true
type: string
description: Platform name (e.g., cuda, default)
setup_commands:
required: false
type: string
default: ''
jobs:
checkout_and_config:
defaults:
run:
shell: bash
runs-on: ubuntu-latest
outputs:
ci_image: ${{ steps.config.outputs.ci_image }}
runs_on: ${{ steps.config.outputs.runs_on }}
container_volumes: ${{ steps.config.outputs.container_volumes }}
container_options: ${{ steps.config.outputs.container_options }}
device_types: ${{ steps.config.outputs.device_types }}
train_test_matrix: ${{ steps.config.outputs.train_test_matrix }}
ignored_tests: ${{ steps.config.outputs.ignored_tests }}
build_env: ${{ steps.config.outputs.build_env }}
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Check if tests should run
id: should_run
run: |
echo "should_run=true" >> $GITHUB_OUTPUT
- name: Load platform configuration
id: config
run: |
set -euo pipefail
PLATFORM="${{ inputs.platform }}"
CONFIG_FILE=".github/configs/${PLATFORM}.yml"
# Install mikefarah/yq (v4) for YAML parsing
sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/v4.45.1/yq_linux_amd64
sudo chmod +x /usr/local/bin/yq
/usr/local/bin/yq --version
echo "Loading configuration from $CONFIG_FILE"
# Read CI image
CI_IMAGE=$(yq '.ci_image' "$CONFIG_FILE")
echo "ci_image=$CI_IMAGE" >> $GITHUB_OUTPUT
# Read runner labels and format as JSON array
RUNS_ON=$(yq '.runner_labels | tojson(0)' "$CONFIG_FILE")
echo "runs_on=$RUNS_ON" >> $GITHUB_OUTPUT
# Read container volumes and format as JSON array
VOLUMES=$(yq '.container_volumes | tojson(0)' "$CONFIG_FILE")
echo "container_volumes=$VOLUMES" >> $GITHUB_OUTPUT
# Read container options
OPTIONS=$(yq '.container_options' "$CONFIG_FILE")
echo "container_options=$OPTIONS" >> $GITHUB_OUTPUT
# Read device types
DEVICE_TYPES=$(yq '.device_types | tojson(0)' "$CONFIG_FILE")
echo "device_types=$DEVICE_TYPES" >> $GITHUB_OUTPUT
# Read test matrix for training
TRAIN_MATRIX=$(yq '.test_matrix.functional.train | tojson(0)' "$CONFIG_FILE")
echo "train_test_matrix=$TRAIN_MATRIX" >> $GITHUB_OUTPUT
# Read ignored tests list from test_matrix.unit (default to empty array if not defined)
IGNORED_TESTS=$(yq '.test_matrix.unit.ignored_tests // [] | tojson(0)' "$CONFIG_FILE")
echo "ignored_tests=$IGNORED_TESTS" >> $GITHUB_OUTPUT
# Read build environment variables (default to empty object if not defined)
BUILD_ENV=$(yq '.build_env // {} | tojson(0)' "$CONFIG_FILE")
echo "build_env=$BUILD_ENV" >> $GITHUB_OUTPUT
unit_tests:
needs: checkout_and_config
strategy:
fail-fast: false
matrix:
device: ${{ fromJson(needs.checkout_and_config.outputs.device_types) }}
uses: ./.github/workflows/unit_tests_common.yml
name: unit_tests
with:
platform: ${{ inputs.platform }}
device: ${{ matrix.device }}
image: ${{ needs.checkout_and_config.outputs.ci_image }}
runs_on: ${{ needs.checkout_and_config.outputs.runs_on }}
container_volumes: ${{ needs.checkout_and_config.outputs.container_volumes }}
container_options: ${{ needs.checkout_and_config.outputs.container_options }}
setup_commands: ${{ inputs.setup_commands }}
ignored_tests: ${{ needs.checkout_and_config.outputs.ignored_tests }}
build_env: ${{ needs.checkout_and_config.outputs.build_env }}
# arguments.py not compatible with megatron-core-fl
# functional_tests:
# needs:
# - checkout_and_config
# if: fromJson(needs.checkout_and_config.outputs.train_test_matrix)[0] != null
# uses: ./.github/workflows/functional_tests_common.yml
# with:
# platform: ${{ inputs.platform }}
# test_matrix: ${{ needs.checkout_and_config.outputs.train_test_matrix }}
# image: ${{ needs.checkout_and_config.outputs.ci_image }}
# runs_on: ${{ needs.checkout_and_config.outputs.runs_on }}
# container_volumes: ${{ needs.checkout_and_config.outputs.container_volumes }}
# container_options: ${{ needs.checkout_and_config.outputs.container_options }}
all_tests_complete:
defaults:
run:
shell: bash
needs:
- checkout_and_config
- unit_tests
# - functional_tests
runs-on: ubuntu-latest
if: always()
steps:
- name: Verify all tests passed
run: |
# Check all test jobs (skip if not run)
failed=false
if [ "${{ needs.unit_tests.result }}" != "success" ]; then
echo "❌ Unit tests failed"
failed=true
fi
# if [ "${{ needs.functional_tests.result }}" != "success" ]; then
# echo "❌ Training functional tests failed"
# failed=true
# fi
if [ "$failed" = "true" ]; then
exit 1
fi
echo "✅ All tests completed successfully!"