Automated sync from github.com/tensorflow/tensorflow #4645
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 }} |