Skip to content

Commit

Permalink
Mac workflows (#161)
Browse files Browse the repository at this point in the history
* * Adding macos-latest to matrix. Initial attempt at inclusion in build matrix

* * Trying with: apt/brew

* * Attempting to support Mac by splitting into two separate jobs with independent os matrices

* * Removing build generic and moving checkout to specifics

* * Added build type to Linux and Mac matrixes

* * Attempting to get 4 options for Linux compiling (clang/g++/20.04/22.04)

* * Cleaning up naming convention. Github workflows do appear to have a lot of busy workers. Only appear to get 1 per workflow and completion may take hours under these circumstances

* * Adding os-version to Linux jobs to see if that launches 4 different runners

* * Add os-version to mac workflows so they can be picked up by a runner

* * Fixing some clang warnings
* Attempting to fix linking issue on Mac for SSL

* * Updated workflow to separate the linking task on Mac

* * Fixing clang warnings for silly enforcement of standard for deconstructors in LQueue and LStack

* * Attempting to set SSL ROOT for mac builds since it appears to force you to know where openssl is stored on mac and I don't have a mac

* * Disabling SSL on Mac as it appears to find everything with find_package but then not link it appropriately

* * Fixing clang warning on unused bytes variable in karl.cpp

* * Fixed clang warning in test_knowledge_base
* Removed support for Mac 11 as the github runner is slow (10m+ on brew installation)

* * Updated version to 3.4.1

* * Attempting to query processors on mac during actions similar to nproc

* * Readding Mac 11 to build list for CI

* * Removing Mac 11 again as the parallelization helps Mac 12, but Mac 11 is having issues simply using brew
  • Loading branch information
jredmondson committed Jan 1, 2024
1 parent e57f4a4 commit 3997c81
Show file tree
Hide file tree
Showing 13 changed files with 188 additions and 85 deletions.
218 changes: 158 additions & 60 deletions .github/workflows/madara-tests.yaml
@@ -1,6 +1,6 @@
# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
name: CMake on Ubuntu
name: Madara CI

on:
push:
Expand All @@ -9,71 +9,169 @@ on:
types: [opened, reopened, review_requested]

jobs:
build:
runs-on: ${{ matrix.os }}
# build:
# runs-on: ${{ matrix.os }}

# strategy:
# # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
# fail-fast: false

# # Set up a matrix to run the following 3 configurations:
# # 1. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator>
# # 2. <Linux, Release, latest GCC compiler toolchain on the default runner image, default generator>
# # 3. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
# #
# # To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list.
# matrix:
# os: [ubuntu-latest, macos-latest] #, windows-latest]
# build_type: [Release]
# #c_compiler: [gcc, clang] #, cl]
# include:
# #- os: windows-latest
# # c_compiler: cl
# # cpp_compiler: cl
# #- os: ubuntu-latest
# # c_compiler: gcc
# # cpp_compiler: g++
# # - os: macos-latest
# # c_compiler: clang
# # cpp_compiler: clang++
# #- os: ubuntu-latest
# # c_compiler: clang
# # cpp_compiler: clang++
# #- os: windows-latest
# # c_compiler: gcc
# #- os: windows-latest
# # c_compiler: clang
# #- os: ubuntu-latest
# # c_compiler: cl

# steps:
# - uses: actions/checkout@v3

Linux:

runs-on: ubuntu-${{ matrix.os-version }}
strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
fail-fast: false

# Set up a matrix to run the following 3 configurations:
# 1. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator>
# 2. <Linux, Release, latest GCC compiler toolchain on the default runner image, default generator>
# 3. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
#
# To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list.
matrix:
os: [ubuntu-latest] #, windows-latest]
build_type: [Release]
c_compiler: [gcc] #, clang] #, cl]
#build_type: [Release]
include:
#- os: windows-latest
# c_compiler: cl
# cpp_compiler: cl
- os: ubuntu-latest
- job-name: 'Linux 20.04 g++'
os: ubuntu-22.04
os-version: '20.04'
c_compiler: gcc
cpp_compiler: g++
build_type: [Release]
- job-name: 'Linux 22.04 g++'
os-version: '22.04'
c_compiler: gcc
cpp_compiler: g++
#- os: ubuntu-latest
# c_compiler: clang
# cpp_compiler: clang++
# exclude:
#- os: windows-latest
# c_compiler: gcc
#- os: windows-latest
# c_compiler: clang
#- os: ubuntu-latest
# c_compiler: cl
build_type: [Release]
- job-name: 'Linux 20.04 clang'
os: ubuntu-20.04
os-version: '20.04'
c_compiler: clang
cpp_compiler: clang++
build_type: [Release]
- job-name: 'Linux 22.04 clang'
os: ubuntu-22.04
os-version: '22.04'
c_compiler: clang
cpp_compiler: clang++
build_type: [Release]


name: ${{ matrix.job-name }}
steps:
- uses: actions/checkout@v3
- name: Install Boost and SSL
run: sudo apt-get install -y libboost-all-dev git libssl-dev

- name: Set reusable strings
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-Dmadara_TESTS=ON
-Dmadara_SSL=ON
-S ${{ github.workspace }}
- name: Build
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} -j $(nproc)

