Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial implementation of driver #9

Merged
merged 9 commits into from
Nov 7, 2023
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
52 changes: 52 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
Checks: |
*
-altera-*
-android-*
-abseil-*
-cppcoreguidelines-*
-hicpp-*
-llvmlibc-restrict-system-libc-headers
-readability-identifier-length
-readability-function-size
-google-readability-function-size
-bugprone-easily-swappable-parameters
-modernize-macro-to-enum
-llvm-include-order

WarningsAsErrors: ""
HeaderFilterRegex: "-zephyr.h,-logging/log.h"
AnalyzeTemporaryDtors: false
FormatStyle: file
CheckOptions:
- key: readability-function-cognitive-complexity.IgnoreMacros
value: True
- key: readability-identifier-naming.FunctionCase
value: lower_case
- key: readability-identifier-naming.StructCase
value: lower_case
- key: readability-identifier-naming.ClassCase
value: lower_case
- key: readability-identifier-naming.TypedefCase
value: lower_case
- key: readability-identifier-naming.MemberCase
value: lower_case
- key: readability-identifier-naming.EnumCase
value: lower_case
- key: readability-identifier-naming.EnumConstant
value: Camel_Snake_Case
- key: readability-identifier-naming.GlobalConstantCase
value: lower_case
- key: readability-identifier-naming.StaticConstantCase
value: lower_case
- key: readability-identifier-naming.StaticConstantPrefix
value: "prv_"
- key: readability-identifier-naming.GlobalVariableCase
value: lower_case
- key: readability-identifier-naming.GlobalVariablePrefix
value: "prv_"
- key: readability-magic-numbers.IgnoredIntegerValues
value: 0;1;2;3;4;5;6;7;8;9;10;50;99;100;101;1000;16;32;64;128;255;512;1024;2048;4096;8192;16384;32768;32768;60;3600;
- key: readability-magic-numbers.IgnorePowersOf2IntegerValues
value: true
- key: readability-magic-numbers.IgnoredFloatingPointValues
value: 0.25;0.5;0.75;1.0;2.0;3.0;10.0;100.0;1000.0;0.1;0.001;0.0001;-1.0;-2.0;-3.0;
36 changes: 32 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
type: string
pull_request:
types: [opened, reopened, synchronize]
push:
branches:
- "main"

jobs:
build:
Expand All @@ -34,6 +37,21 @@ jobs:
ref: ${{ inputs.checkout_ref }}
path: project

- name: Checkout main
if: github.event_name == 'push'
uses: actions/checkout@v3
with:
ref: main
path: project

- name: Install and cache apt packages
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: gcc-multilib
# Update this manually when changing the packages above, increment
# only minor version to keep APT caches separate.
version: 1.0

- name: Retrieve cache
uses: actions/cache@v3
env:
Expand All @@ -48,7 +66,7 @@ jobs:
tools
zephyr
~/.local/share/east/downloads/
~/.local/share/east/nrfutil-toolchain-manager.exe
~/.local/share/east/tooling/nrfutil
# Note above two lines, if we are caching entire ~/.local/share/east
# folder then cache action fails during download/extract step
key:
Expand All @@ -63,7 +81,10 @@ jobs:
cache: "pip"
cache-dependency-path: project/scripts/requirements.txt

- name: Install dependencies
- name: Install Python dependencies
run: pip install -r scripts/requirements.txt

- name: Install project dependencies
run: make install-dep

- name: Setup project
Expand All @@ -72,8 +93,15 @@ jobs:
- name: Pre-build
run: make pre-build

- name: Build
run: make build
- name: Quick build
if: github.event_name == 'push'
run: make quick-build

- name: Release
if:
github.event_name == 'workflow_dispatch' || github.event_name ==
'pull_request'
run: make release

- name: Pre-package
if: github.event_name == 'workflow_dispatch'
Expand Down
138 changes: 138 additions & 0 deletions .github/workflows/codechecker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
name: CodeChecker

on:
workflow_dispatch:
inputs:
checkout_ref:
description: "Commit to checkout"
required: true
type: string
default: main

