1# YAML schema for GitHub Actions:
2# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions
3#
4# Helpful YAML parser to clarify YAML syntax:
5# https://yaml-online-parser.appspot.com/
6#
7#
8# This file contains the workflows that are run prior to merging a pull request.
9
10name: CI
11
12on:
13  pull_request:
14    types: [labeled]
15    branches:
16      - main
17
18  schedule:
19    # 10am UTC is 3am or 4am PT depending on daylight savings.
20    - cron: '0 10 * * *'
21
22  # Allow manually triggering of the workflow.
23  workflow_dispatch: {}
24
25jobs:
26  bazel_tests:
27    runs-on: ubuntu-latest
28
29    if: |
30      github.event_name == 'workflow_dispatch' ||
31      (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'ci:run')) ||
32      (github.event_name == 'schedule' && github.repository == 'tensorflow/tflite-micro')
33
34    name: Bazel (presubmit)
35    steps:
36      - uses: actions/checkout@v2
37      - name: Set up bazel
38        run: |
39          sudo ci/install_bazel.sh
40      - name: Test
41        run: |
42          tensorflow/lite/micro/tools/ci_build/test_bazel.sh
43
44  cortex_m_tests:
45    runs-on: ubuntu-latest
46
47    if: |
48      github.event_name == 'workflow_dispatch' ||
49      (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'ci:run')) ||
50      (github.event_name == 'schedule' && github.repository == 'tensorflow/tflite-micro')
51
52    name: Cortex-M (presubmit)
53    steps:
54      - uses: actions/checkout@v2
55      - name: Test
56        run: |
57          tensorflow/lite/micro/tools/ci_build/test_bluepill.sh
58          tensorflow/lite/micro/tools/ci_build/test_stm32f4.sh
59
60  check_code_style:
61    runs-on: ubuntu-latest
62
63    if: |
64      github.event_name == 'workflow_dispatch' ||
65      (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'ci:run')) ||
66      (github.event_name == 'schedule' && github.repository == 'tensorflow/tflite-micro')
67
68    name: Code Style (presubmit)
69    steps:
70      - uses: actions/checkout@v2
71      - name: Check
72        uses: docker://ghcr.io/tflm-bot/tflm-ci:latest
73        with:
74          args: /bin/sh -c "tensorflow/lite/micro/tools/ci_build/test_code_style.sh"
75
76  project_generation:
77    runs-on: ubuntu-latest
78
79    if: |
80      github.event_name == 'workflow_dispatch' ||
81      (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'ci:run')) ||
82      (github.event_name == 'schedule' && github.repository == 'tensorflow/tflite-micro')
83
84    name: Project Generation (presubmit)
85    steps:
86      - uses: actions/checkout@v2
87      - name: Test
88        run: |
89          tensorflow/lite/micro/tools/ci_build/test_project_generation.sh
90
91  x86_tests:
92    runs-on: ubuntu-latest
93
94    if: |
95      github.event_name == 'workflow_dispatch' ||
96      (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'ci:run')) ||
97      (github.event_name == 'schedule' && github.repository == 'tensorflow/tflite-micro')
98
99    name: Makefile x86 (presubmit)
100    steps:
101      - uses: actions/checkout@v2
102      - name: Test
103        run: |
104          tensorflow/lite/micro/tools/ci_build/test_makefile.sh
105          tensorflow/lite/micro/tools/ci_build/test_x86.sh
106
107