Skip to content

Commit

Permalink
Fix GitHub workflow conditionals (#2489)
Browse files Browse the repository at this point in the history
BUG=b/327686165
  • Loading branch information
rascani authored Mar 4, 2024
1 parent 9adee08 commit 1f7f54b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 22 deletions.
18 changes: 11 additions & 7 deletions .github/workflows/cortex_m.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ on:
types:
- closed
- labeled

workflow_call:
inputs:
trigger-sha:
Expand All @@ -34,13 +34,15 @@ jobs:

if: |
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'schedule' && github.repository == 'tensorflow/tflite-micro') ||
contains(github.event.pull_request.labels.*.name, 'ci:run_full')
(github.event_name == 'schedule' &&
github.repository == 'tensorflow/tflite-micro') ||
(github.event.action == 'labeled' &&
github.event.label.name == 'ci:run_full')
name: Cortex-M Generic
steps:
- uses: actions/setup-python@v4
with:
with:
python-version: '3.10'
- uses: actions/checkout@v2
- name: Install dependencies
Expand All @@ -57,13 +59,15 @@ jobs:

if: |
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'schedule' && github.repository == 'tensorflow/tflite-micro') ||
contains(github.event.pull_request.labels.*.name, 'ci:run_full')
(github.event_name == 'schedule' &&
github.repository == 'tensorflow/tflite-micro') ||
(github.event.action == 'labeled' &&
github.event.label.name == 'ci:run_full')
name: Cortex-M Corstone 300 (FVP)
steps:
- uses: actions/setup-python@v4
with:
with:
python-version: '3.10'
- uses: actions/checkout@v2
- name: Install dependencies
Expand Down
17 changes: 10 additions & 7 deletions .github/workflows/tests_entry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: fail-without-labels
if: ${{ !(contains(github.event.pull_request.labels.*.name, 'ci:run') ||
contains(github.event.pull_request.labels.*.name, 'ci:ready_to_merge') ||
contains(github.event.pull_request.labels.*.name, 'ci:run_full')) }}
if: github.event.action == 'labeled' &&
!(github.event.label.name == 'ci:run' ||
github.event.label.name == 'ci:ready_to_merge' ||
github.event.label.name = 'ci:run_full')
run: exit 1

ci-ready-to-merge:
Expand Down Expand Up @@ -60,7 +61,8 @@ jobs:
needs: ci-ready-to-merge
steps:
- name: remove-cirun
if: ${{ contains(github.event.pull_request.labels.*.name, 'ci:run') }}
if: github.event.action == 'labeled' &&
github.event.label.name == 'ci:run'
uses: actions/github-script@v5
with:
github-token: ${{ secrets.TFLM_BOT_REPO_TOKEN }}
Expand All @@ -78,7 +80,8 @@ jobs:
needs: ci-run
steps:
- name: remove-cirun-full
if: ${{ contains(github.event.pull_request.labels.*.name, 'ci:run_full') }}
if: github.event.action == 'labeled' &&
github.event.label.name = 'ci:run_full'
uses: actions/github-script@v5
with:
github-token: ${{ secrets.TFLM_BOT_REPO_TOKEN }}
Expand All @@ -102,7 +105,7 @@ jobs:
echo "PR description requires a BUG= line with issue number."
echo "See https://testing.googleblog.com/2017/09/code-health-providing-context-with.html for additional context"
exit 1
call-ci:
needs: ci-run
uses: ./.github/workflows/ci.yml
Expand All @@ -128,7 +131,7 @@ jobs:
call-check-tflite-files:
needs: ci-run
uses: ./.github/workflows/check_tflite_files.yml
with:
with:
trigger-sha: ${{ github.event.pull_request.head.sha }}
pr-number: ${{ github.event.pull_request.number }}
pr-body: ${{ github.event.pull_request.body }}
Expand Down
19 changes: 11 additions & 8 deletions .github/workflows/tests_post.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,36 @@ on:

jobs:
riscv_postmerge:
if: ${{ github.event.pull_request.merged == true ||
contains(github.event.pull_request.labels.*.name, 'ci:run_full') }}
if: github.event.pull_request.merged == true ||
(github.event.action == 'labeled' &&
github.event.label.name == 'ci:run_full')
uses: ./.github/workflows/riscv_postmerge.yml
with:
trigger-sha: ${{ github.event.pull_request.head.sha }}
secrets:
tflm-bot-token: ${{ secrets.TFLM_BOT_PACKAGE_READ_TOKEN }}

xtensa_postmerge:
if: ${{ github.event.pull_request.merged == true ||
contains(github.event.pull_request.labels.*.name, 'ci:run_full') }}
if: github.event.pull_request.merged == true ||
(github.event.action == 'labeled' &&
github.event.label.name == 'ci:run_full')
uses: ./.github/workflows/xtensa_postmerge.yml
with:
trigger-sha: ${{ github.event.pull_request.head.sha }}
secrets:
tflm-bot-token: ${{ secrets.TFLM_BOT_PACKAGE_READ_TOKEN }}

cortex_m_ci_full:
if: ${{ contains(github.event.pull_request.labels.*.name, 'ci:run_full') }}
if: github.event.action == 'labeled' &&
github.event.label.name == 'ci:run_full'
uses: ./.github/workflows/cortex_m.yml
with:
trigger-sha: ${{ github.event.pull_request.head.sha }}
secrets:
tflm-bot-token: ${{ secrets.TFLM_BOT_PACKAGE_READ_TOKEN }}

issue_on_error:
needs: [riscv_postmerge,xtensa_postmerge,cortex_m_ci_full]
needs: [riscv_postmerge, xtensa_postmerge, cortex_m_ci_full]
if: ${{ always() && contains(needs.*.result, 'failure') &&
!contains(github.event.pull_request.labels.*.name, 'ci:run_full') }}
uses: ./.github/workflows/issue_on_error.yml
Expand All @@ -58,7 +61,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: remove-cirun-full
if: ${{ contains(github.event.pull_request.labels.*.name, 'ci:run_full') }}
if: github.event.action == 'labeled' &&
github.event.label.name == 'ci:run_full'
uses: actions/github-script@v5
with:
github-token: ${{ secrets.TFLM_BOT_REPO_TOKEN }}
Expand All @@ -70,4 +74,3 @@ jobs:
name: 'ci:run_full'
})
continue-on-error: true

0 comments on commit 1f7f54b

Please sign in to comment.