Skip to content

Commit

Permalink
Improving CI pipeline with more steps (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
BAILOOL committed Feb 5, 2024
1 parent f2f7af1 commit fecb429
Show file tree
Hide file tree
Showing 4 changed files with 166 additions and 15 deletions.
169 changes: 156 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the action will run.
Expand All @@ -9,23 +7,168 @@ on:
branches: [ master ]
pull_request:
branches: [ master ]
types:
- opened
- reopened
- synchronize
- ready_for_review

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
clang-format-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2 # required to mount the Github Workspace to a volume

- name: Run clang-format-lint
uses: DoozyX/[email protected]
with:
source: '.'
exclude: './third_party ./external .git'
extensions: 'h,cpp'
clangFormatVersion: 11


cppcheck:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Run cppcheck
uses: addnab/docker-run-action@v3
with:
image: bailool/mc-calib-dev:latest
options: -v ${{ github.workspace }}:/home/MC-Calib
run: |
cppcheck MC-Calib/McCalib/include
cppcheck MC-Calib/McCalib/src
clang-tidy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

# Steps represent a sequence of tasks that will be executed as part of the job
- name: Run clang-tidy
uses: addnab/docker-run-action@v3
with:
image: bailool/mc-calib-dev:latest
options: -v ${{ github.workspace }}:/home/MC-Calib
run: |
mkdir MC-Calib/build && cd MC-Calib/build
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Debug ..
run-clang-tidy
unit-tests-with-sanitizers:
if: ${{ false }} # TODO: disable for now until understand how to suppress leaks from external libraries like OpenCV
runs-on: ubuntu-latest
needs:
- clang-format-lint
- cppcheck
- clang-tidy
steps:
- uses: actions/checkout@v2
- uses: DoozyX/[email protected]
with:
source: '.'
exclude: './third_party ./external .git'
extensions: 'h,cpp'
clangFormatVersion: 11
- name: Checkout
uses: actions/checkout@v2

- name: Checkout MC-Calib-data
uses: actions/checkout@v4
with:
repository: BAILOOL/MC-Calib-data
path: ${{ github.workspace }}/data
lfs: 'true'

- name: Unzip MC-Calib-data
run: tar xf ${{ github.workspace }}/data/Blender_Images.tar.gz -C ${{ github.workspace }}/data

- name: Run tests
uses: addnab/docker-run-action@v3
with:
image: bailool/mc-calib-dev:latest
options: -v ${{ github.workspace }}:/home/MC-Calib
run: |
mkdir MC-Calib/build && cd MC-Calib/build
cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_SANITIZERS=ON ..
make -j4
./tests/boost_tests_run
unit-tests-with-valgrind:
runs-on: ubuntu-latest
needs:
- clang-format-lint
- cppcheck
- clang-tidy
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Checkout MC-Calib-data
uses: actions/checkout@v4
with:
repository: BAILOOL/MC-Calib-data
path: ${{ github.workspace }}/data
lfs: 'true'

- name: Unzip MC-Calib-data
run: tar xf ${{ github.workspace }}/data/Blender_Images.tar.gz -C ${{ github.workspace }}/data

- name: Run tests
uses: addnab/docker-run-action@v3
with:
image: bailool/mc-calib-dev:latest
options: -v ${{ github.workspace }}:/home/MC-Calib
run: |
mkdir MC-Calib/build && cd MC-Calib/build
cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_SANITIZERS=OFF ..
make -j4
valgrind --leak-check=full \
--leak-check=full \
--track-origins=yes \
--show-reachable=yes \
--error-limit=no \
--gen-suppressions=all \
--verbose \
--log-file=valgrind-out.txt \
--suppressions=../tests/valgrind_suppress/opencv_valgrind.supp \
--suppressions=../tests/valgrind_suppress/opencv_valgrind_3rdparty.supp \
--suppressions=../tests/valgrind_suppress/boost_valgrind.supp \
./apps/calibrate/calibrate ../tests/configs_for_end2end_tests/calib_param_synth_Scenario1.yml
unit-tests-in-release-mode:
runs-on: ubuntu-latest
needs:
- clang-format-lint
- cppcheck
- clang-tidy
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Checkout MC-Calib-data
uses: actions/checkout@v4
with:
repository: BAILOOL/MC-Calib-data
path: ${{ github.workspace }}/data
lfs: 'true'

- name: Unzip MC-Calib-data
run: tar xf ${{ github.workspace }}/data/Blender_Images.tar.gz -C ${{ github.workspace }}/data

- name: Run tests
uses: addnab/docker-run-action@v3
with:
image: bailool/mc-calib-prod:latest
options: -v ${{ github.workspace }}:/home/MC-Calib
run: |
mkdir MC-Calib/build && cd MC-Calib/build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j4
./tests/boost_tests_run
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ add_compile_options(-Wall -Wextra -Wpedantic -Werror)

if(USE_SANITIZERS)
# sanitizers https://www.jetbrains.com/help/clion/google-sanitizers.html#Configuration
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address,leak")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address")
endif()

include_directories(
Expand Down
10 changes: 9 additions & 1 deletion McCalib/src/McCalib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,10 @@ void Calibration::detectBoardsWithCamera(const std::vector<cv::String> &fn,
std::size_t num_frames = fn.size();
if (num_frames > 0u) {
cv::Mat image = cv::imread(fn[0]);
if (image.empty()) {
LOG_ERROR << "Could not read the image :: " << fn[0];
assert((!image.empty()) && "Calibration cannot be done");
}
cams_[cam_idx]->im_cols_ = image.cols;
cams_[cam_idx]->im_rows_ = image.rows;
}
Expand Down Expand Up @@ -278,12 +282,16 @@ void Calibration::detectBoardsInImageWithCamera(const std::string frame_path,
const int cam_idx,
const int frame_idx) {
cv::Mat image = cv::imread(frame_path);
if (image.empty()) {
LOG_ERROR << "Could not read the image :: " << frame_path;
return;
}

// Greyscale image for subpixel refinement
cv::Mat graymat;
cv::cvtColor(image, graymat, cv::COLOR_BGR2GRAY);

// Datastructure to save the checkerboard corners

// key == board id, value == markersIDs on MARKERS markerIds
std::map<int, std::vector<int>> marker_idx;
// key == board id, value == 2d points visualized on MARKERS
Expand Down
Empty file added data/.gitkeep
Empty file.

0 comments on commit fecb429

Please sign in to comment.