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
17 changes: 9 additions & 8 deletions .github/workflows/build_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- main
- develop
- feature*

pull_request_target:
types:
Expand Down Expand Up @@ -44,28 +45,28 @@ jobs:
repository: ${{github.event.pull_request.head.repo.full_name}}
fetch-depth: 0

- name: Install Build Wrapper
- name: Install SonarQube build wrapper
uses: SonarSource/sonarqube-scan-action/install-build-wrapper@v4

- name: Build using SonarQube Build Wrapper
- name: Build
run: |
./scripts/build.sh build --ci
./build.sh build --ci

- name: Run Tests
- name: Test
run: |
./scripts/build.sh coverage
./build.sh coverage

- name: Static analysis
run: |
./scripts/build.sh lint
./build.sh lint

- name: Upload codecov report
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./build/coverage.total

- name: SonarCloud Scan on push
- name: SonarQube analysis
if: github.event_name == 'push'
uses: SonarSource/sonarqube-scan-action@v4
env:
Expand All @@ -76,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: SonarCloud Scan on pull request
- name: SonarQube analysis
if: github.event_name == 'pull_request_target'
uses: SonarSource/sonarqube-scan-action@v4
env:
Expand Down
25 changes: 3 additions & 22 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ set(AOS_CORE_DIR
CACHE STRING "path where Aos core lib, core API and other dependencies are located"
)

option(WITH_CM "build with communication manager" ON)
option(WITH_IAM "build with iam" ON)
option(WITH_MP "build with message proxy" ON)
option(WITH_SM "build with service manager" ON)
option(WITH_CM "build with communication manager" ON)

option(WITH_VCHAN "build with vchan" ON)

Expand All @@ -36,6 +36,7 @@ message(STATUS "CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}")
message(STATUS)
message(STATUS "AOS_CORE_DIR = ${AOS_CORE_DIR}")
message(STATUS)
message(STATUS "WITH_CM = ${WITH_CM}")
message(STATUS "WITH_IAM = ${WITH_IAM}")
message(STATUS "WITH_MP = ${WITH_MP}")
message(STATUS "WITH_SM = ${WITH_SM}")
Expand Down Expand Up @@ -162,27 +163,7 @@ if(NOT EXISTS ${AOS_CORE_API_DIR})
endif()

# ######################################################################################################################
# Targets
# Subdirectories
# ######################################################################################################################

include(AddModule)

add_subdirectory(src)

# External projects

add_subdirectory(${AOS_CORE_API_DIR} aos_core_api)
add_subdirectory(${AOS_CORE_LIB_DIR}/src/common aos_core_lib/common)

if(WITH_SM)
add_subdirectory(${AOS_CORE_LIB_DIR}/src/sm aos_core_lib/sm)
endif()

if(WITH_MP OR WITH_IAM)
add_subdirectory(${AOS_CORE_LIB_DIR}/src/iam aos_core_lib/iam)
endif()

if(WITH_TEST)
add_subdirectory(${AOS_CORE_LIB_DIR}/tests/utils aos_core_lib_cpp/tests/utils)
add_subdirectory(${AOS_CORE_LIB_DIR}/tests/include aos_core_lib_cpp/tests/include)
endif()
58 changes: 30 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,34 @@

## Prepare build environment

```sh
```console
sudo apt install lcov
pip install conan
```

`lcov` version 2.0 or greater is required. If your Linux distributive doesn't contain the required version, download and
install the required version manually. For example in Ubuntu 22.04 it can be installed as following:

```console
wget https://launchpad.net/ubuntu/+source/lcov/2.0-4ubuntu2/+build/27959742/+files/lcov_2.0-4ubuntu2_all.deb
sudo dpkg -i lcov_2.0-4ubuntu2_all.deb
```

## Build for host

To make a build for host please run:

```sh
./host_build.sh
```console
./build.sh build
```

It installs all external dependencies to conan, creates `./build` directory, builds the AoCore components with unit
tests and coverage calculation target.

It is also possible to customize the build using different cmake options:

```sh
cd ${BUILD_DIR}
```console
cd build/
conan install ../conan/ --output-folder . --settings=build_type=Debug --build=missing
cmake .. -DCMAKE_TOOLCHAIN_FILE=./conan_toolchain.cmake -DWITH_TEST=ON -DCMAKE_BUILD_TYPE=Debug
```
Expand All @@ -35,6 +43,11 @@ Cmake options:
| Option | Value | Default | Description |
| --- | --- | --- | --- |
| `AOS_EXTERNAL_DIR` | `path/to/core to` | `build/core` | Aos core lib and API directory path |
| `WITH_CM` | `ON`, `OFF` | `ON` | build AosCore communication manager (CM) |
| `WITH_IAM` | `ON`, `OFF` | `ON` | build AosCore identity and access manager (IAM) |
| `WITH_MP` | `ON`, `OFF` | `ON` | build AosCore message proxy (MP) |
| `WITH_SM` | `ON`, `OFF` | `ON` | build AosCore service manager (SM) |
| `WITH_VCHAN` | `ON`, `OFF` | `ON` | use Xen vchan as communication transport for MP |
| `WITH_TEST` | `ON`, `OFF` | `OFF` | creates unit tests target |
| `WITH_COVERAGE` | `ON`, `OFF` | `OFF` | creates coverage calculation target |
| `WITH_DOC` | `ON`, `OFF` | `OFF` | creates documentation target |
Expand All @@ -50,31 +63,23 @@ Cmake variables:

Build and run:

```sh
./host_build.sh
cd ${BUILD_DIR}
make test
```console
./build.sh test
```

## Check coverage

`lcov` utility shall be installed on your host to run this target:

```sh
sudo apt install lcov
```
`lcov` utility shall be installed on your host to run this target. See [this chapter](#prepare-build-environment).

Build and run:

```sh
./host_build.sh
cd ${BUILD_DIR}
make coverage
```console
./build.sh coverage
```

The overall coverage rate will be displayed at the end of the coverage target output:

```sh
```console
...
Overall coverage rate:
lines......: 94.7% (72 of 76 lines)
Expand All @@ -87,21 +92,18 @@ Detailed coverage information can be find by viewing `./coverage/index.html` fil

`doxygen` package should be installed before generation the documentations:

```sh
```console
sudo apt install doxygen
```

`host_build.sh` tool doesn't generate documentation. User should run the following commands to do that:
Generate documentation:

```sh
cd ${BUILD_DIR}
conan install ../conan/ --output-folder . --settings=build_type=Debug --build=missing
cmake .. -DCMAKE_TOOLCHAIN_FILE=./conan_toolchain.cmake -DWITH_DOC=ON
make doc
```console
./build.sh doc
```

The result documentation is located in `${BUILD_DIR}/doc folder`. And it can be viewed by opening
`./doc/html/index.html` file in your browser.
The result documentation is located in `build/doc` folder. And it can be viewed by opening `build/doc/html/index.html`
file in your browser.

## Development tools

Expand Down
Loading
Loading