Skip to content

Commit

Permalink
Merge pull request #186 from EmixamPP/chore/ci/minsize
Browse files Browse the repository at this point in the history
chore(ci): minsize
  • Loading branch information
EmixamPP authored Aug 4, 2024
2 parents 4f998b5 + 6cabed1 commit 17077d7
Show file tree
Hide file tree
Showing 56 changed files with 2,196 additions and 2,229 deletions.
2 changes: 2 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
BasedOnStyle: Google
ColumnLimit: 100
30 changes: 11 additions & 19 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,27 +1,19 @@
---
Checks: '
-clang-diagnostic-pragma-system-header-outside-header,
readability*,
-readability-identifier-length,
-readability-braces-around-statements,
-readability-magic-numbers,
-readability-named-parameter,
-readability-function-cognitive-complexity,
-readability-use-anyofallof,
-readability-convert-member-functions-to-static,
-readability-else-after-return,
bugprone*,
-bugprone-easily-swappable-parameters,
-bugprone-empty-catch,
cppcoreguidelines*,
-cppcoreguidelines-avoid-const-or-ref-data-members,
-cppcoreguidelines-avoid-non-const-global-variables,
-cppcoreguidelines-init-variables,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-pro-type-vararg,
-cppcoreguidelines-pro-type-const-cast,
-cppcoreguidelines-pro-type-vararg,
-cppcoreguidelines-pro-type-member-init,
-cppcoreguidelines-avoid-const-or-ref-data-members,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
-cppcoreguidelines-avoid-c-arrays,
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
-cppcoreguidelines-non-private-member-variables-in-classes,
-cppcoreguidelines-avoid-non-const-global-variables,
-cppcoreguidelines-avoid-do-while
performance*,
-performance-avoid-endl,
readability*,
-readability-braces-around-statements,
-readability-identifier-length,
'
WarningsAsErrors: '*'
28 changes: 15 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Load dependencies versions
uses: cardinalby/export-env-action@v2
with:
envFile: '.github/workflows/deps/version.env'

- name: Install build dependencies
run: |
sudo apt-get update
Expand All @@ -35,23 +30,30 @@ jobs:
uses: actions/cache@v4
with:
path: .github/workflows/deps/install_dir
key: ${{ env.OPENCV_GIT_TAG }}-${{ env.YAML_GIT_TAG }}-${{ env.ARGPARSE_GIT_TAG }}-${{ env.SPDLOG_GIT_TAG }}
key: ${{ hashFiles('.github/workflows/deps/CMakeLists.txt') }}

- name: Build lib dependencis
if: ${{ steps.deps-cache.outputs.cache-hit != 'true' }}
run: |
cd .github/workflows/deps
cmake . -B build -GNinja \
-DOPENCV_GIT_TAG=${{ env.OPENCV_GIT_TAG }} \
-DYAML_GIT_TAG=${{ env.YAML_GIT_TAG }} \
-DARGPARSE_GIT_TAG=${{ env.ARGPARSE_GIT_TAG }} \
-DSPDLOG_GIT_TAG=${{ env.SPDLOG_GIT_TAG }}
cmake . -B build -GNinja
ninja -C build
cd -
- name: Setup build
run: |
meson setup build --buildtype ${{ inputs.buildtype }} --libdir=lib --prefer-static --pkg-config-path=$(find .github -name "pkgconfig")
meson setup build --libdir=lib --prefer-static --pkg-config-path=$(find .github -name "pkgconfig")
case "${{ inputs.buildtype }}" in
"release")
meson configure build --optimization=s --strip
;;
"debug")
meson configure build --buildtype=debug
;;
*)
echo "Build type ${{ inputs.buildtype }} not supported"
exit 1
;;
esac
- name: Compile
run: |
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/clang-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: "clang-format"

on:
workflow_dispatch:
workflow_call:

