Skip to content

Commit

Permalink
github-action: import all TAOS-CI post-build
Browse files Browse the repository at this point in the history
- gbs build for x64, x86, arm32, arm64
- pdebuild for { x64, arm64 } x { 22.04, 20.04 }
- yocto build w/ eSDK (Yocto 4.0.15)
- android build w/ nttld/setup-ndk

to enable such github actions,
- android / jni build script fix

Signed-off-by: MyungJoo Ham <[email protected]>
  • Loading branch information
myungjoo committed Jan 31, 2024
1 parent 664018d commit 2fb6365
Show file tree
Hide file tree
Showing 9 changed files with 283 additions and 169 deletions.
15 changes: 0 additions & 15 deletions .TAOS-CI/config/config-plugins-postbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,6 @@ declare -i idx=-1
echo "[MODULE] plugins-base: Plugin group is a well-maintained collection of plugin modules."
# Please append your plugin modules here.

postbuild_plugins[++idx]="pr-postbuild-build-tizen"
echo "[DEBUG] The default BUILD_MODE of ${postbuild_plugins[idx]} is declared with 99 (SKIP MODE) by default in plugins-base folder."
echo "[DEBUG] ${postbuild_plugins[idx]} is started."
echo "[DEBUG] ${BOT_NAME}/${postbuild_plugins[idx]}: Check if Tizen rpm package is successfully generated."
echo "[DEBUG] Current path: $(pwd)."
source ${REFERENCE_REPOSITORY}/ci/taos/plugins-base/${postbuild_plugins[idx]}.sh


postbuild_plugins[++idx]="pr-postbuild-build-ubuntu"
echo "[DEBUG] The default BUILD_MODE of ${postbuild_plugins[idx]} is declared with 99 (SKIP MODE) by default in plugins-base folder."
echo "[DEBUG] ${postbuild_plugins[idx]} is started."
echo "[DEBUG] ${BOT_NAME}/${postbuild_plugins[idx]}: Check if Ubuntu deb package is successfully generated."
echo "[DEBUG] Current path: $(pwd)."
source ${REFERENCE_REPOSITORY}/ci/taos/plugins-base/${postbuild_plugins[idx]}.sh


postbuild_plugins[++idx]="pr-postbuild-build-yocto"
echo "[DEBUG] The default BUILD_MODE of ${postbuild_plugins[idx]} is declared with 99 (SKIP MODE) by default in plugins-base folder."
Expand Down
144 changes: 0 additions & 144 deletions .TAOS-CI/config/config-plugins-prebuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,150 +16,6 @@ declare -i idx=-1
echo "[MODULE] plugins-good: Plugin group that follow Apache license with good quality"
# Please append your plugin modules here.

prebuild_plugins[++idx]="pr-prebuild-doxygen-tag"
echo "${prebuild_plugins[idx]} is starting."
echo "[MODULE] ${BOT_NAME}/${prebuild_plugins[idx]}: Check a source code consists of required doxygen tags."
echo "[DEBUG] The current path: $(pwd)."
echo "[DEBUG] source ${REFERENCE_REPOSITORY}/ci/taos/plugins-good/${prebuild_plugins[idx]}.sh"
source ${REFERENCE_REPOSITORY}/ci/taos/plugins-good/${prebuild_plugins[idx]}.sh

prebuild_plugins[++idx]="pr-prebuild-indent"
echo "${prebuild_plugins[idx]} is starting."
echo "[MODULE] ${BOT_NAME}/${prebuild_plugins[idx]}: Check the code formatting style with GNU indent"
echo "[DEBUG] The current path: $(pwd)."
echo "[DEBUG] source ${REFERENCE_REPOSITORY}/ci/taos/plugins-good/${prebuild_plugins[idx]}.sh"
source ${REFERENCE_REPOSITORY}/ci/taos/plugins-good/${prebuild_plugins[idx]}.sh


prebuild_plugins[++idx]="pr-prebuild-clang"
echo "${prebuild_plugins[idx]} is starting."
echo "[MODULE] ${BOT_NAME}/${prebuild_plugins[idx]}: Check the code formatting style with clang-format"
echo "[DEBUG] The current path: $(pwd)."
echo "[DEBUG] source ${REFERENCE_REPOSITORY}/ci/taos/plugins-good/${prebuild_plugins[idx]}.sh"
source ${REFERENCE_REPOSITORY}/ci/taos/plugins-good/${prebuild_plugins[idx]}.sh

