-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e55fb02
commit a0b343c
Showing
3 changed files
with
233 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: '📜 Check Commit Messages' | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- edited | ||
- reopened | ||
- synchronize | ||
branches: | ||
- 'master' | ||
|
||
jobs: | ||
check-commit-messages: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: '📜 Check commit messages format' | ||
uses: gsactions/commit-message-checker@v2 | ||
with: | ||
pattern: '^[A-Za-z]+.+ .+\.$' | ||
flags: 'gm' | ||
error: 'Commit subject line must match the following pattern: <description".">' | ||
excludeTitle: 'false' | ||
excludeDescription: 'true' | ||
checkAllCommitMessages: 'true' | ||
accessToken: ${{ secrets.GITHUB_TOKEN }} | ||
- name: '📜 Check commit messages length' | ||
uses: gsactions/commit-message-checker@v2 | ||
with: | ||
pattern: '^[^#].{10,78}$' | ||
error: 'Commit subject line maximum line length of 78 characters is exceeded.' | ||
excludeTitle: 'false' | ||
excludeDescription: 'true' | ||
checkAllCommitMessages: 'true' | ||
accessToken: ${{ secrets.GITHUB_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
name: '🔥 Build TFLM' | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*.*.*' | ||
branches: | ||
- 'main' | ||
paths: | ||
- 'src/**' | ||
- '.github/workflows/*.yml' | ||
- '.github/workflows/*.json' | ||
- '!**/README.md' | ||
- '!**.rst' | ||
|
||
pull_request: | ||
branches: | ||
- 'main' | ||
paths: | ||
- 'src/**' | ||
- '.github/workflows/*.yml' | ||
- '.github/workflows/*.json' | ||
- '!**/README.md' | ||
- '!**.rst' | ||
|
||
jobs: | ||
build-tflm: | ||
runs-on: ubuntu-20.04 | ||
|
||
strategy: | ||
matrix: | ||
target: [cortex-m0plus, cortex-m4+fp, cortex-m7+fp, cortex-m55] | ||
fail-fast: false | ||
|
||
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: 8c458fc48ee972ea4fc56ddc08849823b9af7ea8 | ||
|
||
- 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: '🛠 Install dependencies' | ||
run: | | ||
python -m pip install --upgrade pip numpy==1.24 Pillow==10.3 | ||
- name: '🏗 Build TFLM' | ||
run: source tools/ci.sh && ci_build_target ${{ matrix.target }} | ||
|
||
- name: '⬆ Upload libraries' | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ matrix.target }} | ||
path: ${{ matrix.target }} | ||
if-no-files-found: error | ||
|
||
build-tflm-headers: | ||
runs-on: ubuntu-20.04 | ||
needs: [build-tflm] | ||
|
||
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: 8c458fc48ee972ea4fc56ddc08849823b9af7ea8 | ||
|
||
- 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: '🛠 Install dependencies' | ||
run: | | ||
python -m pip install --upgrade pip numpy==1.24 Pillow==10.3 | ||
- name: '🏗 Build headers' | ||
run: source tools/ci.sh && ci_build_headers | ||
|
||
- name: '⬆ Upload headers' | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: include | ||
path: include | ||
if-no-files-found: error | ||
|
||
push-artifacts: | ||
runs-on: ubuntu-20.04 | ||
needs: [build-tflm, build-tflm-headers] | ||
# if: github.event_name == 'push' | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
steps: | ||
- name: '⏳ Checkout repository' | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: false | ||
|
||
- name: '🧹 Remove old headers ' | ||
run: rm -fr include | ||
|
||
- name: '⬇ Download artifacts' | ||
uses: actions/download-artifact@v4 | ||
|
||
- 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 }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/bin/bash | ||
# This file is part of the OpenMV project. | ||
# | ||
# Copyright (c) 2024 Ibrahim Abdelkader <[email protected]> | ||
# Copyright (c) 2024 Kwabena W. Agyeman <[email protected]> | ||
# | ||
# This work is licensed under the MIT license, see the file LICENSE for details. | ||
|
||
# Install ARM GCC. | ||
######################################################################################## | ||
TFLM_REPO_PATH=tflite-micro | ||
TOOLCHAIN_PATH=${HOME}/cache/gcc | ||
export PATH=${TOOLCHAIN_PATH}/bin:${PATH} | ||
TOOLCHAIN_URL="https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-eabi.tar.xz" | ||
|
||
ci_install_arm_gcc() { | ||
mkdir -p ${TOOLCHAIN_PATH} | ||
wget --no-check-certificate -O - ${TOOLCHAIN_URL} | tar --strip-components=1 -Jx -C ${TOOLCHAIN_PATH} | ||
export PATH=${TOOLCHAIN_PATH}/bin:${PATH} | ||
arm-none-eabi-gcc --version | ||
} | ||
|
||
# Update Submodules. | ||
######################################################################################## | ||
ci_update_submodules() { | ||
git submodule update --init --depth=1 --no-single-branch | ||
} | ||
|
||
# Build Targets. | ||
######################################################################################## | ||
ci_build_target() { | ||
TARGET_PATH=${1} | ||
mkdir -p ${TARGET_PATH} | ||
pushd ${TFLM_REPO_PATH} | ||
make -j$(nproc) -f tensorflow/lite/micro/tools/make/Makefile \ | ||
TARGET=cortex_m_generic TARGET_ARCH=${TARGET_PATH} OPTIMIZED_KERNEL_DIR=cmsis_nn \ | ||
TARGET_TOOLCHAIN_ROOT=${TOOLCHAIN_PATH}/bin/ TARGET_TOOLCHAIN_PREFIX=arm-none-eabi- \ | ||
BUILD_TYPE=release CORE_OPTIMIZATION_LEVEL=-O2 MICROLITE_LIB_NAME=libtflm.a microlite | ||
popd | ||
mv ${TFLM_REPO_PATH}/gen/*/lib/libtflm.a ${TARGET_PATH} | ||
} | ||
|
||
# Build Headers. | ||
######################################################################################## | ||
ci_build_headers() { | ||
HEADERS_PATH="include" | ||
mkdir -p ${HEADERS_PATH} | ||
pushd ${TFLM_REPO_PATH} | ||
python3 tensorflow/lite/micro/tools/project_generation/create_tflm_tree.py --makefile_options="TARGET=cortex_m_generic TARGET_ARCH=cortex-m7+fp OPTIMIZED_KERNEL_DIR=cmsis_nn TARGET_TOOLCHAIN_ROOT=/opt/arm-none-eabi/bin/ TARGET_TOOLCHAIN_PREFIX=arm-none-eabi- BUILD_TYPE=release" headers | ||
cd headers && find . -name "*.c" -type f -delete | ||
popd | ||
cp -r ${TFLM_REPO_PATH}/headers/* ${HEADERS_PATH} | ||
} |