Skip to content

Commit 85763c5

Browse files
committed
[CI] Optimize workflow triggers, permissions, and environment control
- Refine CI triggers: skip CI for Draft PRs, but trigger tests when transitioning to ready_for_review. - Add read permissions for `contents` and `pull-requests`. - Add environment cleanup step before FlagTree build. - Add conditional cache clearing step based on `ClearCache:<backend>` label before testing. Signed-off-by: Liu Haoyu <liuhaoyutz@126.com>
1 parent 167cd94 commit 85763c5

5 files changed

Lines changed: 73 additions & 4 deletions

File tree

.github/workflows/aipu3.3-build-and-test.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ on:
55
branches: [ "triton_v3.3.x" ]
66
pull_request:
77
branches: [ "triton_v3.3.x" ]
8+
types: [opened, synchronize, reopened, ready_for_review]
9+
10+
permissions:
11+
contents: read
12+
pull-requests: read
813

914
concurrency:
1015
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
@@ -13,7 +18,7 @@ concurrency:
1318
jobs:
1419
aipu-build-and-test:
1520
runs-on: aipu3.3
16-
if: ${{ github.repository == 'FlagTree/flagtree' || github.repository == 'flagos-ai/flagtree' }}
21+
if: ${{ github.repository == 'flagos-ai/flagtree' && github.event.pull_request.draft == false }}
1722
steps:
1823
- name: Setup environment
1924
shell: bash
@@ -32,6 +37,10 @@ jobs:
3237
with:
3338
backend: aipu
3439

40+
- name: Cleanup FlagTree Environment
41+
if: steps.check_backend.outputs.should_skip != 'true'
42+
uses: flagos-ai/FlagTree/.github/actions/cleanup-flagtree-env@main
43+
3544
- name: FlagTree Build on AIPU
3645
if: steps.check_backend.outputs.should_skip != 'true'
3746
shell: bash
@@ -43,6 +52,14 @@ jobs:
4352
cd python
4453
MAX_JOBS=32 python3.10 -m pip install . --no-build-isolation
4554
55+
- name: Clear cache if ClearCache label present
56+
if: steps.check_backend.outputs.should_skip != 'true'
57+
id: clear_cache
58+
uses: flagos-ai/FlagTree/.github/actions/clear-cache-if-labeled@main
59+
with:
60+
github-token: ${{ secrets.GITHUB_TOKEN }}
61+
backend: aipu
62+
4663
- name: FlagTree Test on AIPU
4764
if: steps.check_backend.outputs.should_skip != 'true'
4865
shell: bash

.github/workflows/code-format-check.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
branches: [ "main", "triton_v3.2.x", "triton_v3.3.x", "triton_v3.4.x", "triton_v3.5.x"]
88
pull_request:
99
branches: [ "main", "triton_v3.2.x", "triton_v3.3.x", "triton_v3.4.x", "triton_v3.5.x"]
10+
types: [opened, synchronize, reopened, ready_for_review]
1011

1112
concurrency:
1213
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}

.github/workflows/enflame3.3-gcu300-build-and-test.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ on:
55
branches: [ "triton_v3.3.x" ]
66
pull_request:
77
branches: [ "triton_v3.3.x"]
8+
types: [opened, synchronize, reopened, ready_for_review]
9+
10+
permissions:
11+
contents: read
12+
pull-requests: read
813

914
concurrency:
1015
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
@@ -13,7 +18,7 @@ concurrency:
1318
jobs:
1419
enflame-build-and-test:
1520
runs-on: enflame3.3-gcu300
16-
if: ${{ github.repository == 'FlagTree/flagtree' || github.repository == 'flagos-ai/flagtree' }}
21+
if: ${{ github.repository == 'flagos-ai/flagtree' && github.event.pull_request.draft == false }}
1722
steps:
1823
- name: Setup environment
1924
shell: bash
@@ -32,6 +37,10 @@ jobs:
3237
with:
3338
backend: enflame
3439

40+
- name: Cleanup FlagTree Environment
41+
if: steps.check_backend.outputs.should_skip != 'true'
42+
uses: flagos-ai/FlagTree/.github/actions/cleanup-flagtree-env@main
43+
3544
- name: Detect Target Branch
3645
shell: bash
3746
run: |
@@ -55,6 +64,14 @@ jobs:
5564
cd python
5665
MAX_JOBS=32 python3 -m pip install . --no-build-isolation
5766
67+
- name: Clear cache if ClearCache label present
68+
if: steps.check_backend.outputs.should_skip != 'true'
69+
id: clear_cache
70+
uses: flagos-ai/FlagTree/.github/actions/clear-cache-if-labeled@main
71+
with:
72+
github-token: ${{ secrets.GITHUB_TOKEN }}
73+
backend: enflame
74+
5875
- name: FlagTree Test on Enflame
5976
if: steps.check_backend.outputs.should_skip != 'true'
6077
shell: bash

