-
Notifications
You must be signed in to change notification settings - Fork 1
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 16fd49c
Showing
3 changed files
with
215 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,116 @@ | ||
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-m7+fp] | ||
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-repo | ||
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: '🏗 Build headers' | ||
run: source tools/ci.sh && ci_build_headers | ||
|
||
- name: '⬆ Upload libraries' | ||
# if: github.event_name != 'pull_request' | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ matrix.target }} | ||
path: ${{ matrix.target }} | ||
if-no-files-found: error | ||
|
||
- name: '⬆ Upload headers' | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
path: tflite-micro | ||
if-no-files-found: error | ||
|
||
commit-artifacts: | ||
needs: build-tflm | ||
runs-on: ubuntu-20.04 | ||
# 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 | ||
|
||
# - name: '🤌 Commit artifacts' | ||
# run: | | ||
# git config --local user.name "github-actions[bot]" | ||
# git config --local user.email "github-actions[bot]@users.noreply.github.com" | ||
# git add . | ||
# git commit -m "Add build artifacts" | ||
|
||
- 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,64 @@ | ||
#!/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. | ||
######################################################################################## | ||
TOOLCHAIN_PATH=${HOME}/cache/gcc | ||
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=${1} | ||
mkdir -p ${TARGET} | ||
export PATH=${TOOLCHAIN_PATH}/bin:${PATH} | ||
pushd tflite-micro-repo | ||
# make -j$(nproc) -f tensorflow/lite/micro/tools/make/Makefile \ | ||
# TARGET=cortex_m_generic TARGET_ARCH=${TARGET} 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 | ||
touch ${TARGET}/libtflm.a | ||
# mv tflite-micro-repo/gen/*/lib/libtflm.a ${TARGET} | ||
|
||
} | ||
|
||
# Build Headers. | ||
######################################################################################## | ||
ci_build_headers() { | ||
HEADERS_PATH="tflite-micro" | ||
rm -fr ${HEADERS_PATH} | ||
mkdir -p ${HEADERS_PATH} | ||
pushd tflite-micro-repo | ||
headers=$(make -j$(nproc) -f tensorflow/lite/micro/tools/make/Makefile \ | ||
TARGET=cortex_m_generic TARGET_ARCH=cortex-m7+fp OPTIMIZED_KERNEL_DIR=cmsis_nn \ | ||
TARGET_TOOLCHAIN_ROOT=${TOOLCHAIN_PATH}/bin/ TARGET_TOOLCHAIN_PREFIX=arm-none-eabi- \ | ||
BUILD_TYPE=release list_library_headers list_third_party_headers) | ||
|
||
popd | ||
|
||
readarray -d ' ' -t files <<< $headers | ||
for file in "${files[@]}"; do | ||
echo ${file} | ||
mkdir -p ${HEADERS_PATH}/$(dirname ${file}) | ||
cp tflite-micro-repo/${file} ${HEADERS_PATH}/${file} | ||
done | ||
} |