- name: Test
working-directory: ${{ steps.strings.outputs.build-output-dir }}
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest --build-config ${{ matrix.build_type }} -j $(nproc)
- uses: actions/checkout@v3
- name: Install Boost and SSL
run: sudo apt-get install -y libboost-all-dev git libssl-dev

- name: Set reusable strings
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-Dmadara_TESTS=ON
-Dmadara_SSL=ON
-S ${{ github.workspace }}
- name: Build
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} -j $(nproc)

- name: Test
working-directory: ${{ steps.strings.outputs.build-output-dir }}
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest --build-config ${{ matrix.build_type }} --output-on-failure -j $(nproc)

macOS:

runs-on: macos-${{ matrix.os-version }}
strategy:
fail-fast: false
matrix:
include:
- job-name: 'Mac 12'
os: macos-12
os-version: '12'
c_compiler: clang
cpp_compiler: clang++
build_type: [Release]
# Disabling Mac 11 as the runner seems especially slow
# - job-name: 'Mac 11'
# os: macos-11
# os-version: '11'
# c_compiler: clang
# cpp_compiler: clang++
# build_type: [Release]


name: ${{ matrix.job-name }}
steps:
- uses: actions/checkout@v3
- name: Install Boost and OpenSSL
run: brew install boost autoconf automake libtool git openssl
- name: Force Link OpenSSL
run: brew link --force openssl

- name: Set reusable strings
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-Dmadara_TESTS=ON
-Dmadara_SSL=OFF
-S ${{ github.workspace }}
- name: Build
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} -j $(sysctl -n hw.ncpu)

- name: Test
working-directory: ${{ steps.strings.outputs.build-output-dir }}
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest --build-config ${{ matrix.build_type }} --output-on-failure -j $(sysctl -n hw.ncpu)
2 changes: 1 addition & 1 deletion VERSION.txt
@@ -1 +1 @@
3.4.0
3.4.1
2 changes: 1 addition & 1 deletion docs/Doxyfile_MADARA.dxy
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = MADARA
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 3.4.0
PROJECT_NUMBER = 3.4.1

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
2 changes: 1 addition & 1 deletion docs/Doxyfile_MADARA_NoGraphviz.dxy
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = MADARA
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 3.4.0
PROJECT_NUMBER = 3.4.1

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
4 changes: 2 additions & 2 deletions include/madara/transport/udp/UdpRegistryClient.cpp
Expand Up @@ -60,7 +60,7 @@ void UdpRegistryClient::send_register(void)
const char* print_prefix = "UdpRegistryClient::register";

long result(0);
uint64_t bytes_sent = 0;
//uint64_t bytes_sent = 0;

