Skip to content

Commit

Permalink
WIP.
Browse files Browse the repository at this point in the history
Signed-off-by: Ramya Subramanyam <[email protected]>
  • Loading branch information
ramya-subramanyam committed Feb 3, 2025
1 parent ae371fa commit 143a68b
Show file tree
Hide file tree
Showing 23 changed files with 1,116 additions and 22 deletions.
93 changes: 93 additions & 0 deletions .github/workflows/code_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Code check workflow with strategy

on:
push:
branches: [ '*' ]

defaults:
run:
shell: bash

jobs:
setup:
runs-on: ubuntu-24.04

# env:
# GHCR_REGISTRY: ghcr.io
# # issue : organization "Infineon" with capital "I" not allowed.
# IMAGE_NAME: infineon/makers-docker

container:
image: docker.io/ifxmakers/makers-docker:push
# image: ghcr.io/infineon/makers-docker:latest
# credentials:
# # username: ${{ secrets.DOCKERHUB_USERNAME }}
# # password: ${{ secrets.DOCKERHUB_PASSWORD }}
# username: ${{ github.actor }}
# password: ${{ secrets.github_token }}
volumes:
- .:/myLocalWorkingDir:rw
options: --cpus 1

steps:

- name: Checkout actions
uses: actions/checkout@v4
with:
submodules: true

- name: Set strategy matrix
id: set-matrix
run: |
eval $(python3 tools/codeChecks.py --getAllChecks)
outputs:
checks: ${{ steps.set-matrix.outputs.checks }}


flowStep:
runs-on: ubuntu-24.04
needs: setup

container:
image: docker.io/ifxmakers/makers-docker:push
# image: ghcr.io/infineon/makers-docker:latest
# credentials:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_PASSWORD }}
# username: ${{ github.actor }}
# password: ${{ secrets.github_token }}
volumes:
- .:/myLocalWorkingDir:rw
options: --cpus 1

strategy:

matrix:
checks: ${{ fromJson(needs.setup.outputs.checks) }}

steps:

- name: Checkout actions
uses: actions/checkout@v4
with:
submodules: recursive


- name: Demo to show use of script to use matrix values
id: run_build
if: success() || failure()
run: |
echo "Workflow has these parameters :"
echo "matrix.checks : " ${{ matrix.checks }}
echo ""
python3 tools/codeChecks.py --runCheck ${{ matrix.checks }} --showLog
- name: Archive tool reports
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.checks }}.log
path: |
results/${{ matrix.checks }}.log
22 changes: 0 additions & 22 deletions .github/workflows/code_formatting.yml

This file was deleted.

103 changes: 103 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# include test make file
#include tests/arduino-core-tests/Makefile



FQBN ?=
TARGET ?=
UNITY_PATH ?= Unity


##############################################################################################################################################################

