-
Notifications
You must be signed in to change notification settings - Fork 1
152 lines (132 loc) · 4.33 KB
/
tflm.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
140
141
142
143
144
145
146
147
148
149
150
151
152
name: '🔥 Build TFLM'
on:
push:
branches:
- 'main'
paths:
- '.github/workflows/*.yml'
- '.github/workflows/*.json'
- '!**/README.md'
pull_request:
branches:
- 'main'
types:
- opened
- edited
- reopened
- synchronize
paths:
- '.github/workflows/*.yml'
- '.github/workflows/*.json'
- '!**/README.md'
jobs:
build-tflm:
runs-on: ubuntu-24.04
strategy:
matrix:
target:
- {name: cortex-m0plus, arch: cortex-m0plus, kernel: cmsis_nn, coproc: '', args: ''}
- {name: cortex-m4+fp, arch: cortex-m4+fp, kernel: cmsis_nn, coproc: '', args: ''}
- {name: cortex-m7+fp, arch: cortex-m7+fp, kernel: cmsis_nn, coproc: '', args: ''}
- {name: cortex-m55, arch: cortex-m55, kernel: cmsis_nn, coproc: '', args: ''}
- {name: cortex-m55-u55, arch: cortex-m55, kernel: ethos_u, coproc: ethos_u, args: "ETHOSU_ARCH=u55"}
build: [release] #, debug]
fail-fast: true
steps:
- name: '⏳ Checkout main'
uses: actions/checkout@v4
with:
submodules: false
- name: '⏳ Checkout TFLM'
uses: actions/checkout@v4
with:
submodules: false
path: tflite-micro
repository: tensorflow/tflite-micro
ref: 0cc2e49fd96eca29761b323a16f41683fe112fc6
- name: '🩹 Apply patches'
run: |
git apply --verbose --directory=tflite-micro ${GITHUB_WORKSPACE}/patches/tflite_micro.patch
- name: '♻ Caching dependencies'
uses: actions/[email protected]
id: cache
with:
path: ~/cache/gcc
key: 'arm-gnu-toolchain-13.2.rel1'
- name: '🛠 Install toolchain '
if: steps.cache.outputs.cache-hit != 'true'
run: source tools/ci.sh && ci_install_arm_gcc
- name: '🐍 Set up Python'
uses: actions/setup-python@v5
with:
cache: 'pip'
python-version: "3.12.4"
- name: '🏗 Build TFLM'
run: |
source tools/ci.sh
ci_build_target ${{ matrix.target.name }} \
${{ matrix.target.arch }} \
"${{ matrix.target.kernel }}" \
"${{ matrix.target.coproc }}" \
"${{ matrix.target.args }}" \
${{ matrix.build }}
- name: '⬆ Upload library'
uses: actions/upload-artifact@v4
with:
name: libtflm-${{ matrix.target.name }}-${{ matrix.build }}
path: libtflm-${{ matrix.target.name }}-${{ matrix.build }}.a
retention-days: 1
if-no-files-found: error
- name: '🏗 Build headers'
if: matrix.build == 'release'
run: |
source tools/ci.sh
ci_build_headers ${{ matrix.target.name }} \
${{ matrix.target.arch }} \
"${{ matrix.target.kernel }}" \
"${{ matrix.target.coproc }}" \
"${{ matrix.target.args }}" \
${{ matrix.build }}
- name: '⬆ Upload headers'
if: matrix.build == 'release'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target.name }}-headers
path: ${{ matrix.target.name }}-headers
retention-days: 1
if-no-files-found: error
push-artifacts:
runs-on: ubuntu-20.04
needs: [build-tflm]
if: github.event_name == 'push'
permissions:
contents: write
pull-requests: write
steps:
- name: '⏳ Checkout repository'
uses: actions/checkout@v4
with:
submodules: false
- name: '⬇ Download artifacts'
uses: actions/download-artifact@v4
with:
path: lib/
pattern: 'libtflm-*'
merge-multiple: true
- name: '⬇ Download artifacts'
uses: actions/download-artifact@v4
with:
pattern: '*-headers'
- name: '🔄 Update headers'
run: |
rsync -av --delete --include='*/' --include='LICENSE' --include='*.h' --exclude='*' --delete *-headers/ include
rm -fr *-headers
- name: '🔀 Create Pull Request'
uses: peter-evans/create-pull-request@v5
with:
base: main
branch: update_tflm
title: Update tflm libraries and headers.
commit-message: Update tflm libraries and headers.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}