diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml new file mode 100644 index 0000000..a04bf7e --- /dev/null +++ b/.github/workflows/build-test.yml @@ -0,0 +1,41 @@ +name: Tests + +on: + push: + branches: + - main + pull_request: + branches: + - main + workflow_dispatch: + +jobs: + build-and-test: + runs-on: ubuntu-latest + container: + image: ghcr.io/${{ github.repository_owner }}/embedded-lib-dev:latest + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Check environment + run: | + cmake --version + gcc --version + + - name: Create build directory + run: mkdir build + + - name: Configure CMake + run: cmake -DTARGET_GROUP=test .. + working-directory: ./build + + - name: Build tests + run: cmake --build . + working-directory: ./build + + - name: Run tests + run: ctest --output-on-failure + working-directory: ./build \ No newline at end of file diff --git a/README.md b/README.md index edad366..c88c875 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,98 @@ -# Generic Embedded Software Library +## EmbeddedLib: Generic Embedded Software Library +[![Tests](https://github.com/emilcode-dev/embedded-lib/actions/workflows/build-test.yml/badge.svg)](https://github.com/emilcode-dev/embedded-lib/actions/workflows/build-test.yml) +[![Build Devcontainer Image](https://github.com/emilcode-dev/embedded-lib/actions/workflows/devcontainer.yml/badge.svg)](https://github.com/emilcode-dev/embedded-lib/actions/workflows/devcontainer.yml) + +EmbeddedLib is a modular C/C++ library designed for embedded software projects. It provides reusable components, build/test automation with CMake, and packaging via Conan. The repository supports both development and production builds, integrates with JFrog Artifactory for package management, and includes documentation generation tools. This project aims to streamline embedded development workflows and promote code reuse across projects. + +### Developer guide * run docker * run dev container in vs code * build project - mkdir build && cd build - - test: - cmake -DTARGET_GROUP=test .. - cmake --build . - ctest - - production: - cmake -DTARGET_GROUP=production .. - cmake --build . \ No newline at end of file + +``` +mkdir build && cd build +``` + +- test build: + +``` +cmake -DTARGET_GROUP=test .. +cmake --build . +ctest +``` + +- production build: + +``` +cmake -DTARGET_GROUP=production .. +cmake --build . +``` + +### JFrog configuration + + +#### Add artifactory repository to client configuration +``` +conan remote add emilcode-conan https://emilcodedev.jfrog.io/artifactory/api/conan/emilcode-conan +``` + +#### Login to the artifactory (Conan V2.x and up), client documentation found here: docs.conan.io + +``` +conan remote login -p emilcode-conan +``` + +### JFrog Upload +Upload a Conan (Conan 2) recipe and its binary packages using the following command: + +``` +conan upload "*" --remote=emilcode-conan --confirm +``` + + is the Conan recipe reference you want to upload in the format: /@/ +For example: lib/1.0@conan/stable + + +### Build library + +``` +conan profile detect --name=profile_build_detected +conan install . --build missing --profile:build=profile_build_detected --profile:host=profile_build_detected +``` + +#### Activate the build environment so that we use the selected CMake version for building + +``` +source build/Release/generators/conanbuild.sh +``` + +#### Build our application + +``` +cmake --preset=conan-release +cmake --build --preset=conan-release +``` + +### Build and Run Unittests + +Unity is used in this project as unittesting framework. + +``` +mkdir build && cd build +cmake -DTARGET_GROUP=test .. +cmake --build . +ctest +``` + +### Create documentation + +``` +cd doc +doxygen Doxyfile +sphinx-build ./source ./build +``` + +### Outlook + +- [ ] Add \ No newline at end of file