#prebuild_plugins[++idx]="pr-prebuild-exclusive-vio"
# echo "${prebuild_plugins[idx]} is starting."
# echo "[MODULE] ${BOT_NAME}/${prebuild_plugins[idx]}: Check issue #279. VIO commits should not touch non VIO files."
# echo "[DEBUG] The current path: $(pwd)."
# echo "[DEBUG] source ${REFERENCE_REPOSITORY}/ci/taos/plugins-good/${prebuild_plugins[idx]}.sh"
# source ${REFERENCE_REPOSITORY}/ci/taos/plugins-good/${prebuild_plugins[idx]}.sh

prebuild_plugins[++idx]="pr-prebuild-pylint"
echo "${prebuild_plugins[idx]} is starting."
echo "[MODULE] ${BOT_NAME}/${prebuild_plugins[idx]}: Check the code formatting style with pylint"
echo "[DEBUG] The current path: $(pwd)."
echo "[DEBUG] source ${REFERENCE_REPOSITORY}/ci/taos/plugins-good/${prebuild_plugins[idx]}.sh"
source ${REFERENCE_REPOSITORY}/ci/taos/plugins-good/${prebuild_plugins[idx]}.sh

prebuild_plugins[++idx]="pr-prebuild-newline"
echo "${prebuild_plugins[idx]} is starting."
echo "[MODULE] ${BOT_NAME}/${prebuild_plugins[idx]}: Check if there is a newline issue in text files"
echo "[DEBUG] The current path: $(pwd)."
echo "[DEBUG] source ${REFERENCE_REPOSITORY}/ci/taos/plugins-good/${prebuild_plugins[idx]}.sh"
source ${REFERENCE_REPOSITORY}/ci/taos/plugins-good/${prebuild_plugins[idx]}.sh

prebuild_plugins[++idx]="pr-prebuild-rpm-spec"
echo "${prebuild_plugins[idx]} is starting."
echo "[MODULE] ${BOT_NAME}/${prebuild_plugins[idx]}: Check if there is incorrect staements in *.spec file"
echo "[DEBUG] The current path: $(pwd)."
echo "[DEBUG] source ${REFERENCE_REPOSITORY}/ci/taos/plugins-good/${prebuild_plugins[idx]}.sh"
source ${REFERENCE_REPOSITORY}/ci/taos/plugins-good/${prebuild_plugins[idx]}.sh

prebuild_plugins[++idx]="pr-prebuild-file-size"
echo "${prebuild_plugins[idx]} is starting."
echo "[MODULE] ${BOT_NAME}/${prebuild_plugins[idx]}: Check the file size to not include big binary files"
echo "[DEBUG] The current path: $(pwd)."
echo "[DEBUG] source ${REFERENCE_REPOSITORY}/ci/taos/plugins-good/${prebuild_plugins[idx]}.sh"
source ${REFERENCE_REPOSITORY}/ci/taos/plugins-good/${prebuild_plugins[idx]}.sh

prebuild_plugins[++idx]="pr-prebuild-cppcheck"
echo "${prebuild_plugins[idx]} is starting."
echo "[MODULE] ${BOT_NAME}/${prebuild_plugins[idx]}: Check dangerous coding constructs in source codes (*.c, *.cpp) with cppcheck"
echo "[DEBUG] The current path: $(pwd)."
echo "[DEBUG] source ${REFERENCE_REPOSITORY}/ci/taos/plugins-good/${prebuild_plugins[idx]}.sh"
source ${REFERENCE_REPOSITORY}/ci/taos/plugins-good/${prebuild_plugins[idx]}.sh

prebuild_plugins[++idx]="pr-prebuild-nobody"
echo "${prebuild_plugins[idx]} is starting."
echo "[MODULE] ${BOT_NAME}/${prebuild_plugins[idx]}: Check the commit message body"
echo "[DEBUG] The current path: $(pwd)."
echo "[DEBUG] source ${REFERENCE_REPOSITORY}/ci/taos/plugins-good/${prebuild_plugins[idx]}.sh"
source ${REFERENCE_REPOSITORY}/ci/taos/plugins-good/${prebuild_plugins[idx]}.sh

