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

New API - Post review deployment #105

Merged
merged 7 commits into from
May 18, 2024
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
18 changes: 16 additions & 2 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Part of the CloudEvent Library
# Exceptions. See /LICENSE for license information.
# Part of the uprocotol project, under the Apache License v2.0
# See /LICENSE for license information.
# SPDX-License-Identifier: Apache-2.0

---
BasedOnStyle: Google
Expand All @@ -10,3 +11,16 @@ DerivePointerAlignment: 'false'
ExperimentalAutoDetectBinPacking: 'false'
FixNamespaceComments: 'true'
PointerAlignment: Left

TabWidth: 4
IndentWidth: 4
AccessModifierOffset: -4

# There are *arguments* that tabs are better for accessibility (allows
# customization to meet individual needs _and_ represents single character on
# alternate display devices), but first-hand accounts / discussions of
# preferences are not easily found at the moment.
#
# Regardless, tabs are used for the time being to allow greater flexibility
# in configuration for the broader community.
UseTab: ForIndentation
91 changes: 57 additions & 34 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,64 @@
# not non-const, which yields distracting results on accessors.
# - performance-unnecessary-value-param is disabled because it duplicate
# modernize-pass-by-value.
Checks:
-*, bugprone-*, -bugprone-branch-clone, -bugprone-easily-swappable-parameters,
-bugprone-narrowing-conversions, google-*, -google-readability-todo,
misc-definitions-in-headers, misc-misplaced-const, misc-redundant-expression,
misc-static-assert, misc-unconventional-assign-operator,
misc-uniqueptr-reset-release, misc-unused-*, modernize-*,
-modernize-avoid-c-arrays, -modernize-return-braced-init-list,
-modernize-use-default-member-init, -modernize-use-emplace,
-modernize-use-nodiscard, performance-*, -performance-unnecessary-value-param,
readability-*, -readability-convert-member-functions-to-static,
-readability-function-cognitive-complexity, -readability-else-after-return,
-readability-identifier-length, -readability-implicit-bool-conversion,
-readability-magic-numbers, -readability-make-member-function-const,
-readability-static-definition-in-anonymous-namespace,
-readability-suspicious-call-argument, -readability-use-anyofallof
Checks: >
-*,
bugprone-*,
#-bugprone-easily-swappable-parameters,
#-bugprone-narrowing-conversions,
cert-*,
-cert-msc50-cpp,
-cert-msc51-cpp,
cppcoreguidelines-*,
-cppcoreguidelines-avoid-non-const-global-variables,
-cppcoreguidelines-special-member-functions,
-cppcoreguidelines-pro-type-reinterpret-cast,
google-*,
#-google-readability-todo,
#-google-runtime-int,
llvm-header-guard,
hicpp-exception-baseclass,
hicpp-no-assembler,
misc-confusable-identifiers,
misc-const-correctness,
misc-definitions-in-headers,
misc-header-include-cycle,
misc-include-cleaner,
misc-misplaced-const,
misc-non-private-member-variables-in-classes,
misc-redundant-expression,
misc-static-assert,
misc-unconventional-assign-operator,
misc-uniqueptr-reset-release,
misc-unused-*,
misc-use-anonymous-namespace,
modernize-*,
-modernize-use-trailing-return-type,
performance-*,
-performance-avoid-endl,
portability-*,
-portability-restrict-system-includes,
readability-*,
#-readability-convert-member-functions-to-static,
-readability-identifier-length,
-readability-suspicious-call-argument,
WarningsAsErrors: true
CheckOptions:
- { key: readability-identifier-naming.ClassCase, value: CamelCase }
- {
key: readability-identifier-naming.ConstexprVariableCase,
value: CamelCase,
- { key: readability-identifier-naming.ClassCase, value: CamelCase }
- {
key: readability-identifier-naming.ConstexprVariableCase,
value: UPPER_CASE,
}
- { key: readability-identifier-naming.NamespaceCase, value: CamelCase }
- { key: readability-identifier-naming.StructCase, value: CamelCase }
- {
key: readability-identifier-naming.TemplateParameterCase,
value: CamelCase,
- { key: readability-identifier-naming.NamespaceCase, value: lower_case }
- { key: readability-identifier-naming.StructCase, value: CamelCase }
- {
key: readability-identifier-naming.TemplateParameterCase,
value: CamelCase,
}
- { key: readability-identifier-naming.TypeAliasCase, value: CamelCase }
- { key: readability-identifier-naming.TypedefCase, value: CamelCase }
- { key: readability-identifier-naming.UnionCase, value: CamelCase }
- { key: readability-identifier-naming.VariableCase, value: lower_case }
- { key: readability-identifier-naming.ParameterCase, value: lower_case }
- { key: readability-identifier-naming.ClassMemberCase, value: lower_case }
- {
key: readability-identifier-naming.MethodIgnoredRegexp,
value: '^classof$',
}
- { key: readability-identifier-naming.TypeAliasCase, value: CamelCase }
- { key: readability-identifier-naming.TypedefCase, value: CamelCase }
- { key: readability-identifier-naming.UnionCase, value: CamelCase }
- { key: readability-identifier-naming.VariableCase, value: lower_case }
- { key: readability-identifier-naming.ParameterCase, value: lower_case }
- { key: readability-identifier-naming.ClassMemberCase, value: lower_case }
- { key: readability-identifier-naming.ClassMemberSuffix, value: _ }
164 changes: 140 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,55 +5,171 @@ on:
branches: [ main ]
pull_request:
branches: ["**"]
workflow_call:
workflow_dispatch:

jobs:
build:
name: Build
name: Build up-cpp and dependencies
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install Conan
id: conan
uses: turtlebrowser/get-conan@main

- name: Conan version
run: echo "${{ steps.conan.outputs.version }}"


- name: Create default Conan profile
run: conan profile detect

- name: Conan cache archive
id: conan-cache
uses: actions/cache@v4
with:
key: ${{ runner.os }}-conan-cache
path: conan-cache.tgz

- name: Fetch and link up-core-api
- name: Restore conan cache from archive
if: ${{ steps.conan-cache.outputs.cache-hit == 'true' }}
shell: bash
run: |
git clone -b uprotocol-core-api-1.5.6 https://github.com/eclipse-uprotocol/up-core-api.git
git submodule update --init --recursive
conan cache restore conan-cache.tgz
rm conan-cache.tgz

- name: Build && install up-cpp
- name: Fetch up-core-api conan recipe
uses: actions/checkout@v4
with:
path: up-conan-recipes
repository: gregmedd/up-conan-recipes

- name: Build up-core-api conan package
shell: bash
run: |
mkdir -p build && cd build
conan install .. -o build_testing=True
cmake -S .. -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=~/local
cmake --build . --target install -- -j
conan create --version 1.5.8 up-conan-recipes/up-core-api/developer

- name: Fetch up-cpp
uses: actions/checkout@v4
with:
path: up-cpp

- name: Run the test
- name: Build up-cpp with tests
shell: bash
run: |
cd up-cpp
conan install . --build=missing
cd build
cmake -S .. -DCMAKE_TOOLCHAIN_FILE=Release/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=yes
cmake --build . -- -j

- name: Save conan cache to archive
shell: bash
run: |
conan cache save --file ./conan-cache.tgz '*'

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: up-cpp/build

- name: Upload compile commands
uses: actions/upload-artifact@v4
with:
name: compile-commands
path: up-cpp/build/compile_commands.json

test:
name: Run up-cpp tests
runs-on: ubuntu-latest
needs: build

steps:
- name: Get build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
path: up-cpp/build

- name: Run all tests
shell: bash
run: |
cd up-cpp/build
chmod +x bin/*
ctest

- name: Create up-cpp Conan package
- name: Upload test results
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: test-results
path: 'up-cpp/build/test/results/*.xml'

lint:
name: Lint C++ sources
runs-on: ubuntu-latest
needs: build

steps:
- name: Get build commands
uses: actions/download-artifact@v4
with:
name: compile-commands

- name: Install Conan
id: conan
uses: turtlebrowser/get-conan@main

- name: Create default Conan profile
run: conan profile detect

- name: Conan cache archive
id: conan-cache
uses: actions/cache@v4
with:
key: ${{ runner.os }}-conan-cache
fail-on-cache-miss: true
path: conan-cache.tgz

- name: Restore conan cache from archive
shell: bash
run: |
conan create . --build=missing


conan cache restore conan-cache.tgz

- name: Fetch up-cpp
uses: actions/checkout@v4
with:
path: up-cpp

- name: Run linters on source
id: source-linter
uses: cpp-linter/cpp-linter-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
repo-root: up-cpp
ignore: 'test'
style: 'file' # read .clang-format for configuration
tidy-checks: '' # Read .clang-tidy for configuration
database: compile_commands.json
#extra-args: '-std=c++17 -cxx-isystem/usr/include/c++/12/ -Iinclude ${{ steps.pkgs.outputs.includes }}'
#version: 18

- name: Run linters on tests
id: test-linter
uses: cpp-linter/cpp-linter-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
repo-root: up-cpp
ignore: 'src|include'
style: 'file' # read .clang-format for configuration
tidy-checks: '' # Read .clang-tidy for configuration
database: compile_commands.json
#extra-args: '-std=c++17 -cxx-isystem/usr/include/c++/12/ -Iinclude -Itest/include ${{ steps.pkgs.outputs.includes }}'
#version: 18

- name: Report lint failure
if: steps.source-linter.outputs.checks-failed > 0 || steps.test-linter.outputs.checks-failed > 0
run: |
exit 1

# NOTE: In GitHub repository settings, the "Require status checks to pass
# before merging" branch protection rule ensures that commits are only merged
# from branches where specific status checks have passed. These checks are
Expand All @@ -62,8 +178,8 @@ jobs:
ci:
name: CI status checks
runs-on: ubuntu-latest
needs: build
needs: [build, test]
if: always()
steps:
- name: Check whether all jobs pass
run: echo '${{ toJson(needs) }}' | jq -e 'all(.result == "success")'
run: echo '${{ toJson(needs) }}' | jq -e 'all(.result == "success")'
23 changes: 2 additions & 21 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,25 +1,6 @@
.idea/*
build/*
CMakeCache.txt
CMakeFiles/
Makefile
cmake-build-debug/
cmake-build-release/
cmake_install.cmake
/proto/cloudevents.pb.cc
/proto/cloudevents.pb.h
/proto/libproto.a
/test_app
/libcloudeventGM.a
/json_serializer_test
/binary_serializer_test
/service_type_test
.vscode/settings.json
/.cmake/
/build.ninja
/Testing/Temporary/LastTest.log
/.ninja_deps
/.ninja_log
.vscode
up-core-api/
/include/uprotocol-cpp/uri/datamodel/
CMakeUserPresets.json
*.swp
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

Loading