if (servers_.size() > 0)
{
Expand Down Expand Up @@ -94,7 +94,7 @@ void UdpRegistryClient::send_register(void)

if (actual_sent > 0)
{
bytes_sent += actual_sent;
//bytes_sent += actual_sent;

madara_logger_log(context_.get_logger(), logger::LOG_MAJOR,
"%s:"
Expand Down
2 changes: 1 addition & 1 deletion include/madara/utility/LQueue.cpp
Expand Up @@ -269,7 +269,7 @@ madara::utility::LQueue<T>& madara::utility::LQueue<T>::operator=(
// Perform actions needed when queue goes out of scope.

template<class T>
madara::utility::LQueue<T>::~LQueue(void)
madara::utility::LQueue<T>::~LQueue<T>(void)
{
// delete all elements of the list
delete_list();
Expand Down
2 changes: 1 addition & 1 deletion include/madara/utility/LStack.cpp
Expand Up @@ -298,7 +298,7 @@ madara::utility::LStack<T>& madara::utility::LStack<T>::operator=(
// Perform actions needed when queue goes out of scope.

template<class T>
madara::utility::LStack<T>::~LStack(void)
madara::utility::LStack<T>::~LStack<T>(void)
{
// delete all elements of the list
delete_list();
Expand Down
2 changes: 1 addition & 1 deletion include/madara/utility/Refcounter.cpp
Expand Up @@ -29,7 +29,7 @@ madara::utility::Refcounter<T>::Refcounter(const Refcounter& rhs)

/// Dtor will delete pointer if refcount becomes 0
template<typename T>
madara::utility::Refcounter<T>::~Refcounter(void)
madara::utility::Refcounter<T>::~Refcounter<T>(void)
{
decrement();
}
Expand Down
2 changes: 1 addition & 1 deletion include/madara/utility/ScopedArray.inl
Expand Up @@ -29,7 +29,7 @@ madara::utility::ScopedArray<T>::ScopedArray(const ScopedArray& rhs)

/// Dtor will delete pointer if refcount becomes 0
template<typename T>
madara::utility::ScopedArray<T>::~ScopedArray(void)
madara::utility::ScopedArray<T>::~ScopedArray<T>(void)
{
decrement();
}
Expand Down
4 changes: 2 additions & 2 deletions include/madara/utility/ThreadSafeVector.cpp
Expand Up @@ -25,14 +25,14 @@ madara::utility::ThreadSafeVector<T>::ThreadSafeVector(
}

template<typename T>
madara::utility::ThreadSafeVector<T>::~ThreadSafeVector(void)
madara::utility::ThreadSafeVector<T>::~ThreadSafeVector<T>(void)
{
clear();
}

template<typename T>
void madara::utility::ThreadSafeVector<T>::operator=(
const ThreadSafeVector& rhs)
const ThreadSafeVector<T>& rhs)
{
MADARA_GUARD_TYPE guard(mutex_);
MADARA_GUARD_TYPE rhs_guard(rhs.mutex_);
Expand Down
4 changes: 2 additions & 2 deletions include/madara/utility/Utility.inl
Expand Up @@ -581,7 +581,7 @@ inline std::vector<int64_t> get_file_missing_fragments(
std::ofstream output(filename, std::ios::out | std::ios::binary);

size_t num_fragments = expected_size / fragment_size;
size_t actual_size = 0;
//size_t actual_size = 0;

if (expected_size % fragment_size > 0)
{
Expand Down Expand Up @@ -610,7 +610,7 @@ inline std::vector<int64_t> get_file_missing_fragments(
size_t size = 0;
utility::read_file(frag_file, buffer, size);

actual_size += size;
//actual_size += size;

madara_logger_ptr_log(logger::global_logger.get(), logger::LOG_TRACE,
"utility::get_file_missing_fragments: checking fragment %d\n", i);
Expand Down
11 changes: 8 additions & 3 deletions tests/test_knowledge_base.cpp
Expand Up @@ -5,6 +5,8 @@
#include "madara/utility/Utility.h"
#include "test.h"

#include <sstream>

namespace logger = madara::logger;
namespace utility = madara::utility;

Expand Down Expand Up @@ -71,10 +73,13 @@ int main(int, char**)
// KnowledgeReferenceSettings (false));

knowledge.print("Testing KnowledgeRecord status method, return value is: ");

int record1Status = record1.status();
char str[16];
sprintf(str, "%d", record1Status);
knowledge.print(str);

std::stringstream buffer;
buffer << record1Status;

knowledge.print(buffer.str().c_str());
knowledge.print("\n");

// MADARA_debug_level = 10;
Expand Down
18 changes: 9 additions & 9 deletions tools/karl.cpp
Expand Up @@ -268,15 +268,15 @@ class StatsFilter : public madara::filters::AggregateFilter
}

// calculate bytes
size_t bytes = record.second.size();
if(record.second.is_integer_type())
{
bytes *= sizeof(int64_t);
}
else if(record.second.is_double_type())
{
bytes *= sizeof(double);
}
// size_t bytes = record.second.size();
// if(record.second.is_integer_type())
// {
// bytes *= sizeof(int64_t);
// }
// else if(record.second.is_double_type())
// {
// bytes *= sizeof(double);
// }

// update bytes sent by originator
var_orig_stats.bytes += record.second.size();
Expand Down

0 comments on commit 3997c81

Please sign in to comment.