prebuild_plugins[++idx]="pr-prebuild-timestamp"
echo "${prebuild_plugins[idx]} is starting."
echo "[MODULE] ${BOT_NAME}/${prebuild_plugins[idx]}: Check the timestamp of the commit"
echo "[DEBUG] The current path: $(pwd)."
echo "[DEBUG] source ${REFERENCE_REPOSITORY}/ci/taos/plugins-good/${prebuild_plugins[idx]}.sh"
source ${REFERENCE_REPOSITORY}/ci/taos/plugins-good/${prebuild_plugins[idx]}.sh

prebuild_plugins[++idx]="pr-prebuild-executable"
echo "${prebuild_plugins[idx]} is starting."
echo "[MODULE] ${BOT_NAME}/${prebuild_plugins[idx]}: Check executable bits for .cpp, .c, .hpp, .h, .prototxt, .caffemodel, .txt., .init"
echo "[DEBUG] The current path: $(pwd)."
echo "[DEBUG] source ${REFERENCE_REPOSITORY}/ci/taos/plugins-good/${prebuild_plugins[idx]}.sh"
source ${REFERENCE_REPOSITORY}/ci/taos/plugins-good/${prebuild_plugins[idx]}.sh

prebuild_plugins[++idx]="pr-prebuild-hardcoded-path"
echo "${prebuild_plugins[idx]} is starting."
echo "[MODULE] ${BOT_NAME}/${prebuild_plugins[idx]}: Check prohibited hardcoded paths (/home/* for now)"
echo "[DEBUG] The current path: $(pwd)."
echo "[DEBUG] source ${REFERENCE_REPOSITORY}/ci/taos/plugins-good/${prebuild_plugins[idx]}.sh"
source ${REFERENCE_REPOSITORY}/ci/taos/plugins-good/${prebuild_plugins[idx]}.sh

prebuild_plugins[++idx]="pr-prebuild-misspelling"
echo "${prebuild_plugins[idx]} is starting."
echo "[MODULE] ${BOT_NAME}/${prebuild_plugins[idx]}: Check a misspelled statement in a document file with GNU Aspell"
echo "[DEBUG] The current path: $(pwd)."
echo "[DEBUG] source ${REFERENCE_REPOSITORY}/ci/taos/plugins-good/${prebuild_plugins[idx]}.sh"
source ${REFERENCE_REPOSITORY}/ci/taos/plugins-good/${prebuild_plugins[idx]}.sh

prebuild_plugins[++idx]="pr-prebuild-doxygen-build"
echo "${prebuild_plugins[idx]} is starting."
echo "[MODULE] ${BOT_NAME}/${prebuild_plugins[idx]}: Check a doxygen grammar if a doxygen can normally generate source code"

prebuild_plugins[++idx]="pr-prebuild-sloccount"
echo "${prebuild_plugins[idx]} is starting."
echo "[MODULE] ${BOT_NAME}/${prebuild_plugins[idx]}: Check physical Source Lines of Code (SLOC) in a source code"
echo "[DEBUG] The current path: $(pwd)."
echo "[DEBUG] source ${REFERENCE_REPOSITORY}/ci/taos/plugins-good/${prebuild_plugins[idx]}.sh"
source ${REFERENCE_REPOSITORY}/ci/taos/plugins-good/${prebuild_plugins[idx]}.sh

prebuild_plugins[++idx]="pr-prebuild-prohibited-words"
echo "${prebuild_plugins[idx]} is starting."
echo "[MODULE] ${BOT_NAME}/${prebuild_plugins[idx]}: Check if source codes have prohibited words."
echo "[DEBUG] The current path: $(pwd)."
echo "[DEBUG] source ${REFERENCE_REPOSITORY}/ci/taos/plugins-good/${prebuild_plugins[idx]}.sh"
source ${REFERENCE_REPOSITORY}/ci/taos/plugins-good/${prebuild_plugins[idx]}.sh

prebuild_plugins[++idx]="pr-prebuild-signed-off-by"
echo "${prebuild_plugins[idx]} is starting."
echo "[MODULE] ${BOT_NAME}/${prebuild_plugins[idx]}: Check 'Signed-off-by' in commit body"
echo "[DEBUG] The current path: $(pwd)."
echo "[DEBUG] source ${REFERENCE_REPOSITORY}/ci/taos/plugins-good/${prebuild_plugins[idx]}.sh"
source ${REFERENCE_REPOSITORY}/ci/taos/plugins-good/${prebuild_plugins[idx]}.sh