clean-results:
-rm -rf results/cppcheck/* results/clang-tidy/* results/build/*
- mkdir -p results/cppcheck results/clang-tidy results/build



##############################################################################################################################################################

run-build-target:
(cd tests/arduino-core-tests ; make FQBN=$(FQBN) UNITY_PATH=Unity $(TARGET))


##############################################################################################################################################################


run-build-target-all:
make FQBN=Infineon:xmc:XMC4700_Relax_Kit UNITY_PATH=Unity TARGET=test_wire_connected1_pingpong run-build-target
make FQBN=Infineon:xmc:XMC4700_Relax_Kit UNITY_PATH=Unity TARGET=test_wire_connected2_slavepingpong run-build-target
make FQBN=Infineon:xmc:XMC4700_Relax_Kit UNITY_PATH=Unity TARGET=test_wire_connected2_masterpingpong run-build-target


run-build-all:
cd tests/arduino-core-tests ; make FQBN=Infineon:xmc:XMC4700_Relax_Kit UNITY_PATH=Unity test_wire_connected1_pingpong
cd tests/arduino-core-tests ; make FQBN=Infineon:xmc:XMC4700_Relax_Kit UNITY_PATH=Unity test_wire_connected2_slavepingpong
cd tests/arduino-core-tests ; make FQBN=Infineon:xmc:XMC4700_Relax_Kit UNITY_PATH=Unity test_wire_connected2_masterpingpong


##############################################################################################################################################################


TAG=push
TAG=latest

DOCKER_REGISTRY=dockerregistry-v2.vih.infineon.com/ifxmakers/makers-docker:$(TAG)
GHCR_REGISTRY=ghcr.io/infineon/makers-docker:$(TAG)

REGISTRY=$(DOCKER_REGISTRY)

DOCKER=docker run --rm -it -v $(PWD):/myLocalWorkingDir:rw $(REGISTRY)
#DOCKER=


### Setting DOCKER variable to empty string => containers not used
### Setting DOCKER variable to "docker run ..." => containers used


pull-container:
docker pull $(REGISTRY)


run-container-build-all: clean-results pull-container
$(DOCKER) make run-build-target-all


run-container-check-wire: clean-results pull-container
$(DOCKER) tools/run_cppcheck.sh cores/psoc/* tests/arduino-core-tests/src/corelibs/wire
firefox results/cppcheck/cppcheck-reports/index.html


run-container-project-setup-script: clean-results pull-container
$(DOCKER) python3 tools/codeChecks.py --getAllChecks
$(DOCKER) python3 tools/codeChecks.py --runCheck check-clang-tidy
$(DOCKER) python3 tools/codeChecks.py --runAllChecks
# firefox results/cppcheck/cppcheck-reports/index.html


run-container-project-setup-script-with-show-logs: clean-results pull-container
$(DOCKER) python3 tools/codeChecks.py --getAllChecks
$(DOCKER) python3 tools/codeChecks.py --runCheck check-clang-tidy --showLog
$(DOCKER) python3 tools/codeChecks.py --runAllChecks --showLog
# firefox results/cppcheck/cppcheck-reports/index.html


run-container-cppcheck: clean-results pull-container
$(DOCKER) python3 tools/codeChecks.py --runCheck check-cppcheck
firefox results/cppcheck/cppcheck-reports/index.html

##############################################################################################################################################################

# check container content
run-container-bash: pull-container
$(DOCKER)


# run stuff with container from docker hub
run-container-build: clean-results pull-container
$(DOCKER) make run-build-all




26 changes: 26 additions & 0 deletions config/clang-format/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
# We'll use defaults from the LLVM style, but with 4 columns indentation.
#BasedOnStyle: GNU
BasedOnStyle: LLVM
#BasedOnStyle: Google
#BasedOnStyle: Mozilla
#BasedOnStyle: Chromium
IndentWidth: 4
---
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -4
Standard: c++17
TabWidth: 2
UseTab: Never
ColumnLimit: 100
AlignAfterOpenBracket: Align
BinPackParameters: false
AlignEscapedNewlines: Left
AlwaysBreakTemplateDeclarations: Yes
PackConstructorInitializers: Never
BreakConstructorInitializersBeforeComma: false
IndentPPDirectives: BeforeHash
SortIncludes: Never
SeparateDefinitionBlocks: Always
...
54 changes: 54 additions & 0 deletions config/clang-tidy/.clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
Checks: 'cppcoreguidelines-*,
performance-*,
modernize-*,
google-*,
misc-*
cert-*,
readability-*,
clang-analyzer-*,
-performance-unnecessary-value-param,
-modernize-use-trailing-return-type,
-google-runtime-references,
-misc-non-private-member-variables-in-classes,
-readability-braces-around-statements,
-google-readability-braces-around-statements,
-cppcoreguidelines-avoid-magic-numbers,
-readability-magic-numbers,
-readability-magic-numbers,
-cppcoreguidelines-pro-type-vararg,
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
-cppcoreguidelines-avoid-c-arrays,
-modernize-avoid-c-arrays,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
-readability-named-parameter,
-cert-env33-c
'


WarningsAsErrors: ''
HeaderFilterRegex: '.*'
#HeaderFilterRegex: '*spdlog/[^f].*'
#AnalyzeTemporaryDtors: false
FormatStyle: none

CheckOptions:
- key: google-readability-braces-around-statements.ShortStatementLines
value: '1'
- key: google-readability-function-size.StatementThreshold
value: '800'
- key: google-readability-namespace-comments.ShortNamespaceLines
value: '10'
- key: google-readability-namespace-comments.SpacesBeforeComments
value: '2'
- key: modernize-loop-convert.MaxCopySize
value: '16'
- key: modernize-loop-convert.MinConfidence
value: reasonable
- key: modernize-loop-convert.NamingStyle
value: CamelCase
- key: modernize-pass-by-value.IncludeStyle
value: llvm
- key: modernize-replace-auto-ptr.IncludeStyle
value: llvm
- key: modernize-use-nullptr.NullMacros
value: 'NULL'
4 changes: 4 additions & 0 deletions config/cppcheck/misra.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"script": "misra.py",
"args": [ "--rule-texts=config/cppcheck/misra.txt" ]
}
Empty file added config/cppcheck/misra.txt
Empty file.
16 changes: 16 additions & 0 deletions config/project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
build:
build-psoc-cy8ckit_062s2_ai:
description: Compiling test_digitalio_single.cpp for PSOC6 platform
target: test_digitalio_single
fqbn: infineon:psoc:cy8ckit_062s2_ai

check:
check-clang-tidy:
description: clang-tidy check for wire sources
tool: clang-tidy
command: clang-tidy --config-file=config/clang-tidy/.clang-tidy -header-filter=. ./cores/psoc/*.cpp --

check-cppcheck:
description: cppcheck check for wire sources
tool: cppcheck
command: tools/run_cppcheck.sh ./cores/psoc/*
6 changes: 6 additions & 0 deletions config/user.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
check:
- check-clang-tidy
- check-cppcheck

build:
- build-psoc-cy8ckit_062s2_ai
64 changes: 64 additions & 0 deletions tools/check_schemata/board_features_yaml_schema.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
from schema import And, Or, Use, Optional

boardsFeaturesYAMLSchema = {
str: {
Optional("description"): str,
"architecture": str,
"subarchitecture": str,
"arduino_related": Or(
None,
And(
{
Optional("fqbn"): str,
Optional("iic"): int,
Optional("spi"): int,
Optional("uart"): int,
Optional("analog_pins"): int,
Optional("gpio_pins"): int,
Optional("pwm_pins"): int,
}
),
),
"mtb_related": Or(
None,
And(
{
Optional("hw_ext"): str,
Optional("iic"): int,
Optional("spi"): int,
Optional("uart"): int,
Optional("analog_pins"): int,
Optional("gpio_pins"): int,
Optional("pwm_pins"): int,
}
),
),
"features": Or(
None,
And(
{
Optional("has_wifi"): bool,
Optional("wifi_channels"): int,
Optional("wifi_standards"): str,
Optional("has_bt"): bool,
Optional("bt_version"): Or(str, float),
Optional("has_can"): bool,
Optional("has_iic"): bool,
Optional("has_spi"): bool,
Optional("has_uart"): bool,
Optional("has_analog_pins"): bool,
Optional("has_gpio_pins"): bool,
Optional("has_pwm_pins"): bool,
}
),
),
Optional("sensors"): Or(
None,
And(
{
str: int,
}
),
),
}
}
Loading

0 comments on commit 143a68b

Please sign in to comment.