jobs:
clang-format:
name: clang-format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y python3-setuptools python3-wheel ninja-build g++ pkg-config libgtk-3-dev
python -m pip install meson
- name: Cache lib dependencies
uses: actions/cache@v4
with:
path: .github/workflows/deps/install_dir
key: ${{ hashFiles('.github/workflows/deps/CMakeLists.txt') }}

- name: Setup
run: |
meson setup build --prefer-static --pkg-config-path=$(find .github -name "pkgconfig")
- name: Check
run: |
ninja clang-format -C build
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
name: "C++ Lint"
name: "clang-tidy"

on:
workflow_dispatch:
workflow_call:

jobs:
lint:
name: C++ linting
clang-tidy:
name: clang-tidy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Load dependencies versions
uses: cardinalby/export-env-action@v2
with:
envFile: '.github/workflows/deps/version.env'

- name: Install dependencies
run: |
sudo apt-get update
Expand All @@ -26,13 +21,12 @@ jobs:
uses: actions/cache@v4
with:
path: .github/workflows/deps/install_dir
key: ${{ env.OPENCV_GIT_TAG }}-${{ env.YAML_GIT_TAG }}-${{ env.ARGPARSE_GIT_TAG }}
fail-on-cache-miss: true
key: ${{ hashFiles('.github/workflows/deps/CMakeLists.txt') }}

- name: Setup
run: |
meson setup build --prefer-static --pkg-config-path=$(find .github -name "pkgconfig")
- name: Lint
- name: Check
run: |
ninja clang-tidy -C build
4 changes: 2 additions & 2 deletions .github/workflows/depend-argparse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
- name: Modify file if new version
run: |
sed -E -i "s@(ARGPARSE_GIT_TAG=\s+\")(v[0-9]+\.[0-9]+\.[0-9]+)(\")@\1$VERSION\3@" .github/workflows/deps/version.env
sed -i 's/\(set(ARGPARSE_GIT_TAG "\)[^"]*\(".*\)/\1${{ env.VERSION }}\2/' .github/workflows/deps/CMakeLists.txt
- name: Create PR if new version
uses: peter-evans/create-pull-request@v6
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/depend-opencv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
- name: Modify file if new version
run: |
sed -E -i "s@(OPENCV_GIT_TAG=\s+\")([0-9]+\.[0-9]+\.[0-9]+)(\")@\1$VERSION\3@" .github/workflows/deps/version.env
sed -i 's/\(set(OPENCV_GIT_TAG "\)[^"]*\(".*\)/\1${{ env.VERSION }}\2/' .github/workflows/deps/CMakeLists.txt
- name: Create PR if new version
uses: peter-evans/create-pull-request@v6
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/depend-spdlog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
- name: Modify file if new version
run: |
sed -E -i "s@(SPDLOG_GIT_TAG=\s+\")(v[0-9]+\.[0-9]+\.[0-9]+)(\")@\1$VERSION\3@" .github/workflows/deps/version.env
sed -i 's/\(set(SPDLOG_GIT_TAG "\)[^"]*\(".*\)/\1${{ env.VERSION }}\2/' .github/workflows/deps/CMakeLists.txt
- name: Create PR if new version
uses: peter-evans/create-pull-request@v6
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/depend-yaml.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
- name: Modify file if new version
run: |
sed -E -i "s@(YAML_GIT_TAG=\s+\")([0-9]+\.[0-9]+\.[0-9]+)(\")@\1$VERSION\3@" .github/workflows/deps/version.env
sed -i 's/\(set(YAML_GIT_TAG "\)[^"]*\(".*\)/\1${{ env.VERSION }}\2/' .github/workflows/deps/CMakeLists.txt
- name: Create PR if new version
uses: peter-evans/create-pull-request@v6
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/deps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${PROJECT_SOURCE_DIR}/install_dir" CACHE PATH "Default install prefix" FORCE)
endif()