prebuild_plugins[++idx]="pr-prebuild-shellcheck"
echo "${prebuild_plugins[idx]} is starting."
echo "[MODULE] ${BOT_NAME}/${prebuild_plugins[idx]}: Check a syntax error in a shell script file with 'shellcheck' package"
echo "[DEBUG] The current path: $(pwd)."
echo "[DEBUG] source ${REFERENCE_REPOSITORY}/ci/taos/plugins-good/${prebuild_plugins[idx]}.sh"
source ${REFERENCE_REPOSITORY}/ci/taos/plugins-good/${prebuild_plugins[idx]}.sh

prebuild_plugins[++idx]="pr-prebuild-flawfinder"
echo "${prebuild_plugins[idx]} is starting."
echo "[MODULE] ${BOT_NAME}/${prebuild_plugins[idx]}: Check security problems in the C/C++ source code with 'flawfinder' package"
echo "[DEBUG] The current path: $(pwd)."
echo "[DEBUG] source ${REFERENCE_REPOSITORY}/ci/taos/plugins-good/${prebuild_plugins[idx]}.sh"
source ${REFERENCE_REPOSITORY}/ci/taos/plugins-good/${prebuild_plugins[idx]}.sh

prebuild_plugins[++idx]="pr-prebuild-coverity"
echo "${prebuild_plugins[idx]} is starting."
echo "[MODULE] ${BOT_NAME}/${prebuild_plugins[idx]}: Check defects in the C/C++ source code with 'coverity' package"
echo "[DEBUG] The current path: $(pwd)."
echo "[DEBUG] source ${REFERENCE_REPOSITORY}/ci/taos/plugins-good/${prebuild_plugins[idx]}.sh"
source ${REFERENCE_REPOSITORY}/ci/taos/plugins-good/${prebuild_plugins[idx]}.sh

##################################################################################################################
echo "[MODULE] plugins-staging: Plugin group that does not have an evaluation and aging test enough"
Expand Down
95 changes: 95 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Build test: Android NDK r12b

