Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
2091ce7
Make CI run on push/PR to any branch
pavel-kirienko Oct 2, 2021
82e9474
Drop canard_dsdl, use Nunavut instead
pavel-kirienko Oct 2, 2021
4474a15
Upgrade CI to Clang 12
pavel-kirienko Oct 2, 2021
659fc5f
Actualize license headers
pavel-kirienko Oct 2, 2021
032c5bb
Autoformat
pavel-kirienko Oct 2, 2021
c330358
Support redundant transmission queues and use more consistent public …
pavel-kirienko Oct 2, 2021
294d473
Ditch the deprecated canardRxAccept(), rename canardRxAccept2()
pavel-kirienko Oct 2, 2021
048da8e
Squelch warning on 8-bit platforms
pavel-kirienko Oct 2, 2021
da257b0
Enhance coverage
pavel-kirienko Oct 3, 2021
02cdfc6
Refactor the API to eliminate the need to cast away const qualifiers;…
pavel-kirienko Oct 3, 2021
c2a9dac
Clean up the build script
pavel-kirienko Oct 3, 2021
95bd67d
Add clarifications regarding the pointer conversion
pavel-kirienko Oct 4, 2021
c50333c
Tighten up memory checking in the test suite -- add canaries
pavel-kirienko Oct 4, 2021
63e0da1
Fix race condition in the roundtrip test
pavel-kirienko Oct 4, 2021
1beea65
Do not use Catch2 macros from non-main thread because it is not threa…
pavel-kirienko Oct 4, 2021
40389d5
Support CANARD_CONFIG_HEADER
pavel-kirienko Oct 4, 2021
4160d3a
CI: add style_check job
pavel-kirienko Oct 4, 2021
2bd0fcb
Restructure the CI config
pavel-kirienko Oct 4, 2021
1138b2e
Stricten up TxQueue size calculation checks
pavel-kirienko Oct 5, 2021
f0cc4ba
Move MTU over to CanardTxQueue and update the docs
pavel-kirienko Oct 5, 2021
6fe9773
Remove aborts from the readme
pavel-kirienko Oct 5, 2021
f58afa9
Use AVL tree in the transmission queue
pavel-kirienko Oct 12, 2021
b2a2be2
Remove all linked lists
pavel-kirienko Oct 12, 2021
1e18d43
Update the API docs
pavel-kirienko Oct 13, 2021
9b42e29
Reformat
pavel-kirienko Oct 13, 2021
5472937
Update CI badge
pavel-kirienko Oct 13, 2021
470feb1
Reduce indirection, pointer casts, and memory footprint by exposing t…
pavel-kirienko Oct 13, 2021
e4aa0d9
Reduce pointer casts to 17
pavel-kirienko Oct 13, 2021
0252158
Update the README
pavel-kirienko Oct 13, 2021
857e2d3
Fix refactoring casualty
pavel-kirienko Oct 13, 2021
49bb4e6
Only run sonarcloud for PR builds
pavel-kirienko Oct 13, 2021
489721b
Suppress false positives from SonarQube
pavel-kirienko Oct 13, 2021
ae6289f
Actualize CI configuration
pavel-kirienko Oct 13, 2021
3b3936e
Address issues reported by SonarCloud
pavel-kirienko Oct 13, 2021
6700ea7
Address feedback from Kalyan
pavel-kirienko Oct 13, 2021
16b9057
Update CI configuration
pavel-kirienko Oct 14, 2021
1f34bf7
Add CAVL test as suggested by Scott
pavel-kirienko Oct 24, 2021
672e545
Disable C++-specific warnings as they make no sense for a C library
pavel-kirienko Oct 24, 2021
5bf4c3c
Clean up compiler flags
pavel-kirienko Oct 24, 2021
b86f0b9
Update CAVL to enable optional assertion checks
pavel-kirienko Nov 27, 2021
62dba01
Add table-based CRC option (#186)
coderkalyan Dec 4, 2021
e858d79
Add docker utilities (#187)
coderkalyan Dec 4, 2021
13cb7b1
Add acceptance filter configuration helpers (#171)
coderkalyan Dec 4, 2021
2e7676e
Switch to LLVM 13 and update the docs
pavel-kirienko Dec 4, 2021
517d6d8
Fix CI workflow
pavel-kirienko Dec 4, 2021
3e13ac2
CI: Fix sonar-scanner conditional
pavel-kirienko Dec 4, 2021
135a9be
Update the filter test
pavel-kirienko Dec 4, 2021
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
210 changes: 95 additions & 115 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,10 @@
name: Main Workflow

on:
push:
branches: [ master ]
pull_request:
branches: [ master, actions ]

on: [push, pull_request]
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

LLVM_VERSION: 13
jobs:
debug:
env:
BUILD_TYPE: Debug

runs-on: ubuntu-latest

strategy:
matrix:
toolchain: ['clang', 'gcc']
include:
- toolchain: gcc
c-compiler: gcc
cxx-compiler: g++
- toolchain: clang
c-compiler: clang-11
cxx-compiler: clang++-11

steps:
- uses: actions/checkout@v2

- name: Install Dependencies
run: sudo apt install gcc-multilib g++-multilib clang-tidy-11 clang-format-11

- name: Configure CMake
run: cmake -B ${{ github.workspace }}/build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_C_COMPILER=${{ matrix.c-compiler }} -DCMAKE_CXX_COMPILER=${{ matrix.cxx-compiler }} tests

- name: Build
working-directory: ${{github.workspace}}/build
run: make VERBOSE=1

- name: Test
working-directory: ${{github.workspace}}/build
run: make test

release:
env:
BUILD_TYPE: Release

runs-on: ubuntu-latest

strategy:
matrix:
toolchain: ['clang', 'gcc']
Expand All @@ -59,95 +13,104 @@ jobs:
c-compiler: gcc
cxx-compiler: g++
- toolchain: clang
c-compiler: clang-11
cxx-compiler: clang++-11

c-compiler: clang
cxx-compiler: clang++
steps:
- uses: actions/checkout@v2

- name: Install Dependencies
run: sudo apt install gcc-multilib g++-multilib

- name: Configure CMake
run: cmake -B ${{ github.workspace }}/build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_C_COMPILER=${{ matrix.c-compiler }} -DCMAKE_CXX_COMPILER=${{ matrix.cxx-compiler }} -DNO_STATIC_ANALYSIS=1 tests

- name: Build
working-directory: ${{github.workspace}}/build
run: make VERBOSE=1

- name: Test
working-directory: ${{github.workspace}}/build
run: make test

minsizerel:
env:
BUILD_TYPE: MinSizeRel

- run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh $LLVM_VERSION
sudo apt-get -y install gcc-multilib g++-multilib clang-tidy-$LLVM_VERSION
sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-$LLVM_VERSION 50
clang-tidy --version
- run: >
cmake
-B ${{ github.workspace }}/build
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_C_COMPILER=${{ matrix.c-compiler }}
-DCMAKE_CXX_COMPILER=${{ matrix.cxx-compiler }}
tests
- working-directory: ${{github.workspace}}/build
run: |
make VERBOSE=1
make test
- uses: actions/upload-artifact@v2
if: always()
with:
name: ${{github.job}}
path: ${{github.workspace}}/**/*
retention-days: 2

optimizations:
runs-on: ubuntu-latest

strategy:
matrix:
toolchain: ['clang', 'gcc']
build_type: [Release, MinSizeRel]
include:
- toolchain: gcc
c-compiler: gcc
cxx-compiler: g++
- toolchain: clang
c-compiler: clang-11
cxx-compiler: clang++-11

c-compiler: clang
cxx-compiler: clang++
steps:
- uses: actions/checkout@v2

- name: Install Dependencies
run: sudo apt install gcc-multilib g++-multilib

- name: Configure CMake
run: cmake -B ${{ github.workspace }}/build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_C_COMPILER=${{ matrix.c-compiler }} -DCMAKE_CXX_COMPILER=${{ matrix.cxx-compiler }} -DNO_STATIC_ANALYSIS=1 tests

- name: Build
working-directory: ${{github.workspace}}/build
run: make VERBOSE=1

- name: Test
working-directory: ${{github.workspace}}/build
run: make test
- run: sudo apt install gcc-multilib g++-multilib
- run: >
cmake
-B ${{ github.workspace }}/build
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DCMAKE_C_COMPILER=${{ matrix.c-compiler }}
-DCMAKE_CXX_COMPILER=${{ matrix.cxx-compiler }}
-DNO_STATIC_ANALYSIS=1
tests
- working-directory: ${{github.workspace}}/build
run: |
make VERBOSE=1
make test
- uses: actions/upload-artifact@v2
if: always()
with:
name: ${{github.job}}
path: ${{github.workspace}}/**/*
retention-days: 2

avr:
runs-on: ubuntu-latest
env:
mcu: at90can64
flags: -Wall -Wextra -Werror -pedantic -Wconversion -Wtype-limits

steps:
- uses: actions/checkout@v2
- run: |
sudo apt install gcc-avr avr-libc
avr-gcc --version
- run: avr-gcc libcanard/*.c -c -std=c99 -mmcu=${{ env.mcu }} ${{ env.flags }}
- run: avr-gcc libcanard/*.c -c -std=c11 -mmcu=${{ env.mcu }} ${{ env.flags }}
- run: avr-gcc libcanard/*.c -c -std=gnu99 -mmcu=${{ env.mcu }} ${{ env.flags }}
- run: avr-gcc libcanard/*.c -c -std=gnu11 -mmcu=${{ env.mcu }} ${{ env.flags }}

style_check:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Install Dependencies
run: sudo apt install gcc-avr avr-libc

- name: Build C99
run: avr-gcc libcanard/*.c -c -std=c99 -mmcu=${{ env.mcu }} ${{ env.flags }}

- name: Build C11
run: avr-gcc libcanard/*.c -c -std=c11 -mmcu=${{ env.mcu }} ${{ env.flags }}

- name: Build GNU99
run: avr-gcc libcanard/*.c -c -std=gnu99 -mmcu=${{ env.mcu }} ${{ env.flags }}

- name: Build GNU11
run: avr-gcc libcanard/*.c -c -std=gnu11 -mmcu=${{ env.mcu }} ${{ env.flags }}
- uses: DoozyX/clang-format-lint-action@v0.13
with:
source: './libcanard ./tests'
exclude: './tests/catch'
extensions: 'c,h,cpp,hpp'
clangFormatVersion: ${{ env.LLVM_VERSION }}

sonarcloud:
runs-on: ubuntu-latest
env:
SONAR_SCANNER_VERSION: 4.6.1.2450
SONAR_SERVER_URL: "https://sonarcloud.io"
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
Expand All @@ -156,7 +119,7 @@ jobs:
- name: Install Dependencies
run: sudo apt install gcc-multilib g++-multilib

- name: Set up JDK 11
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 11
Expand All @@ -173,7 +136,7 @@ jobs:
SONAR_SCANNER_DOWNLOAD_URL: https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${{ env.SONAR_SCANNER_VERSION }}-linux.zip
run: |
mkdir -p $HOME/.sonar
curl -sSLo $HOME/.sonar/sonar-scanner.zip ${{ env.SONAR_SCANNER_DOWNLOAD_URL }}
curl -sSLo $HOME/.sonar/sonar-scanner.zip ${{ env.SONAR_SCANNER_DOWNLOAD_URL }}
unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
echo "$HOME/.sonar/sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-linux/bin" >> $GITHUB_PATH

Expand All @@ -190,10 +153,27 @@ jobs:
cmake tests -DCMAKE_BUILD_TYPE=Debug -DNO_STATIC_ANALYSIS=1 -DCMAKE_C_FLAGS='-DNDEBUG=1'
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} make all
make test
gcov-10 --preserve-paths --long-file-names $(find CMakeFiles/test_private_cov.dir -name '*.gcno')
gcov-10 --preserve-paths --long-file-names $(find CMakeFiles/test_private_le_cov.dir -name '*.gcno')
gcov-10 --preserve-paths --long-file-names $(find CMakeFiles/test_public_cov.dir -name '*.gcno')
gcov --preserve-paths --long-file-names $(find CMakeFiles/test_private_cov.dir -name '*.gcno')
gcov --preserve-paths --long-file-names $(find CMakeFiles/test_public_cov.dir -name '*.gcno')

- name: Run sonar-scanner
run: |
sonar-scanner --define sonar.host.url="${{ env.SONAR_SERVER_URL }}" --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}" --define sonar.login=${{ secrets.SONAR_TOKEN }}
# Don't run sonar-scanner on builds originating from forks due to secrets not being available
run: >
[ -z "$SONAR_TOKEN" ] || sonar-scanner
--define sonar.organization=uavcan
Comment thread
coderkalyan marked this conversation as resolved.
--define sonar.projectName=libcanard
--define sonar.projectKey=libcanard
--define sonar.sources=libcanard
--define sonar.exclusions=libcanard/cavl.h
--define sonar.cfamily.gcov.reportsPath=.
--define sonar.cfamily.cache.enabled=false
--define sonar.cfamily.threads=2
--define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
--define sonar.host.url="${{ env.SONAR_SERVER_URL }}"

- uses: actions/upload-artifact@v2
if: always()
with:
name: ${{github.job}}
path: ${{github.workspace}}/**/*
retention-days: 2
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,5 @@ build-avr/
!**/.idea/dictionaries
!**/.idea/dictionaries/*

# Generated files
dsdlc_generated/

# Pycache
__pycache__/
6 changes: 6 additions & 0 deletions .idea/dictionaries/pavel.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 10 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ The code shall follow applicable high-reliability coding guidelines as explained
The implementation shall be fully compliant with the UAVCAN/CAN specification.

The implementation and the API should be kept simple.
The core library `canard.c` (that is, excluding the optional DSDL presentation layer extension) shall never become
larger than 1000 logical lines of code.
This restriction ensures that the library is kept simple and easy to validate and verify.
There will be no high-level abstractions -- if that is desired, other implementations of UAVCAN should be used.

The library is intended for deeply embedded systems where the resources may be scarce.
Expand Down Expand Up @@ -53,12 +50,13 @@ to prevent non-compliant code from being accepted into upstream.

## Tools

The following tools are required to conduct library development locally:
The following tools are required to conduct library development locally
(check the CI workflow files for the required versions):

- GCC v10 or newer.
- Clang and Clang-Tools v11 or newer.
- CMake v3.12 or newer.
- An AMD64 machine.
- GCC
- Clang and Clang-Tools
- CMake
- An AMD64 machine

### Clang-Tidy

Expand Down Expand Up @@ -102,6 +100,10 @@ We would welcome contributions implementing CI/CD testing against popular embedd
the ARM Cortex M series and AVR in an emulator.
As a high-integrity library, the Libcanard test suite should provide full test coverage for all commonly used platforms.

**WARNING:**
[Catch2 is NOT thread-safe!](https://github.com/catchorg/Catch2/blob/1e379de9d7522b294e201700dcbb36d4f8037301/docs/limitations.md#thread-safe-assertions)
Never use `REQUIRE` etc. anywhere but the main thread.

## Releasing

Simply create a new release on GitHub: <https://github.com/UAVCAN/libcanard/releases/new>
Loading