option(OPENCV_GIT_TAG "Tag or branch used to checkout when cloning opencv" "master")
option(YAML_GIT_TAG "Tag or branch used to checkout when cloning yaml-cpp" "master")
option(ARGPARSE_GIT_TAG "Tag or branch used to checkout when cloning argparse" "master")
option(SPDLOG_GIT_TAG "Tag or branch used to checkout when cloning argparse" "v1.x")
set(OPENCV_GIT_TAG "4.9.0" CACHE STRING "Tag or branch used to checkout when cloning opencv")
set(YAML_GIT_TAG "0.8.0" CACHE STRING "Tag or branch used to checkout when cloning yaml-cpp")
set(ARGPARSE_GIT_TAG "v3.1" CACHE STRING "Tag or branch used to checkout when cloning argparse")
set(SPDLOG_GIT_TAG "v1.14.1" CACHE STRING "Tag or branch used to checkout when cloning argparse")

include(ExternalProject)

Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/deps/version.env

This file was deleted.

20 changes: 14 additions & 6 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,22 @@ jobs:
with:
buildtype: debug

cpp-lint:
clang-tidy:
needs:
- build
uses: ./.github/workflows/cpp-lint.yml
uses: ./.github/workflows/clang-tidy.yml

clang-format:
needs:
- build
uses: ./.github/workflows/clang-format.yml

comment:
name: Bot comment
needs:
- build
- cpp-lint
- clang-tidy
- clang-format
runs-on: ubuntu-latest
if: always()
steps:
Expand All @@ -31,10 +37,12 @@ jobs:
## :clipboard: [Logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
## :mag: Linting results: ${{ (needs.cpp-lint.result == 'success' && ':white_check_mark:') || (needs.cpp-lint.result == 'skipped' && ':no_entry_sign:') || ':x:' }}
## :hammer_and_wrench: Building result: ${{ needs.build.result == 'success' && ':white_check_mark:' || ':x:' }}
## :mag: clang-tidy results: ${{ (needs.clang-tidy.result == 'success' && ':white_check_mark:') || (needs.clang-tidy.result == 'skipped' && ':no_entry_sign:') || ':x:' }}
## :writing_hand: clang-format results: ${{ (needs.clang-format.result == 'success' && ':white_check_mark:') || (needs.clang-format.result == 'skipped' && ':no_entry_sign:') || ':x:' }}
## :package: Artifacts:
If the building step was successfull:
1. Download the tarball in the artifacts section [here](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}).
Expand All @@ -43,4 +51,4 @@ jobs:
4. [Execute the install instructions](README.md#installation)
During the execution the tool raises an exception?\
Please send us the gdb backtrace: `sudo gdb --ex run --args linux-enable-ir-emitter <your command args>`, once the crash arrives, type "bt" to show the error trace ("q" to exit).
Please send us the gdb backtrace: `sudo gdb --ex run --args linux-enable-ir-emitter <your command args>`, once the crash arrives, type `bt` to show the error trace (`q` to exit).
30 changes: 30 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Contributing to linux-enable-ir-emitter
Thank you for considering contributing to our project! We appreciate your interest and effort in improving linux-enable-ir-emitter. Please follow the guidelines below to ensure a smooth contribution process.

## Reporting Issues
Before opening a new issue, please check the [docs](docs/README.md) first in order to either find answer to your question or to use the right template.

## Contributing Code
To be sure that the modifications you made to the code will pass the CI during the PR, please perform the following steps:
1. Compile locally the dependencies:
```
cd .github/workflows/deps && cmake -GNinja -B build && ninja -C build && cd -
```
2. Setup the build:
```
meson setup build --buildtype=debug --libdir=lib --prefer-static --pkg-config-path=$(find . -name "pkgconfig")`
```
3. Compile:
```
meson compile −C build
```
your new version of `linux-enable-ir-emitter` is located in `build/src/`
4. Format the files:
```
ninja clang-format -C build
```
5. Ensure clang-tidy pass:
```
ninja clang-tidy -C build
```
6. Commit, push and please describe enough what you did in your PR description
Loading

0 comments on commit 17077d7

Please sign in to comment.