.github/workflows/nv3.3-build-and-test.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ on:
77
branches: [ "main", "triton_v3.2.x", "triton_v3.3.x" ]
88
pull_request:
99
branches: [ "main", "triton_v3.2.x", "triton_v3.3.x" ]
10+
types: [opened, synchronize, reopened, ready_for_review]
11+
12+
permissions:
13+
contents: read
14+
pull-requests: read
1015

1116
concurrency:
1217
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
@@ -15,7 +20,7 @@ concurrency:
1520
jobs:
1621
nv-build-and-test:
1722
runs-on: nvidia3.3
18-
if: ${{ github.repository == 'FlagTree/flagtree' || github.repository == 'flagos-ai/flagtree' }}
23+
if: ${{ github.repository == 'flagos-ai/flagtree' && github.event.pull_request.draft == false }}
1924
steps:
2025
- name: Setup environment
2126
shell: bash
@@ -34,6 +39,10 @@ jobs:
3439
with:
3540
backend: nvidia
3641

42+
- name: Cleanup FlagTree Environment
43+
if: steps.check_backend.outputs.should_skip != 'true'
44+
uses: flagos-ai/FlagTree/.github/actions/cleanup-flagtree-env@main
45+
3746
- name: Detect Target Branch
3847
shell: bash
3948
run: |
@@ -76,6 +85,14 @@ jobs:
7685
cd python
7786
MAX_JOBS=32 python3 -m pip install . --no-build-isolation
7887
88+
- name: Clear cache if ClearCache label present
89+
if: steps.check_backend.outputs.should_skip != 'true'
90+
id: clear_cache
91+
uses: flagos-ai/FlagTree/.github/actions/clear-cache-if-labeled@main
92+
with:
93+
github-token: ${{ secrets.GITHUB_TOKEN }}
94+
backend: nvidia
95+
7996
- name: FlagTree Test on NVidia
8097
if: steps.check_backend.outputs.should_skip != 'true'
8198
shell: bash

.github/workflows/tsingmicro3.3-build-and-test.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ on:
55
branches: [ "triton_v3.3.x" ]
66
pull_request:
77
branches: [ "triton_v3.3.x" ]
8+
types: [opened, synchronize, reopened, ready_for_review]
9+
10+
permissions:
11+
contents: read
12+
pull-requests: read
813

914
concurrency:
1015
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
@@ -13,7 +18,7 @@ concurrency:
1318
jobs:
1419
tsingmicro-build-and-test:
1520
runs-on: tsingmicro3.3
16-
if: ${{ github.repository == 'FlagTree/flagtree' || github.repository == 'flagos-ai/flagtree' }}
21+
if: ${{ github.repository == 'flagos-ai/flagtree' && github.event.pull_request.draft == false }}
1722
steps:
1823
- name: Setup environment
1924
shell: bash
@@ -32,6 +37,10 @@ jobs:
3237
with:
3338
backend: tsingmicro
3439

40+
- name: Cleanup FlagTree Environment
41+
if: steps.check_backend.outputs.should_skip != 'true'
42+
uses: flagos-ai/FlagTree/.github/actions/cleanup-flagtree-env@main
43+
3544
- name: FlagTree Build on Tsingmicro
3645
if: steps.check_backend.outputs.should_skip != 'true'
3746
shell: bash
@@ -49,6 +58,14 @@ jobs:
4958
cd python
5059
python3 -m pip install . --no-build-isolation
5160
61+
- name: Clear cache if ClearCache label present
62+
if: steps.check_backend.outputs.should_skip != 'true'
63+
id: clear_cache
64+
uses: flagos-ai/FlagTree/.github/actions/clear-cache-if-labeled@main
65+
with:
66+
github-token: ${{ secrets.GITHUB_TOKEN }}
67+
backend: tsingmicro
68+
5269
- name: FlagTree Test on Tsingmicro
5370
if: steps.check_backend.outputs.should_skip != 'true'
5471
shell: bash

0 commit comments

Comments
 (0)