on:
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: nttld/setup-ndk@v1
with:
ndk-version: r12b
link-to-sdk: true
- name: Check if rebuild required
## @todo This should become a reusable workflow.
run: |
tmpfile=$(mktemp)
git show --pretty="format:" --name-only --diff-filter=AMRC ${{ github.event.pull_request.head.sha}} -${{ github.event.pull_request.commits }} | sort | uniq | awk NF > ${tmpfile}
echo "changed_file_list=${tmpfile}" >> "$GITHUB_ENV"
rebuild=`bash .github/workflows/check_if_rebuild_requires.sh ${tmpfile} android | grep "REBUILD=YES" | wc -l`
echo "Rebuild required: ${rebuild}"
echo "rebuild=${rebuild}" >> "$GITHUB_ENV"
- name: make cache key
if: env.rebuild == '1'
id: make-key
run: echo "cache_key=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
shell: bash
- name: cache GST root
id: cache-gbs-root
if: env.rebuild == '1'
uses: actions/cache@v3
with:
path: ~/android
key: ${{ steps.make-key.outputs.cache_key }}
- name: Prepare Build
if: env.rebuild == '1'
run: |
echo "::group::Install required packages"
sudo apt-get update
sudo apt-get install tar wget gzip libglib2.0-dev libjson-glib-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libunwind-dev googletest liborc-0.4-dev flex bison libopencv-dev pkg-config python3-dev python3-numpy python3
echo "::endgroup::"
if [[ -d ~/android/gst_root_android/arm64 ]] && [[ -f ~/android/gst_root_android/arm64/lib/libgstreamer-1.0.so ]]; then
echo "Gst-Root-Android cached."
else
echo "::group::Download prebuilt Android-Gstreamer libraries"
mkdir -p ~/android/gst_root_android/arm64
pushd ~/android/gst_root_android/arm64
wget http://ci.nnstreamer.ai/warehouse/gstreamer-prebuilts-for-android-device/gst_root_android-custom-1.12.4-ndkr12b-20190213-0900/gstreamer-1.0-android-arm64-1.12.4-runtime.tar.bz2
wget http://ci.nnstreamer.ai/warehouse/gstreamer-prebuilts-for-android-device/gst_root_android-custom-1.12.4-ndkr12b-20190213-0900/gstreamer-1.0-android-arm64-1.12.4.tar.bz2
tar -xf gstreamer-1.0-android-arm64-1.12.4-runtime.tar.bz2
tar -xf gstreamer-1.0-android-arm64-1.12.4.tar.bz2
popd
echo "::endgroup::"
fi
- name: NDK Build
if: env.rebuild == '1'
run: |
export GSTREAMER_ROOT_ANDROID=~/android/gst_root_android
export TARGET_ARCH_ABI=arm64-v8a
export ANDROID_ABI=arm64-v8a
export APP_ALLOW_MISSING_DEPS=true
export NNSTREAMER_ROOT=$(pwd)
target_host=aarch64-linux-android
export AR=$target_host-ar
export AS=$target_host-clang
export CC=$target_host-clang
export CXX=$target_host-clang++
export LD=$target_host-ld
export STRIP=$target_host-strip
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/android/gst_root_android/arm64/lib/
cd jni
echo "::group::Build NNStreamer with ndk-build"
ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=./Android-nnstreamer.mk NDK_APPLICATION_MK=./Application.mk -j$(nproc)
echo "::endgroup::"
ls -la ./libs/arm64-v8a/
cp ./libs/arm64-v8a/libnnstreamer.so $GSTREAMER_ROOT_ANDROID/arm64/lib/gstreamer-1.0/
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./libs/arm64-v8a
# Workaround for the gstreamer-android prebuild binary build glitches
result=$(readelf -d ~/android/gst_root_android/arm64/lib/libfontconfig.so | grep "/data/nnstreamer/cerbero.custom-1.12.4-ndkr12b-20190213-0900/build/dist/android_arm64/lib")
if [[ ! -z $result ]]; then
echo "Warning: the given prebuilt binaries for Android have incorrect rpaths."
sudo mkdir -p /data/nnstreamer/cerbero.custom-1.12.4-ndkr12b-20190213-0900/build/dist/android_arm64/
sudo ln -s ~/android/gst_root_android/arm64/lib /data/nnstreamer/cerbero.custom-1.12.4-ndkr12b-20190213-0900/build/dist/android_arm64/lib
fi
echo "::group::Build a test application"
ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=./Android-app.mk NDK_APPLICATION_MK=./Application.mk -j$(nproc)
ls -la /data/nnstreamer/cerbero.custom-1.12.4-ndkr12b-20190213-0900/build/dist/android_arm64/lib/
echo "::endgroup::"
cd ..
24 changes: 21 additions & 3 deletions .github/workflows/gbs_x64.yml → .github/workflows/gbs_build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: GBS Tizen build for x64 from Ubuntu
name: Build and unit test: Tizen/GBS

# ${{ github.event.pull_request.commits }} : # commits in this PR
# - changed_file_list in GITHUB_ENV: the list of files updated in this pull-request.
Expand All @@ -10,6 +10,18 @@ on:
jobs:
build:

strategy:
matrix:
include:
- aarch: "-A x86_64"
option: "--define \"unit_test 1\""
- aarch: "-A i586"
option: "--define \"unit_test 1\""
- aarch: "-A armv7l"
option: "--define \"unit_test 0\""
- aarch: "-A aarch64"
option: "--define \"unit_test 0\""

runs-on: ubuntu-20.04

steps:
Expand Down Expand Up @@ -47,7 +59,11 @@ jobs:
- name: run GBS
if: env.rebuild == '1'
run: |
gbs build --skip-srcrpm --define "_skip_debug_rpm 1"
gbs build --skip-srcrpm --define "_skip_debug_rpm 1" ${{ matrix.aarch }} ${{ matrix.option }}
## Skip nntrainer build test in aarch64. @todo We need #2430 and #2431 in nntrainer.git
if [[ "${{ matrix.aarch }}" == "-A aarch64" ]]; then
echo "rebuild=0" >> "$GITHUB_ENV"
fi
- name: get nntrainer
if: env.rebuild == '1'
uses: actions/checkout@v3
Expand All @@ -57,4 +73,6 @@ jobs:
- name: run nntrainer GBS build
if: env.rebuild == '1'
run: |
pushd nntrainer && gbs build --skip-srcrpm --define "unit_test 1" --define "_skip_debug_rpm 1" && popd
pushd nntrainer
gbs build --skip-srcrpm ${{ matrix.aarch }} ${{ matrix.option }} --define "_skip_debug_rpm 1"
popd
Loading

0 comments on commit 2fb6365

Please sign in to comment.