-
Notifications
You must be signed in to change notification settings - Fork 836
139 lines (129 loc) · 4.66 KB
/
tests_entry.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# tests_entry.yml
# Entry point to the test suites
#
# - If neither ci:run, ci:run_full or ci:ready_to_merge labels are on PR, fail and exit.
# - If the PR comment body doesn't contain 'BUG=' fail and exit.
# - If ci:run or ci:run_full label is on PR, remove label and run the test scripts.
# - If ci:ready_to_merge is on the PR and the pull_request_target type is synchronize not triggered
# by the mergify[bot] user, remove label and fail job.
# - If ci:ready_to_merge label is on PR and pull_request_target type is labeled, run the test scripts.
#
# The end result is labeling ci:run or ci:ready_to_merge will run the test scripts,
# If Mergify merges to the PR, the test scripts will run. If anyone else tries to add
# a commit to the PR or merge , the script will fail and ci:ready_to_merge will be
# removed.
#
# This script runs the test scripts directly. Scheduled or manual runs use
# run_<scriptname>.yml as the entry point.
name: Tests Entry Point
on:
pull_request_target:
types:
- synchronize
- labeled
jobs:
no-labels:
runs-on: ubuntu-latest
steps:
- name: fail-without-labels
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:
runs-on: ubuntu-latest
needs: no-labels
steps:
- name: remove-ready-to-merge
if: ${{ (contains(github.event.pull_request.labels.*.name, 'ci:ready_to_merge') &&
(github.event.action == 'synchronize') &&
!(github.event.sender.login == 'mergify[bot]')) }}
uses: actions/github-script@v5
with:
github-token: ${{ secrets.TFLM_BOT_REPO_TOKEN }}
script: |
github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: 'ci:ready_to_merge'
})
- name: fail-on-bad-synch
if: ${{ (github.event.action == 'synchronize') && !(github.event.sender.login == 'mergify[bot]') }}
run: exit 1
ci-run:
runs-on: ubuntu-latest
needs: ci-ready-to-merge
steps:
- name: remove-cirun
if: github.event.action == 'labeled' &&
github.event.label.name == 'ci:run'
uses: actions/github-script@v5
with:
github-token: ${{ secrets.TFLM_BOT_REPO_TOKEN }}
script: |
github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: 'ci:run'
})
continue-on-error: true
ci-run-full:
runs-on: ubuntu-latest
needs: ci-run
steps:
- name: remove-cirun-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 }}
script: |
github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: 'ci:run_full'
})
continue-on-error: true
pr-has-bug:
runs-on: ubuntu-latest
needs: ci-run-full
name: PR has Bug
steps:
- name: Check for BUG=
if: ${{ !contains(github.event.pull_request.body, 'BUG=') }}
run: |
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
with:
trigger-sha: ${{ github.event.pull_request.head.sha }}
call-hexagon:
needs: ci-run
uses: ./.github/workflows/hexagon.yml
with:
trigger-sha: ${{ github.event.pull_request.head.sha }}
secrets:
tflm-bot-token: ${{ secrets.TFLM_BOT_PACKAGE_READ_TOKEN }}
call-xtensa-presubmit:
needs: ci-run
uses: ./.github/workflows/xtensa_presubmit.yml
with:
trigger-sha: ${{ github.event.pull_request.head.sha }}
secrets:
tflm-bot-token: ${{ secrets.TFLM_BOT_PACKAGE_READ_TOKEN }}
call-check-tflite-files:
needs: ci-run
uses: ./.github/workflows/check_tflite_files.yml
with:
trigger-sha: ${{ github.event.pull_request.head.sha }}
pr-number: ${{ github.event.pull_request.number }}
pr-body: ${{ github.event.pull_request.body }}
secrets:
tflm-bot-token: ${{ secrets.TFLM_BOT_PACKAGE_READ_TOKEN }}