-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from HyperInspire/feature/ci
AdD auto-build ci
- Loading branch information
Showing
12 changed files
with
407 additions
and
27 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,68 @@ | ||
name: Build and Release SDKs | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*" # 当推送符合 "v*" 模式的标签时触发 | ||
|
||
jobs: | ||
build: | ||
name: Compile and Package SDKs | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
# Step 2: Update Git submodules recursively | ||
- name: Update submodules | ||
run: | | ||
git submodule sync --recursive # Ensure submodule paths are up-to-date | ||
git submodule update --init --recursive # Initialize and update all submodules | ||
# 使用 Docker Compose 构建项目 | ||
- name: Build SDKs with Docker Compose | ||
run: docker-compose up | ||
|
||
# 压缩每个 SDK 目录 | ||
- name: Zip SDK Files | ||
run: | | ||
zip -r linux_armv7_armhf.zip build/linux_armv7_armhf/ | ||
zip -r linux_rv1109rv1126_armhf.zip build/linux_rv1109rv1126_armhf/ | ||
zip -r linux_ubuntu18.zip build/linux_ubuntu18/ | ||
# 上传打包文件以供发布任务使用 | ||
- name: Upload SDK Artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: sdk_files | ||
path: | | ||
linux_armv7_armhf.zip | ||
linux_rv1109rv1126_armhf.zip | ||
linux_ubuntu18.zip | ||
release: | ||
name: Release SDKs to GitHub | ||
needs: build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v2 | ||
|
||
# 下载上一个步骤上传的 SDK 文件 | ||
- name: Download SDK Artifacts | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: sdk_files | ||
|
||
# 创建 GitHub Release 并上传 SDK 文件 | ||
- name: Create GitHub Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: | | ||
linux_armv7_armhf.zip | ||
linux_rv1109rv1126_armhf.zip | ||
linux_ubuntu18.zip | ||
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
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 |
---|---|---|
@@ -1,14 +1,84 @@ | ||
mkdir -p build/local | ||
# shellcheck disable=SC2164 | ||
cd build/local | ||
# export cross_compile_toolchain=/home/s4129/software/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf | ||
#!/bin/bash | ||
|
||
# Reusable function to handle 'install' directory operations | ||
move_install_files() { | ||
local root_dir="$1" | ||
local install_dir="$root_dir/install" | ||
|
||
# Step 1: Check if the 'install' directory exists | ||
if [ ! -d "$install_dir" ]; then | ||
echo "Error: 'install' directory does not exist in $root_dir" | ||
exit 1 | ||
fi | ||
|
||
# Step 2: Delete all other files/folders except 'install' | ||
find "$root_dir" -mindepth 1 -maxdepth 1 -not -name "install" -exec rm -rf {} + | ||
|
||
# Step 3: Move all files from 'install' to the root directory | ||
mv "$install_dir"/* "$root_dir" 2>/dev/null | ||
|
||
# Step 4: Remove the empty 'install' directory | ||
rmdir "$install_dir" | ||
|
||
echo "Files from 'install' moved to $root_dir, and 'install' directory deleted." | ||
} | ||
|
||
# Detect the operating system | ||
OS_NAME=$(uname) | ||
BUILD_DIR="build" | ||
SCRIPT_DIR=$(pwd) # Project dir | ||
|
||
|
||
|
||
# Determine the appropriate build directory based on the OS | ||
case "$OS_NAME" in | ||
Darwin) | ||
# macOS system | ||
BUILD_DIR="${BUILD_DIR}/macos" | ||
;; | ||
Linux) | ||
# Linux system, further identify the distribution if necessary | ||
if [ -f /etc/os-release ]; then | ||
. /etc/os-release | ||
case "$ID" in | ||
ubuntu) | ||
BUILD_DIR="${BUILD_DIR}/linux_ubuntu" | ||
;; | ||
centos) | ||
BUILD_DIR="${BUILD_DIR}/linux_centos" | ||
;; | ||
*) | ||
# If an unknown Linux distribution, default to generic 'linux' | ||
BUILD_DIR="${BUILD_DIR}/linux" | ||
;; | ||
esac | ||
else | ||
# If unable to detect Linux distribution, default to 'linux' | ||
BUILD_DIR="${BUILD_DIR}/linux" | ||
fi | ||
;; | ||
*) | ||
# If OS is not recognized, default to 'generic' | ||
BUILD_DIR="${BUILD_DIR}/generic" | ||
;; | ||
esac | ||
|
||
# Create the build directory and navigate into it | ||
mkdir -p "$BUILD_DIR" | ||
cd "$BUILD_DIR" || exit 1 | ||
|
||
# Run CMake configuration (adjust the options as needed) | ||
cmake -DCMAKE_BUILD_TYPE=Release \ | ||
-DISF_BUILD_WITH_SAMPLE=ON \ | ||
-DISF_BUILD_WITH_TEST=OFF \ | ||
-DISF_ENABLE_BENCHMARK=OFF \ | ||
-DISF_ENABLE_USE_LFW_DATA=OFF \ | ||
-DISF_ENABLE_TEST_EVALUATION=OFF \ | ||
-DISF_BUILD_SHARED_LIBS=ON ../../ | ||
-DISF_BUILD_SHARED_LIBS=ON "$SCRIPT_DIR" | ||
|
||
# Compile and install | ||
make -j4 | ||
make install | ||
make install | ||
|
||
# Move 'install' files to the build root directory using an absolute path | ||
move_install_files "$(pwd)" |
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,51 @@ | ||
#!/bin/bash | ||
|
||
# Reusable function to handle 'install' directory operations | ||
move_install_files() { | ||
local root_dir="$1" | ||
local install_dir="$root_dir/install" | ||
|
||
# Step 1: Check if the 'install' directory exists | ||
if [ ! -d "$install_dir" ]; then | ||
echo "Error: 'install' directory does not exist in $root_dir" | ||
exit 1 | ||
fi | ||
|
||
# Step 2: Delete all other files/folders except 'install' | ||
find "$root_dir" -mindepth 1 -maxdepth 1 -not -name "install" -exec rm -rf {} + | ||
|
||
# Step 3: Move all files from 'install' to the root directory | ||
mv "$install_dir"/* "$root_dir" 2>/dev/null | ||
|
||
# Step 4: Remove the empty 'install' directory | ||
rmdir "$install_dir" | ||
|
||
echo "Files from 'install' moved to $root_dir, and 'install' directory deleted." | ||
} | ||
|
||
SCRIPT_DIR=$(pwd) # Project dir | ||
|
||
mkdir -p build/linux_armv7_armhf | ||
# shellcheck disable=SC2164 | ||
cd build/linux_armv7_armhf | ||
# export cross_compile_toolchain=/home/jingyuyan/software/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf | ||
cmake -DCMAKE_SYSTEM_NAME=Linux \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DCMAKE_SYSTEM_VERSION=1 \ | ||
-DCMAKE_SYSTEM_PROCESSOR=armv7 \ | ||
-DCMAKE_C_COMPILER=$ARM_CROSS_COMPILE_TOOLCHAIN/bin/arm-linux-gnueabihf-gcc \ | ||
-DCMAKE_CXX_COMPILER=$ARM_CROSS_COMPILE_TOOLCHAIN/bin/arm-linux-gnueabihf-g++ \ | ||
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -flax-vector-conversions" \ | ||
-DTARGET_PLATFORM=armlinux \ | ||
-DISF_BUILD_LINUX_ARM7=ON \ | ||
-DISF_BUILD_WITH_SAMPLE=OFF \ | ||
-DISF_BUILD_WITH_TEST=OFF \ | ||
-DISF_ENABLE_BENCHMARK=OFF \ | ||
-DISF_ENABLE_USE_LFW_DATA=OFF \ | ||
-DISF_ENABLE_TEST_EVALUATION=OFF \ | ||
-DISF_BUILD_SHARED_LIBS=ON ${SCRIPT_DIR} | ||
|
||
make -j4 | ||
make install | ||
|
||
move_install_files "$(pwd)" |
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
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
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,44 @@ | ||
#!/bin/bash | ||
|
||
# Reusable function to handle 'install' directory operations | ||
move_install_files() { | ||
local root_dir="$1" | ||
local install_dir="$root_dir/install" | ||
|
||
# Step 1: Check if the 'install' directory exists | ||
if [ ! -d "$install_dir" ]; then | ||
echo "Error: 'install' directory does not exist in $root_dir" | ||
exit 1 | ||
fi | ||
|
||
# Step 2: Delete all other files/folders except 'install' | ||
find "$root_dir" -mindepth 1 -maxdepth 1 -not -name "install" -exec rm -rf {} + | ||
|
||
# Step 3: Move all files from 'install' to the root directory | ||
mv "$install_dir"/* "$root_dir" 2>/dev/null | ||
|
||
# Step 4: Remove the empty 'install' directory | ||
rmdir "$install_dir" | ||
|
||
echo "Files from 'install' moved to $root_dir, and 'install' directory deleted." | ||
} | ||
|
||
SCRIPT_DIR=$(pwd) # Project dir | ||
|
||
mkdir -p build/linux_ubuntu18/ | ||
# shellcheck disable=SC2164 | ||
cd build/linux_ubuntu18/ | ||
|
||
cmake -DCMAKE_BUILD_TYPE=Release \ | ||
-DISF_BUILD_WITH_SAMPLE=ON \ | ||
-DISF_BUILD_WITH_TEST=OFF \ | ||
-DISF_ENABLE_BENCHMARK=OFF \ | ||
-DISF_ENABLE_USE_LFW_DATA=OFF \ | ||
-DISF_ENABLE_TEST_EVALUATION=OFF \ | ||
-DOpenCV_DIR=3rdparty/inspireface-precompile/opencv/4.5.1/opencv-ubuntu18-x86/lib/cmake/opencv4 \ | ||
-DISF_BUILD_SHARED_LIBS=ON ${SCRIPT_DIR} | ||
|
||
make -j4 | ||
make install | ||
|
||
move_install_files "$(pwd)" |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.