Skip to content

Commit

Permalink
Add tools and workflows.
Browse files Browse the repository at this point in the history
  • Loading branch information
iabdalkader committed Jun 22, 2024
1 parent e55fb02 commit b2637f8
Show file tree
Hide file tree
Showing 5 changed files with 237 additions and 201 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/commit.yml
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 }}
136 changes: 136 additions & 0 deletions .github/workflows/tflm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
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:
- {name: cortex-m0plus, arch: cortex-m0plus, kernel: cmsis_nn, coproc: '', args: ''}
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: 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 }} \
${{ matrix.target.arch }} \
"${{ matrix.target.kernel }}" \
"${{ matrix.target.coproc }}" \
"${{ matrix.target.args }}" \
${{ matrix.build }}
- name: '⬆ Upload library'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target.name }}-${{ matrix.build }}
path: lib
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 }}" \
release
- 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/

- 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 }}
201 changes: 0 additions & 201 deletions LICENSE

This file was deleted.

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# About This Repository
This repository builds static TensorFlow Lite Micro (TFLM) libraries from the upstream repository for use in the main OpenMV firmware repository. It is meant to be included only as a submodule in the main OpenMV firmware repository. With the exception of a few files and the models, most of the files included in this repository are generated by workflows."
Loading

0 comments on commit b2637f8

Please sign in to comment.