Skip to content

Commit 9ce0c31

Browse files
authored
[CI] More fix (#3308)
* Add concurrency groups to PR workflows * Fix concurrency grouping to prevent cross-event cancellation * Refine concurrency groups to prevent cross-label cancellation * Replace ci:run_full with ci:full (sticky superset behavior) * Consolidate PR workflows into single pr_test.yml * Remove extended scope from suites (use all instead)
1 parent f9b5230 commit 9ce0c31

File tree

5 files changed

+125
-171
lines changed

5 files changed

+125
-171
lines changed

.github/workflows/pr_full.yml

Lines changed: 0 additions & 55 deletions
This file was deleted.

.github/workflows/pr_ready.yml

Lines changed: 0 additions & 92 deletions
This file was deleted.

.github/workflows/pr_test.yml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: PR Tests
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- synchronize
7+
- labeled
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
gatekeeper:
15+
runs-on: ubuntu-latest
16+
outputs:
17+
scope: ${{ steps.check-scope.outputs.scope }}
18+
steps:
19+
- name: check-scope
20+
id: check-scope
21+
run: |
22+
SCOPE="none"
23+
LABELS="${{ toJSON(github.event.pull_request.labels.*.name) }}"
24+
25+
if [[ "$LABELS" == *"ci:full"* ]]; then
26+
SCOPE="all"
27+
elif [[ "$LABELS" == *"ci:ready"* ]]; then
28+
SCOPE="basic"
29+
fi
30+
31+
# Handle label removal or other events where we shouldn't run if no labels match
32+
if [[ "${{ github.event.action }}" == "labeled" ]]; then
33+
if [[ "${{ github.event.label.name }}" != "ci:ready" && "${{ github.event.label.name }}" != "ci:full" ]]; then
34+
# Triggered by unrelated label
35+
SCOPE="none"
36+
fi
37+
fi
38+
39+
echo "scope=$SCOPE" >> $GITHUB_OUTPUT
40+
41+
call-core:
42+
needs: gatekeeper
43+
if: needs.gatekeeper.outputs.scope != 'none'
44+
uses: ./.github/workflows/suite_core.yml
45+
with:
46+
trigger-sha: ${{ github.event.pull_request.head.sha }}
47+
secrets:
48+
tflm-bot-token: ${{ secrets.TFLM_BOT_PACKAGE_READ_TOKEN }}
49+
50+
call-check-tflite-files:
51+
needs: gatekeeper
52+
if: needs.gatekeeper.outputs.scope != 'none'
53+
uses: ./.github/workflows/check_tflite_files.yml
54+
with:
55+
trigger-sha: ${{ github.event.pull_request.head.sha }}
56+
pr-number: ${{ github.event.pull_request.number }}
57+
pr-body: ${{ github.event.pull_request.body }}
58+
secrets:
59+
tflm-bot-token: ${{ secrets.TFLM_BOT_PACKAGE_READ_TOKEN }}
60+
61+
call-hexagon:
62+
needs: gatekeeper
63+
if: needs.gatekeeper.outputs.scope != 'none'
64+
uses: ./.github/workflows/suite_hexagon.yml
65+
with:
66+
trigger-sha: ${{ github.event.pull_request.head.sha }}
67+
secrets:
68+
tflm-bot-token: ${{ secrets.TFLM_BOT_PACKAGE_READ_TOKEN }}
69+
70+
call-cortex-m:
71+
needs: gatekeeper
72+
if: needs.gatekeeper.outputs.scope != 'none'
73+
uses: ./.github/workflows/suite_cortex_m.yml
74+
with:
75+
trigger-sha: ${{ github.event.pull_request.head.sha }}
76+
scope: ${{ needs.gatekeeper.outputs.scope }}
77+
secrets:
78+
tflm-bot-token: ${{ secrets.TFLM_BOT_PACKAGE_READ_TOKEN }}
79+
80+
call-xtensa:
81+
needs: gatekeeper
82+
if: needs.gatekeeper.outputs.scope != 'none'
83+
uses: ./.github/workflows/suite_xtensa.yml
84+
with:
85+
trigger-sha: ${{ github.event.pull_request.head.sha }}
86+
scope: ${{ needs.gatekeeper.outputs.scope }}
87+
secrets:
88+
tflm-bot-token: ${{ secrets.TFLM_BOT_PACKAGE_READ_TOKEN }}
89+
90+
call-riscv:
91+
needs: gatekeeper
92+
if: needs.gatekeeper.outputs.scope == 'all'
93+
uses: ./.github/workflows/suite_riscv.yml
94+
with:
95+
trigger-sha: ${{ github.event.pull_request.head.sha }}
96+
secrets:
97+
tflm-bot-token: ${{ secrets.TFLM_BOT_PACKAGE_READ_TOKEN }}
98+
99+
tests-passed:
100+
needs: [gatekeeper, call-core, call-check-tflite-files, call-hexagon, call-cortex-m, call-xtensa, call-riscv]
101+
if: always()
102+
runs-on: ubuntu-latest
103+
steps:
104+
- run: |
105+
# If skipped, result is 'skipped' or 'success' depending on logic?
106+
# needs.*.result contains 'skipped' if job didn't run.
107+
# We fail if any result is 'failure' or 'cancelled'.
108+
if [[ "${{ contains(needs.*.result, 'failure') }}" == "true" || "${{ contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
109+
echo "One or more dependent jobs failed."
110+
exit 1
111+
fi
112+
# If gatekeeper said none, everything skipped. That's success (nothing failed).
113+
exit 0

.github/workflows/suite_cortex_m.yml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
required: true
88
type: string
99
scope:
10-
description: 'Scope of tests to run (basic, extended, or all)'
10+
description: 'Scope of tests to run (basic or all)'
1111
required: false
1212
type: string
1313
default: 'all'
@@ -71,7 +71,7 @@ jobs:
7171
# --- GCC Tests ---
7272

7373
generic_gcc:
74-
if: inputs.scope == 'extended' || inputs.scope == 'all'
74+
if: inputs.scope == 'all'
7575
runs-on: ubuntu-latest
7676
name: Cortex-M Generic (GCC)
7777
steps:
@@ -90,7 +90,7 @@ jobs:
9090
tensorflow/lite/micro/tools/ci_build/test_cortex_m_generic.sh
9191
9292
corstone_300_gcc:
93-
if: inputs.scope == 'extended' || inputs.scope == 'all'
93+
if: inputs.scope == 'all'
9494
runs-on: ubuntu-latest
9595
name: Cortex-M Corstone 300 (GCC)
9696
steps:
@@ -111,7 +111,7 @@ jobs:
111111
# --- Arm Clang Tests ---
112112

113113
generic_armclang:
114-
if: inputs.scope == 'extended' || inputs.scope == 'all'
114+
if: inputs.scope == 'all'
115115
runs-on: ubuntu-latest
116116
name: Cortex-M Generic (Arm Clang)
117117
steps:
@@ -136,7 +136,7 @@ jobs:
136136
tensorflow/lite/micro/tools/ci_build/test_cortex_m_generic.sh armclang
137137
138138
corstone_300_armclang:
139-
if: inputs.scope == 'extended' || inputs.scope == 'all'
139+
if: inputs.scope == 'all'
140140
runs-on: ubuntu-latest
141141
name: Cortex-M Corstone 300 (Arm Clang)
142142
steps:
@@ -159,9 +159,3 @@ jobs:
159159
- name: Test
160160
run: |
161161
tensorflow/lite/micro/tools/ci_build/test_cortex_m_corstone_300.sh armclang
162-
- uses: actions/upload-artifact@v6
163-
with:
164-
name: my-artifact
165-
path: |
166-
tensorflow/
167-
gen/

.github/workflows/suite_xtensa.yml

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
required: true
88
type: string
99
scope:
10-
description: 'Scope of tests to run (basic, extended, or all)'
10+
description: 'Scope of tests to run (basic or all)'
1111
required: false
1212
type: string
1313
default: 'all'
@@ -96,7 +96,7 @@ jobs:
9696
# --- Extended Jobs ---
9797

9898
f1_unit_tests:
99-
if: inputs.scope == 'extended' || inputs.scope == 'all'
99+
if: inputs.scope == 'all'
100100
runs-on: ubuntu-latest
101101
name: Fusion F1 Unit Tests
102102
steps:
@@ -106,12 +106,10 @@ jobs:
106106
- run: |
107107
rm -rf .git
108108
echo ${{ secrets.tflm-bot-token }} | docker login ghcr.io -u tflm-bot --password-stdin
109-
docker run --env XTENSA_TOOLS_VERSION=RI-2020.4-linux --rm -v `pwd`:/opt/tflite-micro ghcr.io/tflm-bot/xtensa_xplorer_13:0.3 \
110-
/bin/bash -c \
111-
"cd /opt && tflite-micro/tensorflow/lite/micro/tools/ci_build/test_xtensa_fusion_f1.sh EXTERNAL tflite-micro/"
109+
docker run --env XTENSA_TOOLS_VERSION=RI-2020.4-linux --rm -v `pwd`:/opt/tflite-micro ghcr.io/tflm-bot/xtensa_fusion_f1.sh EXTERNAL tflite-micro/"
112110
113111
vision_p6_extended:
114-
if: inputs.scope == 'extended' || inputs.scope == 'all'
112+
if: inputs.scope == 'all'
115113
runs-on: ubuntu-latest
116114
name: Vision P6 Unit Tests
117115
steps:
@@ -121,12 +119,10 @@ jobs:
121119
- run: |
122120
rm -rf .git
123121
echo ${{ secrets.tflm-bot-token }} | docker login ghcr.io -u tflm-bot --password-stdin
124-
docker run --env XTENSA_TOOLS_VERSION=RI-2020.4-linux --rm -v `pwd`:/opt/tflite-micro ghcr.io/tflm-bot/xtensa_xplorer_13:0.3 \
125-
/bin/bash -c \
126-
"cd /opt && tflite-micro/tensorflow/lite/micro/tools/ci_build/test_xtensa_vision_p6.sh RUN_TESTS tflite-micro/"
122+
docker run --env XTENSA_TOOLS_VERSION=RI-2020.4-linux --rm -v `pwd`:/opt/tflite-micro ghcr.io/tflm-bot/xtensa_vision_p6.sh RUN_TESTS tflite-micro/"
127123
128124
hifimini_unit_tests:
129-
if: inputs.scope == 'extended' || inputs.scope == 'all'
125+
if: inputs.scope == 'all'
130126
runs-on: ubuntu-latest
131127
name: Hifimini Unit Tests
132128
steps:
@@ -136,6 +132,4 @@ jobs:
136132
- run: |
137133
rm -rf .git
138134
echo ${{ secrets.tflm-bot-token }} | docker login ghcr.io -u tflm-bot --password-stdin
139-
docker run --env XTENSA_TOOLS_VERSION=RI-2019.2-linux --rm -v `pwd`:/opt/tflite-micro ghcr.io/tflm-bot/xtensa_xplorer_11:0.2 \
140-
/bin/bash -c \
141-
"cd /opt && tflite-micro/tensorflow/lite/micro/tools/ci_build/test_xtensa_hifimini.sh tflite-micro/"
135+
docker run --env XTENSA_TOOLS_VERSION=RI-2019.2-linux --rm -v `pwd`:/opt/tflite-micro ghcr.io/tflm-bot/xtensa_hifimini.sh tflite-micro/"

0 commit comments

Comments
 (0)