Skip to content

Commit 63e6f97

Browse files
authored
Merge branch 'main' into feat/mthreads-spec-path-third-party
2 parents d58af32 + ced1983 commit 63e6f97

271 files changed

Lines changed: 35583 additions & 641 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/CODEOWNERS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
# the repo. Unless a later match takes precedence,
33
# @global-owner1 and @global-owner2 will be requested for
44
# review when someone opens a pull request.
5-
* @menchunlei @zhzhcookie @sunnycase
5+
6+
* @menchunlei @zhzhcookie @sunnycase @Galaxy1458
67

78
# --------
89
# Setup
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
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+
27+
# Check if the workflow is triggered by a Pull Request event
28+
if [ "${{ github.event_name }}" == "pull_request" ]; then
29+
FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }})
30+
else
31+
# Handle 'push' events (or other events where 'base_ref' isn't applicable)
32+
# Check if the 'before' SHA is all zeros, which indicates a newly created/pushed branch
33+
# or a force push where the previous history is missing.
34+
if [ "${{ github.event.before }}" == "0000000000000000000000000000000000000000" ]; then
35+
# Fallback: Try comparing with the immediate previous commit (HEAD~1).
36+
# If this fails (e.g., it's the very first commit of the entire repo), just list all files in the tree.
37+
FILES=$(git diff --name-only HEAD~1 HEAD 2>/dev/null || git ls-tree -r --name-only HEAD)
38+
else
39+
# For a standard push, find the files changed between the commit before the push and the current commit.
40+
FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }})
41+
fi
42+
fi
43+
44+
SHOULD_SKIP=true
45+
# If no changes were made, we need to run the CI process to avoid any misjudgments.
46+
if [ -z "$FILES" ]; then
47+
echo "No files changed, running CI by default"
48+
SHOULD_SKIP=false
49+
else
50+
while IFS= read -r file; do
51+
# Skip empty lines
52+
if [ -z "$file" ]; then
53+
continue
54+
fi
55+
# Current workflow file changed → always run
56+
if [[ "$file" == "$CURRENT_WORKFLOW" ]]; then
57+
echo "'$file' -> This workflow file changed, need to run"
58+
SHOULD_SKIP=false
59+
break
60+
fi
61+
# Check if the file is a documentation file (same logic as check-docs-only)
62+
if [[ ! "$file" =~ CMakeLists\.txt$ ]] && [[ "$file" =~ (\.(md|yml|txt|png|jpg|jpeg|gif|svg|ico|webp)$|CODEOWNERS$) ]]; then
63+
echo "'$file' -> Doc file, not relevant to CI decision"
64+
continue
65+
fi
66+
# It is a code file. Check whether it lives inside third_party/
67+
if [[ "$file" == third_party/* ]]; then
68+
if [[ "$file" == third_party/${BACKEND}/* ]]; then
69+
echo "'$file' -> Backend '$BACKEND' file changed, need to run"
70+
SHOULD_SKIP=false
71+
break
72+
else
73+
echo "'$file' -> Other backend file, not relevant to '$BACKEND'"
74+
continue
75+
fi
76+
else
77+
# Core code file (outside third_party/) — affects all backends
78+
echo "'$file' -> Core code file changed, need to run"
79+
SHOULD_SKIP=false
80+
break
81+
fi
82+
done <<< "$FILES"
83+
fi
84+
echo "should_skip=$SHOULD_SKIP" >> $GITHUB_OUTPUT
85+
if [ "$SHOULD_SKIP" == "true" ]; then
86+
echo "✅ No relevant files changed for backend '$BACKEND'. Will skip CI."
87+
else
88+
echo "🚀 Relevant files changed for backend '$BACKEND'. Will run CI."
89+
fi
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: 'Check if only docs changed'
2+
description: 'Check if only documentation files were modified'
3+
outputs:
4+
only_docs_changed:
5+
description: 'Whether only documentation files were changed'
6+
value: ${{ steps.check_files.outputs.only_docs_changed }}
7+
8+
runs:
9+
using: 'composite'
10+
steps:
11+
- name: Check if only docs files changed
12+
id: check_files
13+
shell: bash
14+
run: |
15+
# Extract current workflow file path from github.workflow_ref
16+
# Format: owner/repo/.github/workflows/file.yml@ref
17+
WORKFLOW_REF="${{ github.workflow_ref }}"
18+
CURRENT_WORKFLOW=$(echo "$WORKFLOW_REF" | sed 's/.*\/\(\.github\/workflows\/[^@]*\)@.*/\1/')
19+
echo "Current workflow file: $CURRENT_WORKFLOW"
20+
21+
if [ "${{ github.event_name }}" == "pull_request" ]; then
22+
FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }})
23+
else
24+
FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }})
25+
fi
26+
27+
ONLY_DOCS_CHANGED=true
28+
if [ -z "$FILES" ]; then
29+
echo "No files changed"
30+
ONLY_DOCS_CHANGED=false
31+
else
32+
while IFS= read -r file; do
33+
# Skip empty lines
34+
if [ -z "$file" ]; then
35+
continue
36+
fi
37+
if [[ "$file" == "$CURRENT_WORKFLOW" ]]; then
38+
echo "'$file' -> This workflow file changed, need to run build/test"
39+
ONLY_DOCS_CHANGED=false
40+
break
41+
fi
42+
if [[ "$file" =~ CMakeLists\.txt$ ]] || [[ ! "$file" =~ (\.(md|yml|txt|png|jpg|jpeg|gif|svg|ico|webp)$|CODEOWNERS$) ]]; then
43+
echo "'$file' -> Not a docs file, need to run build/test"
44+
ONLY_DOCS_CHANGED=false
45+
break
46+
fi
47+
done <<< "$FILES"
48+
fi
49+
50+
echo "only_docs_changed=$ONLY_DOCS_CHANGED" >> $GITHUB_OUTPUT
51+
if [ "$ONLY_DOCS_CHANGED" == "true" ]; then
52+
echo "✅ Only documentation files were modified. Will skip build and test."
53+
fi
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: 'Code Format Check'
2+
description: 'Run set up python, pre-commit, and auto-commit changes'
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- name: Setup Python
8+
uses: actions/setup-python@v5
9+
with:
10+
python-version: '3.11'
11+
12+
- name: Run pre-commit
13+
uses: pre-commit/action@v3.0.1
14+
15+
- name: Auto-commit changes
16+
uses: stefanzweifel/git-auto-commit-action@v4
17+
if: always()
18+
with:
19+
commit_message: Apply code-format changes
20+
commit_user_name: flagtree-bot
21+
commit_user_email: flagtree_ai@163.com
22+
commit_author: flagtree-bot <flagtree_ai@163.com>
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: 'Smart Checkout with Retry'
2+
description: 'Attempts to checkout code with multiple retries and sleep intervals'
3+
inputs:
4+
checkout_version:
5+
description: 'The version of actions/checkout to use'
6+
required: false
7+
default: 'v6'
8+
9+
runs:
10+
using: 'composite'
11+
steps:
12+
- name: Checkout code (attempt 1)
13+
id: checkout1
14+
uses: actions/checkout@v6
15+
with:
16+
fetch-depth: 0
17+
continue-on-error: true
18+
19+
- name: Sleep before checkout2
20+
if: steps.checkout1.outcome == 'failure'
21+
shell: bash
22+
run: |
23+
echo "First checkout attempt failed. Sleeping for 60 seconds before retry..."
24+
sleep 60
25+
26+
- name: Checkout code (attempt 2)
27+
id: checkout2
28+
if: steps.checkout1.outcome == 'failure'
29+
uses: actions/checkout@v6
30+
with:
31+
fetch-depth: 0
32+
continue-on-error: true
33+
34+
- name: Sleep before final checkout
35+
if: steps.checkout1.outcome == 'failure' && steps.checkout2.outcome == 'failure'
36+
shell: bash
37+
run: |
38+
echo "Second checkout attempt failed. Sleeping for 120 seconds before final retry..."
39+
sleep 120
40+
41+
- name: Checkout code (final attempt)
42+
if: steps.checkout1.outcome == 'failure' && steps.checkout2.outcome == 'failure'
43+
uses: actions/checkout@v6
44+
with:
45+
fetch-depth: 0
46+
47+
- name: Verify checkout success
48+
shell: bash
49+
if: success()
50+
run: echo "Checkout completed successfully"

.github/assets/Facebook.png

3.1 KB
Loading

.github/assets/FlagTree.png

18.7 KB
Loading

.github/assets/Linkedin.png

3.65 KB
Loading

.github/assets/banner-20260130.png

395 KB
Loading

.github/assets/discord.png

8.28 KB
Loading

0 commit comments

Comments
 (0)