Skip to content

Commit b4ce42f

Browse files
authored
Merge branch 'main' into update_docker_readme_20260406
2 parents f1ca2ad + 915594a commit b4ce42f

33 files changed

+692
-92
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: 'Check if backend-relevant files changed'
2+
description: 'Determine whether the CI for a given backend should run or be skipped'
3+
inputs:
4+
backend:
5+
description: 'Backend name matching its third_party/ subdirectory (e.g. xpu, nvidia, hcu)'
6+
required: true
7+
outputs:
8+
should_skip:
9+
description: 'true if no backend-relevant files changed and CI can be safely skipped'
10+
value: ${{ steps.check.outputs.should_skip }}
11+
12+
runs:
13+
using: 'composite'
14+
steps:
15+
- name: Check if backend-relevant files changed
16+
id: check
17+
shell: bash
18+
run: |
19+
BACKEND="${{ inputs.backend }}"
20+
# Extract current workflow file path from github.workflow_ref
21+
# Format: owner/repo/.github/workflows/file.yml@ref
22+
WORKFLOW_REF="${{ github.workflow_ref }}"
23+
CURRENT_WORKFLOW=$(echo "$WORKFLOW_REF" | sed 's/.*\/\(\.github\/workflows\/[^@]*\)@.*/\1/')
24+
echo "Current workflow file: $CURRENT_WORKFLOW"
25+
echo "Backend: $BACKEND"
26+
if [ "${{ github.event_name }}" == "pull_request" ]; then
27+
FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }})
28+
else
29+
FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }})
30+
fi
31+
SHOULD_SKIP=true
32+
# If no changes were made, we need to run the CI process to avoid any misjudgments.
33+
if [ -z "$FILES" ]; then
34+
echo "No files changed, running CI by default"
35+
SHOULD_SKIP=false
36+
else
37+
while IFS= read -r file; do
38+
# Skip empty lines
39+
if [ -z "$file" ]; then
40+
continue
41+
fi
42+
# Current workflow file changed → always run
43+
if [[ "$file" == "$CURRENT_WORKFLOW" ]]; then
44+
echo "'$file' -> This workflow file changed, need to run"
45+
SHOULD_SKIP=false
46+
break
47+
fi
48+
# Check if the file is a documentation file (same logic as check-docs-only)
49+
if [[ ! "$file" =~ CMakeLists\.txt$ ]] && [[ "$file" =~ (\.(md|yml|txt)$|CODEOWNERS$) ]]; then
50+
echo "'$file' -> Doc file, not relevant to CI decision"
51+
continue
52+
fi
53+
# It is a code file. Check whether it lives inside third_party/
54+
if [[ "$file" == third_party/* ]]; then
55+
if [[ "$file" == third_party/${BACKEND}/* ]]; then
56+
echo "'$file' -> Backend '$BACKEND' file changed, need to run"
57+
SHOULD_SKIP=false
58+
break
59+
else
60+
echo "'$file' -> Other backend file, not relevant to '$BACKEND'"
61+
continue
62+
fi
63+
else
64+
# Core code file (outside third_party/) — affects all backends
65+
echo "'$file' -> Core code file changed, need to run"
66+
SHOULD_SKIP=false
67+
break
68+
fi
69+
done <<< "$FILES"
70+
fi
71+
echo "should_skip=$SHOULD_SKIP" >> $GITHUB_OUTPUT
72+
if [ "$SHOULD_SKIP" == "true" ]; then
73+
echo "✅ No relevant files changed for backend '$BACKEND'. Will skip CI."
74+
else
75+
echo "🚀 Relevant files changed for backend '$BACKEND'. Will run CI."
76+
fi

.github/new-prs-labeler.yml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# Labels applied to PRs based on the files changed.
2+
# Backend labels are set when any file under the backend's third_party/ directory changes.
3+
# The DOC label is set when every changed file is a documentation file
4+
# (matches the same "docs-only" definition used by check-docs-only action:
5+
# *.md / *.yml / *.txt / CODEOWNERS, but NOT CMakeLists.txt).
6+
7+
# ---- Backend labels ----
8+
9+
nvidia:
10+
- changed-files:
11+
- any-glob-to-any-file:
12+
- 'third_party/nvidia/**'
13+
14+
xpu:
15+
- changed-files:
16+
- any-glob-to-any-file:
17+
- 'third_party/xpu/**'
18+
19+
hcu:
20+
- changed-files:
21+
- any-glob-to-any-file:
22+
- 'third_party/hcu/**'
23+
24+
metax:
25+
- changed-files:
26+
- any-glob-to-any-file:
27+
- 'third_party/metax/**'
28+
29+
iluvatar:
30+
- changed-files:
31+
- any-glob-to-any-file:
32+
- 'third_party/iluvatar/**'
33+
34+
mthreads:
35+
- changed-files:
36+
- any-glob-to-any-file:
37+
- 'third_party/mthreads/**'
38+
39+
f2reduce:
40+
- changed-files:
41+
- any-glob-to-any-file:
42+
- 'third_party/f2reduce/**'
43+
44+
amd:
45+
- changed-files:
46+
- any-glob-to-any-file:
47+
- 'third_party/amd/**'
48+
49+
cambricon:
50+
- changed-files:
51+
- any-glob-to-any-file:
52+
- 'third_party/cambricon/**'
53+
54+
proton:
55+
- changed-files:
56+
- any-glob-to-any-file:
57+
- 'third_party/proton/**'
58+
59+
ascend:
60+
- changed-files:
61+
- any-glob-to-any-file:
62+
- 'third_party/ascend/**'
63+
64+
tle:
65+
- changed-files:
66+
- any-glob-to-any-file:
67+
- 'third_party/tle/**'
68+
69+
aipu:
70+
- changed-files:
71+
- any-glob-to-any-file:
72+
- 'third_party/aipu/**'
73+
74+
enflame:
75+
- changed-files:
76+
- any-glob-to-any-file:
77+
- 'third_party/enflame/**'
78+
79+
tsingmicro:
80+
- changed-files:
81+
- any-glob-to-any-file:
82+
- 'third_party/tsingmicro/**'
83+
84+
sunrise:
85+
- changed-files:
86+
- any-glob-to-any-file:
87+
- 'third_party/sunrise/**'
88+
89+
90+
91+
# ---- DOC label ----
92+
# This label is applied ONLY when the PR consists exclusively of documentation.
93+
# It uses a strict inclusion list combined with an explicit exclusion of build files
94+
# to ensure no functional code changes are mislabeled as "DOC".
95+
96+
DOC:
97+
- all:
98+
# Condition A: All must be document file extensions
99+
- changed-files:
100+
- any-glob-to-all-files:
101+
- '**/*.md'
102+
- '**/*.yml'
103+
- '**/*.txt'
104+
- '**/CODEOWNERS'
105+
106+
# Condition B: Must not contain CMakeLists.txt
107+
- changed-files:
108+
- all-globs-to-all-files:
109+
- '!**/CMakeLists.txt'

.github/workflows/aipu-delivery.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ on:
1616
PLATFORM:
1717
required: true
1818
default: 'x86_64'
19+
FLAGTREE_PYPI_KEY:
20+
required: false
1921
workflow_call:
2022
inputs:
2123
WHL_VER:
@@ -30,6 +32,9 @@ on:
3032
type: string
3133
required: true
3234
default: 'x86_64'
35+
FLAGTREE_PYPI_KEY:
36+
type: string
37+
required: false
3338

3439
concurrency:
3540
group: ${{ github.workflow }}-${{ inputs.WHL_VER }}-${{ inputs.PYTHON_VER }}-${{ inputs.PLATFORM }}
@@ -85,6 +90,7 @@ jobs:
8590
source ~/env_setup.sh # aipu
8691
cd python
8792
rm -rf ./build ./*.egg-info
93+
{ export FLAGTREE_PYPI_KEY=${{ inputs.FLAGTREE_PYPI_KEY }}; } 2>/dev/null
8894
MAX_JOBS=32 python${PYTHON_VER} setup.py bdist_wheel -d ~/dist-flagtree
8995
env | grep -E '^(FLAGTREE_WHEEL_VERSION)=' >> $GITHUB_ENV || true
9096

.github/workflows/ascend-delivery.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ on:
1616
PLATFORM:
1717
required: true
1818
default: 'aarch64'
19+
FLAGTREE_PYPI_KEY:
20+
required: false
1921
workflow_call:
2022
inputs:
2123
WHL_VER:
@@ -30,6 +32,9 @@ on:
3032
type: string
3133
required: true
3234
default: 'aarch64'
35+
FLAGTREE_PYPI_KEY:
36+
type: string
37+
required: false
3338

3439
concurrency:
3540
group: ${{ github.workflow }}-${{ inputs.WHL_VER }}-${{ inputs.PYTHON_VER }}-${{ inputs.PLATFORM }}
@@ -84,6 +89,7 @@ jobs:
8489
8590
cd python
8691
rm -rf ./build ./*.egg-info
92+
{ export FLAGTREE_PYPI_KEY=${{ inputs.FLAGTREE_PYPI_KEY }}; } 2>/dev/null
8793
MAX_JOBS=32 python${PYTHON_VER} setup.py bdist_wheel -d ~/dist-flagtree
8894
env | grep -E '^(FLAGTREE_WHEEL_VERSION)=' >> $GITHUB_ENV || true
8995

.github/workflows/enflame-gcu300-delivery.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ on:
1616
PLATFORM:
1717
required: true
1818
default: 'x86_64'
19+
FLAGTREE_PYPI_KEY:
20+
required: false
1921
workflow_call:
2022
inputs:
2123
WHL_VER:
@@ -30,6 +32,9 @@ on:
3032
type: string
3133
required: true
3234
default: 'x86_64'
35+
FLAGTREE_PYPI_KEY:
36+
type: string
37+
required: false
3338

3439
concurrency:
3540
group: ${{ github.workflow }}-${{ inputs.WHL_VER }}-${{ inputs.PYTHON_VER }}-${{ inputs.PLATFORM }}
@@ -83,6 +88,7 @@ jobs:
8388
fi
8489
8590
rm -rf ./build ./*.egg-info
91+
{ export FLAGTREE_PYPI_KEY=${{ inputs.FLAGTREE_PYPI_KEY }}; } 2>/dev/null
8692
MAX_JOBS=4 python${PYTHON_VER} setup.py bdist_wheel -d ~/dist-flagtree # enflame-gcu300
8793
env | grep -E '^(FLAGTREE_WHEEL_VERSION)=' >> $GITHUB_ENV || true
8894

.github/workflows/enflame-gcu400-delivery.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ on:
1616
PLATFORM:
1717
required: true
1818
default: 'x86_64'
19+
FLAGTREE_PYPI_KEY:
20+
required: false
1921
workflow_call:
2022
inputs:
2123
WHL_VER:
@@ -30,6 +32,9 @@ on:
3032
type: string
3133
required: true
3234
default: 'x86_64'
35+
FLAGTREE_PYPI_KEY:
36+
type: string
37+
required: false
3338

3439
concurrency:
3540
group: ${{ github.workflow }}-${{ inputs.WHL_VER }}-${{ inputs.PYTHON_VER }}-${{ inputs.PLATFORM }}
@@ -83,6 +88,7 @@ jobs:
8388
fi
8489
8590
rm -rf ./build ./*.egg-info
91+
{ export FLAGTREE_PYPI_KEY=${{ inputs.FLAGTREE_PYPI_KEY }}; } 2>/dev/null
8692
MAX_JOBS=32 python${PYTHON_VER} setup.py bdist_wheel -d ~/dist-flagtree
8793
env | grep -E '^(FLAGTREE_WHEEL_VERSION)=' >> $GITHUB_ENV || true
8894

.github/workflows/hcu-build-and-test.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@ jobs:
2626
with:
2727
checkout_version: 'v6'
2828

29-
- name: Check if only docs files changed
30-
id: check_files
31-
uses: flagos-ai/FlagTree/.github/actions/check-docs-only@main
29+
- name: Check if backend-relevant files changed
30+
id: check_backend
31+
uses: flagos-ai/FlagTree/.github/actions/check-backend-changed@main
32+
with:
33+
backend: hcu
3234

3335
- name: FlagTree Build on Hcu
34-
if: steps.check_files.outputs.only_docs_changed != 'true'
36+
if: steps.check_backend.outputs.should_skip != 'true'
3537
shell: bash
3638
run: |
3739
set -x
@@ -41,7 +43,7 @@ jobs:
4143
MAX_JOBS=32 python3 -m pip install . --no-build-isolation
4244
4345
- name: FlagTree Test on Hcu
44-
if: steps.check_files.outputs.only_docs_changed != 'true'
46+
if: steps.check_backend.outputs.should_skip != 'true'
4547
shell: bash
4648
run: |
4749
set -x

.github/workflows/hcu-delivery.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ on:
1616
PLATFORM:
1717
required: true
1818
default: 'x86_64'
19+
FLAGTREE_PYPI_KEY:
20+
required: false
1921
workflow_call:
2022
inputs:
2123
WHL_VER:
@@ -30,6 +32,9 @@ on:
3032
type: string
3133
required: true
3234
default: 'x86_64'
35+
FLAGTREE_PYPI_KEY:
36+
type: string
37+
required: false
3338

3439
concurrency:
3540
group: ${{ github.workflow }}-${{ inputs.WHL_VER }}-${{ inputs.PYTHON_VER }}-${{ inputs.PLATFORM }}
@@ -84,6 +89,7 @@ jobs:
8489
8590
cd python
8691
rm -rf ./build ./*.egg-info
92+
{ export FLAGTREE_PYPI_KEY=${{ inputs.FLAGTREE_PYPI_KEY }}; } 2>/dev/null
8793
MAX_JOBS=32 python${PYTHON_VER} setup.py bdist_wheel -d ~/dist-flagtree
8894
env | grep -E '^(FLAGTREE_WHEEL_VERSION)=' >> $GITHUB_ENV || true
8995

.github/workflows/hopper-delivery.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ on:
1616
PLATFORM:
1717
required: true
1818
default: 'x86_64'
19+
FLAGTREE_PYPI_KEY:
20+
required: false
1921
workflow_call:
2022
inputs:
2123
WHL_VER:
@@ -30,6 +32,9 @@ on:
3032
type: string
3133
required: true
3234
default: 'x86_64'
35+
FLAGTREE_PYPI_KEY:
36+
type: string
37+
required: false
3338

3439
concurrency:
3540
group: ${{ github.workflow }}-${{ inputs.WHL_VER }}-${{ inputs.PYTHON_VER }}-${{ inputs.PLATFORM }}
@@ -84,6 +89,7 @@ jobs:
8489
fi
8590
8691
rm -rf ./build ./*.egg-info
92+
{ export FLAGTREE_PYPI_KEY=${{ inputs.FLAGTREE_PYPI_KEY }}; } 2>/dev/null
8793
MAX_JOBS=32 python${PYTHON_VER} setup.py bdist_wheel -d ~/dist-flagtree
8894
env | grep -E '^(FLAGTREE_WHEEL_VERSION)=' >> $GITHUB_ENV || true
8995
@@ -109,6 +115,7 @@ jobs:
109115
fi
110116
111117
rm -rf ./build ./*.egg-info
118+
{ export FLAGTREE_PYPI_KEY=${{ inputs.FLAGTREE_PYPI_KEY }}; } 2>/dev/null
112119
MAX_JOBS=32 python${PYTHON_VER} setup.py bdist_wheel -d ~/dist-flagtree
113120
env | grep -E '^(FLAGTREE_WHEEL_VERSION)=' >> $GITHUB_ENV || true
114121
@@ -134,6 +141,7 @@ jobs:
134141
fi
135142
136143
rm -rf ./build ./*.egg-info
144+
{ export FLAGTREE_PYPI_KEY=${{ inputs.FLAGTREE_PYPI_KEY }}; } 2>/dev/null
137145
MAX_JOBS=32 python${PYTHON_VER} setup.py bdist_wheel -d ~/dist-flagtree
138146
env | grep -E '^(FLAGTREE_WHEEL_VERSION)=' >> $GITHUB_ENV || true
139147

0 commit comments

Comments
 (0)