Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .github/workflows/build-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,13 @@ jobs:
- name: Install build wrapper
uses: SonarSource/sonarqube-scan-action/install-build-wrapper@v5

- name: Build
- name: Build (Release)
run: |
./build.sh build --ci
./build.sh build --build-type Release

- name: Build (Debug)
run: |
./build.sh build --ci --clean

- name: Test
run: |
Expand All @@ -62,7 +66,7 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./build/coverage.total

- name: SonarQube analysis
- name: SonarQube analysis (on push)
if: github.event_name == 'push'
uses: SonarSource/sonarqube-scan-action@v5
env:
Expand All @@ -73,7 +77,7 @@ jobs:
--define sonar.cfamily.compile-commands="${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json"
--define sonar.coverageReportPaths=build/coverage_sonarqube.xml

- name: SonarQube analysis
- name: SonarQube analysis (on pull request)
if: github.event_name == 'pull_request_target'
uses: SonarSource/sonarqube-scan-action@v5
env:
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ message(STATUS)

# Check compiler using static library instead of application
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
set(AOS_STACK_USAGE 4096)
set(AOS_STACK_USAGE 8192)

# ######################################################################################################################
# Compiler flags
Expand Down
21 changes: 12 additions & 9 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ print_usage() {
echo " doc generates documentation"
echo
echo "Options:"
echo " --clean cleans build artifacts"
echo " --aos-service <services> specifies services (e.g., sm,mp,iam)"
echo " --clean cleans build artifacts before building"
echo " --ci uses build-wrapper for CI analysis (SonarQube)"
echo " --parallel <N> specifies number of parallel jobs for build (default: all available cores)"
echo " --build-type <type> specifies build type (default: Debug, other options: Release, RelWithDebInfo, MinSizeRel)"
echo
}

Expand Down Expand Up @@ -58,15 +58,15 @@ conan_setup() {

print_next_step "Generate conan toolchain"

conan install ./conan/ --output-folder build --settings=build_type=Debug --build=missing
conan install ./conan/ --output-folder build --settings=build_type="$ARG_BUILD_TYPE" --build=missing
}

build_project() {
print_next_step "Run cmake configure"

cmake -S . -B build \
-DCMAKE_TOOLCHAIN_FILE=./conan_toolchain.cmake \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_BUILD_TYPE="$ARG_BUILD_TYPE" \
-G "Unix Makefiles" \
-DCoverage_SONARQUBE=ON \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
Expand All @@ -78,11 +78,11 @@ build_project() {
if [ "$ARG_CI_FLAG" == "true" ]; then
print_next_step "Run build-wrapper and build (CI mode)"

build-wrapper-linux-x86-64 --out-dir "$BUILD_WRAPPER_OUT_DIR" cmake --build ./build/ --config Debug --parallel ${ARG_PARALLEL_JOBS}
build-wrapper-linux-x86-64 --out-dir "$BUILD_WRAPPER_OUT_DIR" cmake --build ./build/ --config "$ARG_BUILD_TYPE" --parallel "$ARG_PARALLEL_JOBS"
else
print_next_step "Run build"

cmake --build ./build/ --config Debug --parallel ${ARG_PARALLEL_JOBS}
cmake --build ./build/ --config "$ARG_BUILD_TYPE" --parallel "$ARG_PARALLEL_JOBS"
fi

echo
Expand All @@ -107,6 +107,11 @@ parse_arguments() {
shift 2
;;

--build-type)
ARG_BUILD_TYPE="$2"
shift 2
;;

*)
error_with_usage "Unknown option: $1"
;;
Expand All @@ -117,8 +122,6 @@ parse_arguments() {
build_target() {
if [ "$ARG_CLEAN_FLAG" == "true" ]; then
clean_build

return
fi

conan_setup
Expand Down Expand Up @@ -176,9 +179,9 @@ command="$1"
shift

ARG_CLEAN_FLAG=false
ARG_AOS_SERVICES=""
ARG_CI_FLAG=false
ARG_PARALLEL_JOBS=$(nproc)
ARG_BUILD_TYPE="Debug"

case "$command" in
build)
Expand Down
Loading