diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml new file mode 100644 index 0000000..2efac13 --- /dev/null +++ b/.github/workflows/blank.yml @@ -0,0 +1,28 @@ +# This is a basic workflow to help you get started with Actions +name: CI + +# Controls when the action will run. Triggers the workflow on push or pull request +# events but only for the master branch +on: + push: + branches: [ T-8 ] + pull_request: + branches: [ T-8 ] + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + + # Compile! + - name: Run makefile + run: | + echo Compiling.. + make \ No newline at end of file diff --git a/.github/workflows/coverity-scan.yml b/.github/workflows/coverity-scan.yml new file mode 100644 index 0000000..5f1590f --- /dev/null +++ b/.github/workflows/coverity-scan.yml @@ -0,0 +1,67 @@ + +# This is a basic workflow to help you get started with Actions +name: Coverity Scan + +# Controls when the action will run. Triggers the workflow on push or pull request +# events but only for the master branch +on: + #schedule: + # - cron: '0 18 * * *' # Daily at 18:00 UTC + push: + branches: [ T-8 ] + pull_request: + branches: [ T-8 ] + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + - name: Install dependencies + run: | + echo Installing Dependencies + echo Compiling.. + set -x + sudo sed /etc/apt/sources.list -e "s/^# deb-src/deb-src/g" -i + sudo apt-get update -y + sudo apt-get install -y wget tar + sudo apt-get install -y build-essential + ### + - name: Download Coverity Build Tool + run: | + wget https://scan.coverity.com/download/linux64 --post-data "token=k6qP6g2jPgQpCUHmsCscKA&project=EmbeddedTemplate" -O coverity_tool.tgz + wget -q https://scan.coverity.com/download/cxx/linux64 --post-data "token=$TOKEN&project=EmbeddedTemplate" -O cov-analysis-linux64.tar.gz + mkdir cov-analysis-linux64 + tar xzf cov-analysis-linux64.tar.gz --strip 1 -C cov-analysis-linux64 + env: + TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} + ### + - name: Fixed world writable dirs + run: | + chmod go-w $HOME + sudo chmod -R go-w /usr/share + # Generating a output for send to Covertiy Scan + - name: Build with cov-build + run: | + export PATH=`pwd`/cov-analysis-linux64/bin:$PATH + cov-build --dir cov-int make + # Sending the output + - name: Submit the result to Coverity Scan + run: | + tar czvf EmbeddedTemplate.tgz cov-int + curl \ + --form project=EmbeddedTemplate \ + --form token=$TOKEN \ + --form email=afari@gtu.edu.tr \ + --form file=@EmbeddedTemplate.tgz \ + --form version=trunk \ + --form description="`./EmbeddedTemplate -v`" \ + https://scan.coverity.com/builds?project=EmbeddedTemplate + env: + TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} diff --git a/.gitignore b/.gitignore index c6127b3..e7831a7 100644 --- a/.gitignore +++ b/.gitignore @@ -50,3 +50,6 @@ modules.order Module.symvers Mkfile.old dkms.conf + +# Project specific +out/ \ No newline at end of file diff --git a/Documents/LifeCycle.md b/Documents/LifeCycle.md new file mode 100644 index 0000000..887a1ef --- /dev/null +++ b/Documents/LifeCycle.md @@ -0,0 +1,49 @@ +**Open IoT Academy** + +**Software Development Life Cycle** : V Model of Development + +Open IoT Academy is an open source organisation and produces high assurance and high quality software for IoT. + +For this purposes, Open IoT Academy uses **V Model of Development Life Cycle** for its open source development. + +​ *In this document, we do not detail V Model of Development; for details please see [Wikipedia](https://en.wikipedia.org/wiki/V-Model_(software_development)).* + +![V-Model-Of-Development](https://github.com/OpenIoTAcademy/Resources/blob/master/Images/VModelOfDevelopment.jpg) + +Please see the phases for the V Model of Development; + +- **External Requirements**: In this phase, the external requirements (e.g. User Expectations) for the final product needs to be defined using the external resources such as product or standard specs. + +- **External Tests**: Once the external requirements are defined, the tests need to be implemented to validate the feature. There is no implementation about the final product yet, therefore, mock implementation needs to be done for the external interface to pass the external tests. + + Automated test infrastructure for the external tests must be up and run in this phase and must be run for each modification during the development. + +- **Internal Requirements**: In this phase, the external requirements are translated to internal requirements (internal design documentation). The architecture team prepares the software design including components, modules, roles and interactions between each other. + +- **Integration Tests**: Integration tests are defined and implemented. There is no implementation yet so mock implementation needs to be done for the integration tests. + + Automated test infrastructure for the integration tests must be up and run in this phase and must be run for each modification during the development. + +- **Module Requirements**: Internal requirements are split into stand-alone modules/units and requirements are defined for the Unit. + +- **Unit Tests** : Like Test Driven Development(TDD), Unit tests are defined and developed for the unit. There is no implementation yet so the mock implementation are done for the unit. + + Automated test infrastructure for the unit tests must be up and run in this phase and must be run for each modification during the development. + + In the unit test, in addition to automated test, there can be some metrics, and SW Quality tools can be a part of the tests. + + Some examples; + + - Static Analysis Tool + - Dynamic Analysis Tools + - Code Coverage Tools (%100 requirement) + - MISRA-2012 checker + + All unit level modifications must meet all above requirements. + +- **Development**: Development is the latest phase in the V Model of Development. All automated testing and Continuous Integration(CI) interface is ready and any modification is well tested with the testing infrastructure. In this way, a bug can be found immediately as soon as the bug introduced. Each modification(commit) has the final product quality (well tested). + + All errors and even warnings must be blocker and the Continuous Integration(CI) tool must not allow the modification to be part of the main code stream (master branch). + + + diff --git a/Include/test.h b/Include/test.h new file mode 100644 index 0000000..b37cc9a --- /dev/null +++ b/Include/test.h @@ -0,0 +1,5 @@ +/** + * @brief A test header + */ + + void testFunction(void); \ No newline at end of file diff --git a/README.md b/README.md index ae230e3..1004540 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,5 @@ # EmbeddedTemplate Template Project For Embedded Projects + +![CI](https://github.com/alifiratari/EmbeddedTemplate/workflows/CI/badge.svg?branch=T-8) +![CI](https://scan.coverity.com/projects/20937/badge.svg?branch=T-8) \ No newline at end of file diff --git a/Source/test.c b/Source/test.c new file mode 100644 index 0000000..15bfc94 --- /dev/null +++ b/Source/test.c @@ -0,0 +1,23 @@ + +/** + * @brief a test source file + */ + + #include "test.h" + + #include + + #ifndef TEST_CONFIG + #error "TEST_CONFIG is not defined" + #endif /* TEST_DEFINE */ + + void testFunction(void) + { + printf("\r\nHello World!"); + printf("\r\nTest Config Value : %d\r\n", TEST_CONFIG); + } + + int main(void) + { + testFunction(); + } \ No newline at end of file diff --git a/makefile b/makefile new file mode 100644 index 0000000..4e88819 --- /dev/null +++ b/makefile @@ -0,0 +1,67 @@ +# +# The root makefile +# + +OUTPUT_PATH=out +OUTPUT_NAME=test + +# The cross compile if exists, otherwise uses the gcc +CROSS_COMPILE?= + +# +# Source (.c) Files +# +SOURCE_FILES= \ + Source/test.c + +# +# Header (.h) File Directories +# +# Bear in mind, include directories must have -I prefix +# +INCLUDE_DIRECTORIES= \ + -IInclude/ + +# +# Project Definitions +# +# Bear in mind, definitions must have -D prefix +# +DEFINES= \ + -DTEST_CONFIG=255 + +# +# All Flags +# +CFLAGS=${INCLUDE_DIRECTORIES} ${DEFINES} + + +############################################# +# Rules +############################################# + + +# +# The main rule +# +all: out test + +# Rebuild +rebuild: clean all + +# The test rule +test: + ${CROSS_COMPILE}gcc -g ${SOURCE_FILES} ${CFLAGS} -o ${OUTPUT_PATH}/${OUTPUT_NAME} + +# The clean rule +clean: + rm -f test + +# The rule to create out path +out: + mkdir -p ${OUTPUT_PATH} + +# The rule to run the output executable +run: + ./${OUTPUT_PATH}/${OUTPUT_NAME} +