pull_request:
types: [opened, reopened, synchronize]

push:
branches:
- "main"

env:
EAST_CODECHECKER_CI_MODE: 1
CODECHECKER_CREDENTIALS: ${{ secrets.CODECHECKER_CREDENTIALS }}
EAST_CODECHECKER_SERVER_URL: ${{ secrets.CODECHECKER_SERVER_URL }}

jobs:
codechecker:
runs-on: ubuntu-22.04
defaults:
run:
shell: bash
# Set work dir to "project" for all 'run' calls. Beware, everything else
# (actions, 'with' params, etc.) still needs to reference full path.
working-directory: project

steps:
- name: Checkout last PR commit
if: github.event_name == 'pull_request'
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
path: project

- name: Checkout last tag
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v3
with:
ref: ${{ inputs.checkout_ref }}
path: project

- name: Checkout main
if: github.event_name == 'push'
uses: actions/checkout@v3
with:
ref: main
path: project

- name: Add LLVM repositories
run: |
# If updating llvm version do not forget to update distro name
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
sudo add-apt-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main"
sudo apt-get update

- name: Install and cache apt packages
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: clang-16 clang-tidy-16 cppcheck gcc-multilib
# Update this manually when changing the packages above, increment
# only minor version to keep APT caches separate.
version: 3.0

- name: Retrieve cache
uses: actions/cache@v3
env:
cache-name: cache-modules
with:
path: |
bootloader
modules
nrf
nrfxlib
test
tools
zephyr
~/.local/share/east/downloads/
~/.local/share/east/tooling/nrfutil
# Note above two lines, if we are caching entire ~/.local/share/east
# folder then cache action fails during download/extract step
key:
${{ runner.os }}-build-${{ env.cache-name }}-${{
hashFiles('project/west.yml') }}
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}-

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
cache: "pip"
cache-dependency-path: project/scripts/requirements.txt

- name: Install Python dependencies
run: pip install -r scripts/requirements.txt

- name: Install dependencies
run: make install-dep

- name: Setup project
run: make project-setup

- name: Login to the server
run: |
echo $CODECHECKER_CREDENTIALS > ~/.codechecker.passwords.json
CodeChecker cmd login --url "${EAST_CODECHECKER_SERVER_URL}"

- name: Pre-build
run: make pre-build

- name: Build
run: make codechecker-build

- name: Check
run: make codechecker-check

- name: Store
if:
github.event_name == 'workflow_dispatch' || github.event_name ==
'push'
run: make codechecker-store

- name: Diff
if: github.event_name == 'pull_request'
run: make codechecker-diff

- name: Package diffs
if: ${{ always() && github.event_name == 'pull_request' }}
uses: actions/upload-artifact@v3
with:
name: codechecker-diffs
path: project/codechecker-diffs/*
16 changes: 12 additions & 4 deletions .github/workflows/twister.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}
path: project

- name: Install and cache apt packages
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: gcc-multilib lcov
# Update this manually when changing the packages above, increment
# only minor version to keep APT caches separate.
version: 2.0

- name: Retrieve cache
uses: actions/cache@v3
env:
Expand All @@ -39,7 +47,7 @@ jobs:
tools
zephyr
~/.local/share/east/downloads/
~/.local/share/east/nrfutil-toolchain-manager.exe
~/.local/share/east/tooling/nrfutil
# Note above two lines, if we are caching entire ~/.local/share/east
# folder then cache action fails during download/extract step
key:
Expand All @@ -54,12 +62,12 @@ jobs:
cache: "pip"
cache-dependency-path: project/scripts/requirements.txt

- name: Install Python dependencies
run: pip install -r scripts/requirements.txt

- name: Install dependencies
run: make install-dep

- name: Install test dependencies
run: make install-test-dep

- name: Setup project
run: make project-setup

Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,6 @@ share/python-wheels/
*.xml
logs/*
snapshots

# Codechecker stuff
codechecker-diffs/*
Loading
Loading