From cde03486195a96700ee6d606ec0f69b61b5a0cb1 Mon Sep 17 00:00:00 2001 From: Geraldo Ribeiro Date: Sun, 6 Apr 2025 11:05:11 +0400 Subject: [PATCH 1/9] Build for macos arm64 --- docs/index.md | 19 +++++++++++++++++++ src/Makefile | 33 +++++++++++++++++++++++++++++++-- 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/docs/index.md b/docs/index.md index 47c2580..127142a 100644 --- a/docs/index.md +++ b/docs/index.md @@ -47,6 +47,8 @@ triggered, execute `microCI` in the respective project folders. ## Installation +### Linux + The installation is equally simple, just copy the executable to a folder in the `PATH`. To remove the `microCI` from the system delete the file copied to the PATH. @@ -56,6 +58,23 @@ sudo curl -fsSL https://github.com/geraldolsribeiro/microci/releases/latest/down sudo chmod 755 /usr/bin/microCI ``` +### MacOS + +**Warning::** The installation process is not validated yet. + +```bash +sudo curl -fsSL https://github.com/geraldolsribeiro/microci/releases/latest/download/microCI-macos-arm64.tar.gz \ + -o /usr/bin/microCI +sudo chmod 755 /usr/local/bin/microCI +``` + +## Windows + +Sorry :( + +I have no plan for a version running on MS Windows. +Be free to compile and try by yourself. + ## Docker Container You can use **any Docker container** for execution, both public ones from diff --git a/src/Makefile b/src/Makefile index 2462c05..c19f178 100644 --- a/src/Makefile +++ b/src/Makefile @@ -30,6 +30,17 @@ # Re: Removing unused functions/dead code # https://gcc.gnu.org/legacy-ml/gcc-help/2003-08/msg00128.html +# Detect system +UNAME_S := $(shell uname -s) +UNAME_P := $(shell uname -m) + +# Check if macOS (Darwin) and ARM (aarch64/arm64) +ifeq ($(UNAME_S),Darwin) + ifeq ($(UNAME_P),arm64) + IS_MAC_ARM = 1 + endif +endif + CXXFLAGS+= -DFMT_HEADER_ONLY CXXFLAGS+= -DSPDLOG_FMT_EXTERNAL=1 @@ -37,6 +48,8 @@ CXXFLAGS+= -I../include/ CXXFLAGS+= -Wall -Wextra +ifndef IS_MAC_ARM + # Link against static libraries. # Required for dead-code elimination. CXXFLAGS+= -static @@ -57,14 +70,24 @@ CXXFLAGS+= -Wl,--gc-sections # (I presume that you'd want to do this in a dead-code removal build.) CXXFLAGS+= -s +endif + # Optimize by size CXXFLAGS+= -Os # CXXFLAGS+= -flto # Link Time Optimizations CXXFLAGS+= -std=c++17 -LDFLAGS+= -lstdc++fs +# LDFLAGS+= -lstdc++fs LDFLAGS+= -lyaml-cpp LDFLAGS+= -lcrypto +LDFLAGS+= -lintl + +# Mac ARM-specific settings +ifdef IS_MAC_ARM + CXXFLAGS += -I/opt/homebrew/include # Homebrew ARM paths + LDFLAGS += -L/opt/homebrew/lib + # LIBS += -lmyarmlib +endif all: ../locales/pt_BR/microci.mo ../bin/microCI ../bin/microCI --input ../.microCI.yml --activity-diagram > ../docs/diagrams/microCI_activity_diagram.puml @@ -151,8 +174,14 @@ single_compilation_unit.cpp: \ ../bin/microCI: single_compilation_unit.cpp mkdir -p ../bin/ $(CXX) $(CXXFLAGS) $^ -o $@ $(LDFLAGS) - strip --strip-all $@ + echo strip --strip-all $@ clean: rm -f ../bin/microCI touch ../new/*.yml + +mac_deps: + brew install spdlog yaml-cpp inja + wget https://raw.githubusercontent.com/adishavit/argh/master/argh.h -O ../include/argh.h + wget https://raw.githubusercontent.com/Rookfighter/inifile-cpp/master/include/inicpp.h -O ../include/inicpp.h + From 3e6751c95c4a65e5f746a2b62ee20bec9996be81 Mon Sep 17 00:00:00 2001 From: Geraldo Ribeiro Date: Sun, 6 Apr 2025 11:54:36 +0400 Subject: [PATCH 2/9] Add headers argh.h and inicpp.h --- include/argh.h | 485 +++++++++++++++++++++++++++++ include/inicpp.h | 785 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1270 insertions(+) create mode 100644 include/argh.h create mode 100644 include/inicpp.h diff --git a/include/argh.h b/include/argh.h new file mode 100644 index 0000000..5c1d1cb --- /dev/null +++ b/include/argh.h @@ -0,0 +1,485 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace argh +{ + // Terminology: + // A command line is composed of 2 types of args: + // 1. Positional args, i.e. free standing values + // 2. Options: args beginning with '-'. We identify two kinds: + // 2.1: Flags: boolean options => (exist ? true : false) + // 2.2: Parameters: a name followed by a non-option value + +#if !defined(__GNUC__) || (__GNUC__ >= 5) + using string_stream = std::istringstream; +#else + // Until GCC 5, istringstream did not have a move constructor. + // stringstream_proxy is used instead, as a workaround. + class stringstream_proxy + { + public: + stringstream_proxy() = default; + + // Construct with a value. + stringstream_proxy(std::string const& value) : + stream_(value) + {} + + // Copy constructor. + stringstream_proxy(const stringstream_proxy& other) : + stream_(other.stream_.str()) + { + stream_.setstate(other.stream_.rdstate()); + } + + void setstate(std::ios_base::iostate state) { stream_.setstate(state); } + + // Stream out the value of the parameter. + // If the conversion was not possible, the stream will enter the fail state, + // and operator bool will return false. + template + stringstream_proxy& operator >> (T& thing) + { + stream_ >> thing; + return *this; + } + + + // Get the string value. + std::string str() const { return stream_.str(); } + + std::stringbuf* rdbuf() const { return stream_.rdbuf(); } + + // Check the state of the stream. + // False when the most recent stream operation failed + explicit operator bool() const { return !!stream_; } + + ~stringstream_proxy() = default; + private: + std::istringstream stream_; + }; + using string_stream = stringstream_proxy; +#endif + + class multimap_iteration_wrapper + { + public: + using container_t = std::multimap; + using iterator_t = container_t::const_iterator; + using difference_t = container_t::difference_type; + explicit multimap_iteration_wrapper(const iterator_t& lb, const iterator_t& ub) + : lb_(lb) + , ub_(ub) + {} + + iterator_t begin() const { return lb_; } + iterator_t end() const { return ub_; } + difference_t size() const { return std::distance(lb_, ub_); } + + private: + iterator_t lb_; + iterator_t ub_; + }; + + class parser + { + public: + enum Mode { PREFER_FLAG_FOR_UNREG_OPTION = 1 << 0, + PREFER_PARAM_FOR_UNREG_OPTION = 1 << 1, + NO_SPLIT_ON_EQUALSIGN = 1 << 2, + SINGLE_DASH_IS_MULTIFLAG = 1 << 3, + }; + + parser() = default; + + parser(std::initializer_list pre_reg_names) + { add_params(pre_reg_names); } + + parser(const char* const argv[], int mode = PREFER_FLAG_FOR_UNREG_OPTION) + { parse(argv, mode); } + + parser(int argc, const char* const argv[], int mode = PREFER_FLAG_FOR_UNREG_OPTION) + { parse(argc, argv, mode); } + + void add_param(std::string const& name); + void add_params(std::string const& name); + + void add_param(std::initializer_list init_list); + void add_params(std::initializer_list init_list); + + void parse(const char* const argv[], int mode = PREFER_FLAG_FOR_UNREG_OPTION); + void parse(int argc, const char* const argv[], int mode = PREFER_FLAG_FOR_UNREG_OPTION); + + std::multiset const& flags() const { return flags_; } + std::multimap const& params() const { return params_; } + multimap_iteration_wrapper params(std::string const& name) const; + std::vector const& pos_args() const { return pos_args_; } + + // begin() and end() for using range-for over positional args. + std::vector::const_iterator begin() const { return pos_args_.cbegin(); } + std::vector::const_iterator end() const { return pos_args_.cend(); } + size_t size() const { return pos_args_.size(); } + + ////////////////////////////////////////////////////////////////////////// + // Accessors + + // flag (boolean) accessors: return true if the flag appeared, otherwise false. + bool operator[](std::string const& name) const; + + // multiple flag (boolean) accessors: return true if at least one of the flag appeared, otherwise false. + bool operator[](std::initializer_list init_list) const; + + // returns positional arg string by order. Like argv[] but without the options + std::string const& operator[](size_t ind) const; + + // returns a std::istream that can be used to convert a positional arg to a typed value. + string_stream operator()(size_t ind) const; + + // same as above, but with a default value in case the arg is missing (index out of range). + template + string_stream operator()(size_t ind, T&& def_val) const; + + // parameter accessors, give a name get an std::istream that can be used to convert to a typed value. + // call .str() on result to get as string + string_stream operator()(std::string const& name) const; + + // accessor for a parameter with multiple names, give a list of names, get an std::istream that can be used to convert to a typed value. + // call .str() on result to get as string + // returns the first value in the list to be found. + string_stream operator()(std::initializer_list init_list) const; + + // same as above, but with a default value in case the param was missing. + // Non-string def_val types must have an operator<<() (output stream operator) + // If T only has an input stream operator, pass the string version of the type as in "3" instead of 3. + template + string_stream operator()(std::string const& name, T&& def_val) const; + + // same as above but for a list of names. returns the first value to be found. + template + string_stream operator()(std::initializer_list init_list, T&& def_val) const; + + private: + string_stream bad_stream() const; + std::string trim_leading_dashes(std::string const& name) const; + bool is_number(std::string const& arg) const; + bool is_option(std::string const& arg) const; + bool got_flag(std::string const& name) const; + bool is_param(std::string const& name) const; + + private: + std::vector args_; + std::multimap params_; + std::vector pos_args_; + std::multiset flags_; + std::set registeredParams_; + std::string empty_; + }; + + + ////////////////////////////////////////////////////////////////////////// + + inline void parser::parse(const char * const argv[], int mode) + { + int argc = 0; + for (auto argvp = argv; *argvp; ++argc, ++argvp); + parse(argc, argv, mode); + } + + ////////////////////////////////////////////////////////////////////////// + + inline void parser::parse(int argc, const char* const argv[], int mode /*= PREFER_FLAG_FOR_UNREG_OPTION*/) + { + // clear out possible previous parsing remnants + flags_.clear(); + params_.clear(); + pos_args_.clear(); + + // convert to strings + args_.resize(static_cast(argc)); + std::transform(argv, argv + argc, args_.begin(), [](const char* const arg) { return arg; }); + + // parse line + for (auto i = 0u; i < args_.size(); ++i) + { + if (!is_option(args_[i])) + { + pos_args_.emplace_back(args_[i]); + continue; + } + + auto name = trim_leading_dashes(args_[i]); + + if (!(mode & NO_SPLIT_ON_EQUALSIGN)) + { + auto equalPos = name.find('='); + if (equalPos != std::string::npos) + { + params_.insert({ name.substr(0, equalPos), name.substr(equalPos + 1) }); + continue; + } + } + + // if the option is unregistered and should be a multi-flag + if (1 == (args_[i].size() - name.size()) && // single dash + argh::parser::SINGLE_DASH_IS_MULTIFLAG & mode && // multi-flag mode + !is_param(name)) // unregistered + { + std::string keep_param; + + if (!name.empty() && is_param(std::string(1ul, name.back()))) // last char is param + { + keep_param += name.back(); + name.resize(name.size() - 1); + } + + for (auto const& c : name) + { + flags_.emplace(std::string{ c }); + } + + if (!keep_param.empty()) + { + name = keep_param; + } + else + { + continue; // do not consider other options for this arg + } + } + + // any potential option will get as its value the next arg, unless that arg is an option too + // in that case it will be determined a flag. + if (i == args_.size() - 1 || is_option(args_[i + 1])) + { + flags_.emplace(name); + continue; + } + + // if 'name' is a pre-registered option, then the next arg cannot be a free parameter to it is skipped + // otherwise we have 2 modes: + // PREFER_FLAG_FOR_UNREG_OPTION: a non-registered 'name' is determined a flag. + // The following value (the next arg) will be a free parameter. + // + // PREFER_PARAM_FOR_UNREG_OPTION: a non-registered 'name' is determined a parameter, the next arg + // will be the value of that option. + + assert(!(mode & argh::parser::PREFER_FLAG_FOR_UNREG_OPTION) + || !(mode & argh::parser::PREFER_PARAM_FOR_UNREG_OPTION)); + + bool preferParam = mode & argh::parser::PREFER_PARAM_FOR_UNREG_OPTION; + + if (is_param(name) || preferParam) + { + params_.insert({ name, args_[i + 1] }); + ++i; // skip next value, it is not a free parameter + continue; + } + else + { + flags_.emplace(name); + } + } + } + + ////////////////////////////////////////////////////////////////////////// + + inline string_stream parser::bad_stream() const + { + string_stream bad; + bad.setstate(std::ios_base::failbit); + return bad; + } + + ////////////////////////////////////////////////////////////////////////// + + inline bool parser::is_number(std::string const& arg) const + { + // inefficient but simple way to determine if a string is a number (which can start with a '-') + std::istringstream istr(arg); + double number; + istr >> number; + return !(istr.fail() || istr.bad()); + } + + ////////////////////////////////////////////////////////////////////////// + + inline bool parser::is_option(std::string const& arg) const + { + assert(0 != arg.size()); + if (is_number(arg)) + return false; + return '-' == arg[0]; + } + + ////////////////////////////////////////////////////////////////////////// + + inline std::string parser::trim_leading_dashes(std::string const& name) const + { + auto pos = name.find_first_not_of('-'); + return std::string::npos != pos ? name.substr(pos) : name; + } + + ////////////////////////////////////////////////////////////////////////// + + inline bool argh::parser::got_flag(std::string const& name) const + { + return flags_.end() != flags_.find(trim_leading_dashes(name)); + } + + ////////////////////////////////////////////////////////////////////////// + + inline bool argh::parser::is_param(std::string const& name) const + { + return registeredParams_.count(name); + } + + ////////////////////////////////////////////////////////////////////////// + + inline bool parser::operator[](std::string const& name) const + { + return got_flag(name); + } + + ////////////////////////////////////////////////////////////////////////// + + inline bool parser::operator[](std::initializer_list init_list) const + { + return std::any_of(init_list.begin(), init_list.end(), [&](char const* const name) { return got_flag(name); }); + } + + ////////////////////////////////////////////////////////////////////////// + + inline std::string const& parser::operator[](size_t ind) const + { + if (ind < pos_args_.size()) + return pos_args_[ind]; + return empty_; + } + + ////////////////////////////////////////////////////////////////////////// + + inline string_stream parser::operator()(std::string const& name) const + { + auto optIt = params_.find(trim_leading_dashes(name)); + if (params_.end() != optIt) + return string_stream(optIt->second); + return bad_stream(); + } + + ////////////////////////////////////////////////////////////////////////// + + inline string_stream parser::operator()(std::initializer_list init_list) const + { + for (auto& name : init_list) + { + auto optIt = params_.find(trim_leading_dashes(name)); + if (params_.end() != optIt) + return string_stream(optIt->second); + } + return bad_stream(); + } + + ////////////////////////////////////////////////////////////////////////// + + template + string_stream parser::operator()(std::string const& name, T&& def_val) const + { + auto optIt = params_.find(trim_leading_dashes(name)); + if (params_.end() != optIt) + return string_stream(optIt->second); + + std::ostringstream ostr; + ostr.precision(std::numeric_limits::max_digits10); + ostr << def_val; + return string_stream(ostr.str()); // use default + } + + ////////////////////////////////////////////////////////////////////////// + + // same as above but for a list of names. returns the first value to be found. + template + string_stream parser::operator()(std::initializer_list init_list, T&& def_val) const + { + for (auto& name : init_list) + { + auto optIt = params_.find(trim_leading_dashes(name)); + if (params_.end() != optIt) + return string_stream(optIt->second); + } + std::ostringstream ostr; + ostr.precision(std::numeric_limits::max_digits10); + ostr << def_val; + return string_stream(ostr.str()); // use default + } + + ////////////////////////////////////////////////////////////////////////// + + inline string_stream parser::operator()(size_t ind) const + { + if (pos_args_.size() <= ind) + return bad_stream(); + + return string_stream(pos_args_[ind]); + } + + ////////////////////////////////////////////////////////////////////////// + + template + string_stream parser::operator()(size_t ind, T&& def_val) const + { + if (pos_args_.size() <= ind) + { + std::ostringstream ostr; + ostr.precision(std::numeric_limits::max_digits10); + ostr << def_val; + return string_stream(ostr.str()); + } + + return string_stream(pos_args_[ind]); + } + + ////////////////////////////////////////////////////////////////////////// + + inline void parser::add_param(std::string const& name) + { + registeredParams_.insert(trim_leading_dashes(name)); + } + + ////////////////////////////////////////////////////////////////////////// + + inline void parser::add_param(std::initializer_list init_list) + { + parser::add_params(init_list); + } + + ////////////////////////////////////////////////////////////////////////// + + inline void parser::add_params(std::initializer_list init_list) + { + for (auto& name : init_list) + registeredParams_.insert(trim_leading_dashes(name)); + } + + ////////////////////////////////////////////////////////////////////////// + + inline void parser::add_params(const std::string &name) + { + parser::add_param(name); + } + + ////////////////////////////////////////////////////////////////////////// + + inline multimap_iteration_wrapper parser::params(std::string const& name) const + { + auto trimmed_name = trim_leading_dashes(name); + return multimap_iteration_wrapper(params_.lower_bound(trimmed_name), params_.upper_bound(trimmed_name)); + } +} diff --git a/include/inicpp.h b/include/inicpp.h new file mode 100644 index 0000000..99bb143 --- /dev/null +++ b/include/inicpp.h @@ -0,0 +1,785 @@ +/* + * inicpp.h + * + * Created on: 26 Dec 2015 + * Author: Fabian Meyer + * License: MIT + */ + +#ifndef INICPP_H_ +#define INICPP_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __cpp_lib_string_view // This one is defined in if we have std::string_view +# include +#endif + +namespace ini +{ + /************************************************ + * Helper Functions + ************************************************/ + + /** Returns a string of whitespace characters. */ + constexpr const char *whitespaces() + { + return " \t\n\r\f\v"; + } + + /** Returns a string of indentation characters. */ + constexpr const char *indents() + { + return " \t"; + } + + /** Trims a string in place. + * @param str string to be trimmed in place */ + inline void trim(std::string &str) + { + // first erasing from end should be slighty more efficient + // because erasing from start potentially moves all chars + // multiple indices towards the front. + + auto lastpos = str.find_last_not_of(whitespaces()); + if(lastpos == std::string::npos) + { + str.clear(); + return; + } + + str.erase(lastpos + 1); + str.erase(0, str.find_first_not_of(whitespaces())); + } + + /************************************************ + * Conversion Functors + ************************************************/ + + inline bool strToLong(const std::string &value, long &result) + { + char *endptr; + // check if decimal + result = std::strtol(value.c_str(), &endptr, 10); + if(*endptr == '\0') + return true; + // check if octal + result = std::strtol(value.c_str(), &endptr, 8); + if(*endptr == '\0') + return true; + // check if hex + result = std::strtol(value.c_str(), &endptr, 16); + if(*endptr == '\0') + return true; + + return false; + } + + inline bool strToULong(const std::string &value, unsigned long &result) + { + char *endptr; + // check if decimal + result = std::strtoul(value.c_str(), &endptr, 10); + if(*endptr == '\0') + return true; + // check if octal + result = std::strtoul(value.c_str(), &endptr, 8); + if(*endptr == '\0') + return true; + // check if hex + result = std::strtoul(value.c_str(), &endptr, 16); + if(*endptr == '\0') + return true; + + return false; + } + + template + struct Convert + {}; + + template<> + struct Convert + { + void decode(const std::string &value, bool &result) + { + std::string str(value); + std::transform(str.begin(), str.end(), str.begin(), [](const char c){ + return static_cast(::toupper(c)); + }); + + if(str == "TRUE") + result = true; + else if(str == "FALSE") + result = false; + else + throw std::invalid_argument("field is not a bool"); + } + + void encode(const bool value, std::string &result) + { + result = value ? "true" : "false"; + } + }; + + template<> + struct Convert + { + void decode(const std::string &value, char &result) + { + assert(value.size() > 0); + result = value[0]; + } + + void encode(const char value, std::string &result) + { + result = value; + } + }; + + template<> + struct Convert + { + void decode(const std::string &value, unsigned char &result) + { + assert(value.size() > 0); + result = value[0]; + } + + void encode(const unsigned char value, std::string &result) + { + result = value; + } + }; + + template<> + struct Convert + { + void decode(const std::string &value, short &result) + { + long tmp; + if(!strToLong(value, tmp)) + throw std::invalid_argument("field is not a short"); + result = static_cast(tmp); + } + + void encode(const short value, std::string &result) + { + std::stringstream ss; + ss << value; + result = ss.str(); + } + }; + + template<> + struct Convert + { + void decode(const std::string &value, unsigned short &result) + { + unsigned long tmp; + if(!strToULong(value, tmp)) + throw std::invalid_argument("field is not an unsigned short"); + result = static_cast(tmp); + } + + void encode(const unsigned short value, std::string &result) + { + std::stringstream ss; + ss << value; + result = ss.str(); + } + }; + + template<> + struct Convert + { + void decode(const std::string &value, int &result) + { + long tmp; + if(!strToLong(value, tmp)) + throw std::invalid_argument("field is not an int"); + result = static_cast(tmp); + } + + void encode(const int value, std::string &result) + { + std::stringstream ss; + ss << value; + result = ss.str(); + } + }; + + template<> + struct Convert + { + void decode(const std::string &value, unsigned int &result) + { + unsigned long tmp; + if(!strToULong(value, tmp)) + throw std::invalid_argument("field is not an unsigned int"); + result = static_cast(tmp); + } + + void encode(const unsigned int value, std::string &result) + { + std::stringstream ss; + ss << value; + result = ss.str(); + } + }; + + template<> + struct Convert + { + void decode(const std::string &value, long &result) + { + if(!strToLong(value, result)) + throw std::invalid_argument("field is not a long"); + } + + void encode(const long value, std::string &result) + { + std::stringstream ss; + ss << value; + result = ss.str(); + } + }; + + template<> + struct Convert + { + void decode(const std::string &value, unsigned long &result) + { + if(!strToULong(value, result)) + throw std::invalid_argument("field is not an unsigned long"); + } + + void encode(const unsigned long value, std::string &result) + { + std::stringstream ss; + ss << value; + result = ss.str(); + } + }; + + template<> + struct Convert + { + void decode(const std::string &value, double &result) + { + result = std::stod(value); + } + + void encode(const double value, std::string &result) + { + std::stringstream ss; + ss << value; + result = ss.str(); + } + }; + + template<> + struct Convert + { + void decode(const std::string &value, float &result) + { + result = std::stof(value); + } + + void encode(const float value, std::string &result) + { + std::stringstream ss; + ss << value; + result = ss.str(); + } + }; + + template<> + struct Convert + { + void decode(const std::string &value, std::string &result) + { + result = value; + } + + void encode(const std::string &value, std::string &result) + { + result = value; + } + }; + +#ifdef __cpp_lib_string_view + template<> + struct Convert + { + void decode(const std::string &value, std::string_view &result) + { + result = value; + } + + void encode(const std::string_view value, std::string &result) + { + result = value; + } + }; +#endif + + template<> + struct Convert + { + void encode(const char* const &value, std::string &result) + { + result = value; + } + + void decode(const std::string &value, const char* &result) + { + result = value.c_str(); + } + }; + + template<> + struct Convert + { + void encode(const char* const &value, std::string &result) + { + result = value; + } + }; + + template + struct Convert + { + void encode(const char *value, std::string &result) + { + result = value; + } + }; + + class IniField + { + private: + std::string value_; + + public: + IniField() : value_() + {} + + IniField(const std::string &value) : value_(value) + {} + IniField(const IniField &field) : value_(field.value_) + {} + + ~IniField() + {} + + template + T as() const + { + Convert conv; + T result; + conv.decode(value_, result); + return result; + } + + template + IniField &operator=(const T &value) + { + Convert conv; + conv.encode(value, value_); + return *this; + } + + IniField &operator=(const IniField &field) + { + value_ = field.value_; + return *this; + } + }; + + struct StringInsensitiveLess + { + bool operator()(std::string lhs, std::string rhs) const + { + std::transform(lhs.begin(), lhs.end(), lhs.begin(), [](const char c){ + return static_cast(::tolower(c)); + }); + std::transform(rhs.begin(), rhs.end(), rhs.begin(), [](const char c){ + return static_cast(::tolower(c)); + }); + return lhs < rhs; + } + }; + + template + class IniSectionBase : public std::map + { + public: + IniSectionBase() + {} + ~IniSectionBase() + {} + }; + + using IniSection = IniSectionBase>; + using IniSectionCaseInsensitive = IniSectionBase; + + template + class IniFileBase : public std::map, Comparator> + { + private: + char fieldSep_ = '='; + char esc_ = '\\'; + std::vector commentPrefixes_ = { "#" , ";" }; + bool multiLineValues_ = false; + bool overwriteDuplicateFields_ = true; + + void eraseComment(const std::string &commentPrefix, + std::string &str, + std::string::size_type startpos = 0) + { + size_t prefixpos = str.find(commentPrefix, startpos); + if(std::string::npos == prefixpos) + return; + // Found a comment prefix, is it escaped? + if(0 != prefixpos && str[prefixpos - 1] == esc_) + { + // The comment prefix is escaped, so just delete the escape char + // and keep erasing after the comment prefix + str.erase(prefixpos - 1, 1); + eraseComment( + commentPrefix, str, prefixpos - 1 + commentPrefix.size()); + } + else + { + str.erase(prefixpos); + } + } + + void eraseComments(std::string &str) + { + for(const std::string &commentPrefix : commentPrefixes_) + eraseComment(commentPrefix, str); + } + + /** Tries to find a suitable comment prefix for the string data at the given + * position. Returns commentPrefixes_.end() if not match was found. */ + std::vector::const_iterator findCommentPrefix(const std::string &str, + const std::size_t startpos) const + { + // if startpos is invalid simply return "not found" + if(startpos >= str.size()) + return commentPrefixes_.end(); + + for(size_t i = 0; i < commentPrefixes_.size(); ++i) + { + const std::string &prefix = commentPrefixes_[i]; + // if this comment prefix is longer than the string view itself + // then skip + if(prefix.size() + startpos > str.size()) + continue; + + bool match = true; + for(size_t j = 0; j < prefix.size() && match; ++j) + match = str[startpos + j] == prefix[j]; + + if(match) + return commentPrefixes_.begin() + i; + } + + return commentPrefixes_.end(); + } + + void writeEscaped(std::ostream &os, const std::string &str) const + { + for(size_t i = 0; i < str.length(); ++i) + { + auto prefixpos = findCommentPrefix(str, i); + // if no suitable prefix was found at this position + // then simply write the current character + if(prefixpos != commentPrefixes_.end()) + { + const std::string &prefix = *prefixpos; + os.put(esc_); + os.write(prefix.c_str(), prefix.size()); + i += prefix.size() - 1; + } + else if (multiLineValues_ && str[i] == '\n') + os.write("\n\t", 2); + else + os.put(str[i]); + } + } + + public: + IniFileBase() = default; + + IniFileBase(const char fieldSep, const char comment) + : fieldSep_(fieldSep), commentPrefixes_(1, std::string(1, comment)) + {} + + IniFileBase(const std::string &filename) + { + load(filename); + } + + IniFileBase(std::istream &is) + { + decode(is); + } + + IniFileBase(const char fieldSep, + const std::vector &commentPrefixes) + : fieldSep_(fieldSep), commentPrefixes_(commentPrefixes) + {} + + IniFileBase(const std::string &filename, + const char fieldSep, + const std::vector &commentPrefixes) + : fieldSep_(fieldSep), commentPrefixes_(commentPrefixes) + { + load(filename); + } + + IniFileBase(std::istream &is, + const char fieldSep, + const std::vector &commentPrefixes) + : fieldSep_(fieldSep), commentPrefixes_(commentPrefixes) + { + decode(is); + } + + ~IniFileBase() + {} + + /** Sets the separator charactor for fields in the INI file. + * @param sep separator character to be used. */ + void setFieldSep(const char sep) + { + fieldSep_ = sep; + } + + /** Sets the character that should be interpreted as the start of comments. + * Default is '#'. + * Note: If the inifile contains the comment character as data it must be prefixed with + * the configured escape character. + * @param comment comment character to be used. */ + void setCommentChar(const char comment) + { + commentPrefixes_ = {std::string(1, comment)}; + } + + /** Sets the list of strings that should be interpreted as the start of comments. + * Default is [ "#" ]. + * Note: If the inifile contains any comment string as data it must be prefixed with + * the configured escape character. + * @param commentPrefixes vector of comment prefix strings to be used. */ + void setCommentPrefixes(const std::vector &commentPrefixes) + { + commentPrefixes_ = commentPrefixes; + } + + /** Sets the character that should be used to escape comment prefixes. + * Default is '\'. + * @param esc escape character to be used. */ + void setEscapeChar(const char esc) + { + esc_ = esc; + } + + /** Sets whether or not to parse multi-line field values. + * Default is false. + * @param enable enable or disable? */ + void setMultiLineValues(bool enable) + { + multiLineValues_ = enable; + } + + /** Sets whether or not overwriting duplicate fields is allowed. + * If overwriting duplicate fields is not allowed, + * an exception is thrown when a duplicate field is found inside a section. + * Default is true. + * @param allowed Is overwriting duplicate fields allowed or not? */ + void allowOverwriteDuplicateFields(bool allowed) + { + overwriteDuplicateFields_ = allowed; + } + + /** Tries to decode a ini file from the given input stream. + * @param is input stream from which data should be read. */ + void decode(std::istream &is) + { + this->clear(); + int lineNo = 0; + IniSectionBase *currentSection = nullptr; + std::string mutliLineValueFieldName = ""; + std::string line; + // iterate file line by line + while(!is.eof() && !is.fail()) + { + std::getline(is, line, '\n'); + eraseComments(line); + bool hasIndent = line.find_first_not_of(indents()) != 0; + trim(line); + ++lineNo; + + // skip if line is empty + if(line.size() == 0) + continue; + + if(line[0] == '[') + { + // line is a section + // check if the section is also closed on same line + std::size_t pos = line.find("]"); + if(pos == std::string::npos) + { + std::stringstream ss; + ss << "l." << lineNo + << ": ini parsing failed, section not closed"; + throw std::logic_error(ss.str()); + } + // check if the section name is empty + if(pos == 1) + { + std::stringstream ss; + ss << "l." << lineNo + << ": ini parsing failed, section is empty"; + throw std::logic_error(ss.str()); + } + + // retrieve section name + std::string secName = line.substr(1, pos - 1); + currentSection = &((*this)[secName]); + + // clear multiline value field name + // a new section means there is no value to continue + mutliLineValueFieldName = ""; + } + else + { + // line is a field definition + // check if section was already opened + if(currentSection == nullptr) + { + std::stringstream ss; + ss << "l." << lineNo + << ": ini parsing failed, field has no section" + " or ini file in use by another application"; + throw std::logic_error(ss.str()); + } + + // find key value separator + std::size_t pos = line.find(fieldSep_); + if (multiLineValues_ && hasIndent && mutliLineValueFieldName != "") + { + // extend a multi-line value + IniField previous_value = (*currentSection)[mutliLineValueFieldName]; + std::string value = previous_value.as() + "\n" + line; + (*currentSection)[mutliLineValueFieldName] = value; + } + else if(pos == std::string::npos) + { + std::stringstream ss; + ss << "l." << lineNo + << ": ini parsing failed, no '" + << fieldSep_ + << "' found"; + if (multiLineValues_) + ss << ", and not a multi-line value continuation"; + throw std::logic_error(ss.str()); + } + else + { + // retrieve field name and value + std::string name = line.substr(0, pos); + trim(name); + if (!overwriteDuplicateFields_ && currentSection->count(name) != 0) + { + std::stringstream ss; + ss << "l." << lineNo + << ": ini parsing failed, duplicate field found"; + throw std::logic_error(ss.str()); + } + std::string value = line.substr(pos + 1, std::string::npos); + trim(value); + (*currentSection)[name] = value; + // store last field name for potential multi-line values + mutliLineValueFieldName = name; + } + } + } + } + + /** Tries to decode a ini file from the given input string. + * @param content string to be decoded. */ + void decode(const std::string &content) + { + std::istringstream ss(content); + decode(ss); + } + + /** Tries to load and decode a ini file from the file at the given path. + * @param fileName path to the file that should be loaded. */ + void load(const std::string &fileName) + { + std::ifstream is(fileName.c_str()); + decode(is); + } + + /** Encodes this inifile object and writes the output to the given stream. + * @param os target stream. */ + void encode(std::ostream &os) const + { + // iterate through all sections in this file + for(const auto &filePair : *this) + { + os.put('['); + writeEscaped(os, filePair.first); + os.put(']'); + os.put('\n'); + + // iterate through all fields in the section + for(const auto &secPair : filePair.second) + { + writeEscaped(os, secPair.first); + os.put(fieldSep_); + writeEscaped(os, secPair.second.template as()); + os.put('\n'); + } + } + } + + /** Encodes this inifile object as string and returns the result. + * @return encoded infile string. */ + std::string encode() const + { + std::ostringstream ss; + encode(ss); + return ss.str(); + } + + /** Saves this inifile object to the file at the given path. + * @param fileName path to the file where the data should be stored. */ + void save(const std::string &fileName) const + { + std::ofstream os(fileName.c_str()); + encode(os); + } + }; + + using IniFile = IniFileBase>; + using IniSection = IniSectionBase>; + using IniFileCaseInsensitive = IniFileBase; + using IniSectionCaseInsensitive = IniSectionBase; +} + +#endif From 1a81471eb7e7188039d0857bb335e8eb04058228 Mon Sep 17 00:00:00 2001 From: Geraldo Ribeiro Date: Tue, 22 Jul 2025 22:35:03 +0400 Subject: [PATCH 3/9] Create macos installer --- macos/create_package.sh | 131 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100755 macos/create_package.sh diff --git a/macos/create_package.sh b/macos/create_package.sh new file mode 100755 index 0000000..59c933c --- /dev/null +++ b/macos/create_package.sh @@ -0,0 +1,131 @@ +#!/bin/bash + +# Configuration +APP_NAME="MicroCI" +VERSION="0.39.0" +IDENTIFIER="dev.microci.macos" +INSTALL_DIR="/usr/local/bin" + +rm -rf package +rm -f ${APP_NAME}-${VERSION}.pkg + +make -C ../src/ + +mkdir -p package${INSTALL_DIR} +cp ../bin/microCI package${INSTALL_DIR} + +# Create component package +pkgbuild \ + --root package \ + --identifier ${IDENTIFIER} \ + --version ${VERSION} \ + --install-location / \ + ${APP_NAME}-${VERSION}-component.pkg + +# Create distribution file +cat < Distribution.xml + + + ${APP_NAME} ${VERSION} + dev.microci + + + + + + + + + + + + + + + + + + + ${APP_NAME}-${VERSION}-component.pkg + +EOF + +# Create welcome/license/conclusion files +cat < welcome.html + + + + Welcome + + +

Welcome to ${APP_NAME} ${VERSION}

+

This package will install ${APP_NAME} on your system.

+ + +EOF + +cat < license.html + + + + License + + +

MIT License

+ +

Copyright (c) 2022-2025 Geraldo Luis da Silva Ribeiro

+ +

+Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +

+ +

+The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +

+ +

+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +

+ + +EOF + +cat < conclusion.html + + + + Installation Complete + + +

Installation Complete

+

${APP_NAME} has been successfully installed.

+

You can now run it from the terminal with: microCI

+ + +EOF + +# Create the product package +productbuild \ + --distribution Distribution.xml \ + --resources . \ + --package-path ${APP_NAME}-${VERSION}-component.pkg \ + ${APP_NAME}-${VERSION}.pkg + +# Clean up +rm -f ${APP_NAME}-${VERSION}-component.pkg +rm -f Distribution.xml +rm -f welcome.html license.html conclusion.html + +echo "Package created: ${APP_NAME}-${VERSION}.pkg" From 12abf654eeacfdac57ed5920e9df8e5ee0b82773 Mon Sep 17 00:00:00 2001 From: Geraldo Ribeiro Date: Fri, 5 Sep 2025 10:56:38 +0400 Subject: [PATCH 4/9] Use random number generator for macos --- docs/00_install.md | 12 +++++++ docs/00_update.md | 13 +++++-- docs/plugin_bash.md | 2 +- include/new/bash.hpp | 8 ++--- include/sh/MicroCI.hpp | 50 ++++++++++++++++++++------ new/bash.yml | 2 +- sh/MicroCI.sh | 18 ++++++++-- src/BeamerPluginStepParser.cpp | 2 +- src/Makefile | 11 ++++-- src/MicroCI.cpp | 8 +++++ src/MkdocsMaterialPluginStepParser.cpp | 2 +- src/PandocPluginStepParser.cpp | 2 +- src/PluginStepParser.cpp | 2 +- 13 files changed, 103 insertions(+), 29 deletions(-) create mode 100644 docs/00_install.md diff --git a/docs/00_install.md b/docs/00_install.md new file mode 100644 index 0000000..63bfb9a --- /dev/null +++ b/docs/00_install.md @@ -0,0 +1,12 @@ +# Installation + +## Linux + +To install the latest stable version run: + +```bash +sudo curl -fsSL https://github.com/geraldolsribeiro/microci/releases/latest/download/microCI \ + -o /usr/bin/microCI +sudo chmod 755 /usr/bin/microCI +``` + diff --git a/docs/00_update.md b/docs/00_update.md index b545fb6..00b93b0 100644 --- a/docs/00_update.md +++ b/docs/00_update.md @@ -1,7 +1,14 @@ -# Usage +# How to update -Use the following command to download and install the latest version of **microCI**. +Use the following command to download and install the latest stable version of **microCI**. ``` microCI --update | bash -``` \ No newline at end of file +``` + +If you want to update to the latest development version, use this command. + +``` +microCI --update-dev | bash +``` + diff --git a/docs/plugin_bash.md b/docs/plugin_bash.md index fb08201..2ed81fa 100644 --- a/docs/plugin_bash.md +++ b/docs/plugin_bash.md @@ -25,7 +25,7 @@ steps: # Comments are allowed between commands apt update apt upgrade -y - # These packages are installed in the image + # Install dependencies inside docker image apt install -y xxd libspdlog-dev libyaml-cpp-dev make -C src clean all make -C test diff --git a/include/new/bash.hpp b/include/new/bash.hpp index 0b64336..1654b42 100644 --- a/include/new/bash.hpp +++ b/include/new/bash.hpp @@ -122,9 +122,9 @@ unsigned char ___new_bash_yml[] = { 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x61, 0x70, 0x74, 0x20, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x20, 0x2d, 0x79, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x23, 0x20, 0x54, 0x68, 0x65, 0x73, 0x65, 0x20, 0x70, 0x61, - 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x20, 0x61, 0x72, 0x65, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x65, - 0x64, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x69, 0x6d, 0x61, 0x67, 0x65, + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x23, 0x20, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x20, + 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x69, 0x65, 0x73, 0x20, 0x69, 0x6e, 0x73, 0x69, 0x64, 0x65, + 0x20, 0x64, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x20, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x61, 0x70, 0x74, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x20, 0x2d, 0x79, 0x20, 0x78, 0x78, 0x64, 0x20, 0x6c, 0x69, 0x62, 0x73, 0x70, 0x64, 0x6c, 0x6f, 0x67, 0x2d, @@ -163,4 +163,4 @@ unsigned char ___new_bash_yml[] = { 0x6c, 0x61, 0x6e, 0x67, 0x3d, 0x70, 0x74, 0x2c, 0x65, 0x6e, 0x0a}; -unsigned int ___new_bash_yml_len = 1522; +unsigned int ___new_bash_yml_len = 1521; diff --git a/include/sh/MicroCI.hpp b/include/sh/MicroCI.hpp index 2638f46..14db472 100644 --- a/include/sh/MicroCI.hpp +++ b/include/sh/MicroCI.hpp @@ -108,6 +108,10 @@ unsigned char ___sh_MicroCI_sh[] = { 0x0a, + 0x0a, 0x4f, 0x53, 0x3d, 0x24, 0x28, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x2d, 0x73, 0x29, + + 0x0a, + 0x0a, 0x23, 0x20, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, @@ -311,6 +315,10 @@ unsigned char ___sh_MicroCI_sh[] = { 0x68, 0x65, 0x20, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x7b, 0x7b, 0x43, 0x4c, 0x45, 0x41, 0x52, 0x7d, 0x7d, 0x22, 0x3b, + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x63, 0x68, 0x6f, 0x20, 0x22, 0x7b, 0x7b, 0x52, 0x45, 0x44, + 0x7d, 0x7d, 0x54, 0x72, 0x79, 0x3a, 0x20, 0x7b, 0x7b, 0x47, 0x52, 0x45, 0x45, 0x4e, 0x7d, 0x7d, 0x73, 0x75, 0x64, + 0x6f, 0x20, 0x61, 0x70, 0x74, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x20, 0x79, 0x71, 0x22, 0x3b, + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x63, 0x68, 0x6f, 0x20, 0x22, 0x7b, 0x7b, 0x52, 0x45, 0x44, 0x7d, 0x7d, 0x54, 0x72, 0x79, 0x3a, 0x20, 0x7b, 0x7b, 0x47, 0x52, 0x45, 0x45, 0x4e, 0x7d, 0x7d, 0x73, 0x75, 0x64, 0x6f, 0x20, 0x73, 0x6e, 0x61, 0x70, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x20, 0x79, 0x71, 0x22, 0x3b, @@ -355,17 +363,39 @@ unsigned char ___sh_MicroCI_sh[] = { 0x0a, - 0x0a, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x20, 0x7c, 0x20, 0x67, 0x72, 0x65, 0x70, 0x20, 0x2d, 0x71, 0x20, 0x64, - 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x20, 0x7c, 0x7c, 0x20, 0x7b, + 0x0a, 0x63, 0x61, 0x73, 0x65, 0x20, 0x22, 0x24, 0x4f, 0x53, 0x22, 0x20, 0x69, 0x6e, - 0x0a, 0x20, 0x20, 0x65, 0x63, 0x68, 0x6f, 0x20, 0x2d, 0x65, 0x20, 0x22, 0x7b, 0x7b, 0x52, 0x45, 0x44, 0x7d, 0x7d, - 0x50, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x20, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, - 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, - 0x61, 0x64, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x79, 0x6f, 0x75, 0x72, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x74, 0x6f, - 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x20, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x7b, 0x7b, - 0x43, 0x4c, 0x45, 0x41, 0x52, 0x7d, 0x7d, 0x22, + 0x0a, 0x20, 0x20, 0x22, 0x4c, 0x69, 0x6e, 0x75, 0x78, 0x22, 0x29, + + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x20, 0x7c, 0x20, 0x67, 0x72, 0x65, 0x70, 0x20, + 0x2d, 0x71, 0x20, 0x64, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x20, 0x7c, 0x7c, 0x20, 0x7b, + + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x63, 0x68, 0x6f, 0x20, 0x2d, 0x65, 0x20, 0x22, 0x7b, 0x7b, 0x52, + 0x45, 0x44, 0x7d, 0x7d, 0x50, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x20, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x20, 0x74, + 0x68, 0x65, 0x20, 0x64, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x64, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x79, 0x6f, 0x75, 0x72, 0x20, 0x75, 0x73, 0x65, + 0x72, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x20, 0x67, 0x72, 0x6f, + 0x75, 0x70, 0x7b, 0x7b, 0x43, 0x4c, 0x45, 0x41, 0x52, 0x7d, 0x7d, 0x22, + + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x78, 0x69, 0x74, 0x20, 0x31, 0x3b, 0x20, 0x7d, + + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x3b, 0x3b, + + 0x0a, 0x20, 0x20, 0x22, 0x44, 0x61, 0x72, 0x77, 0x69, 0x6e, 0x22, 0x29, + + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x3b, 0x3b, + + 0x0a, 0x20, 0x20, 0x2a, 0x29, + + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x63, 0x68, 0x6f, 0x20, 0x22, 0x52, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x20, + 0x6f, 0x6e, 0x20, 0x61, 0x6e, 0x20, 0x75, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x20, 0x6f, 0x70, 0x65, 0x72, 0x61, + 0x74, 0x69, 0x6e, 0x67, 0x20, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x3a, 0x20, 0x24, 0x4f, 0x53, 0x22, + + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x78, 0x69, 0x74, 0x20, 0x31, + + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x3b, 0x3b, - 0x0a, 0x20, 0x20, 0x65, 0x78, 0x69, 0x74, 0x20, 0x31, 0x3b, 0x20, 0x7d, + 0x0a, 0x65, 0x73, 0x61, 0x63, 0x0a, @@ -914,4 +944,4 @@ unsigned char ___sh_MicroCI_sh[] = { 0x0a, 0x0a}; -unsigned int ___sh_MicroCI_sh_len = 9397; +unsigned int ___sh_MicroCI_sh_len = 9615; diff --git a/new/bash.yml b/new/bash.yml index 18552da..363f2f6 100644 --- a/new/bash.yml +++ b/new/bash.yml @@ -23,7 +23,7 @@ steps: # Comments are allowed between commands apt update apt upgrade -y - # These packages are installed in the image + # Install dependencies inside docker image apt install -y xxd libspdlog-dev libyaml-cpp-dev make -C src clean all make -C test diff --git a/sh/MicroCI.sh b/sh/MicroCI.sh index c6eeffe..57cfc7d 100755 --- a/sh/MicroCI.sh +++ b/sh/MicroCI.sh @@ -20,6 +20,8 @@ MICROCI_PWD=$(pwd -P | tr -d '\n') export MICROCI_PWD +OS=$(uname -s) + # ---------------------------------------------------------------------- # Project banner # ---------------------------------------------------------------------- @@ -76,9 +78,19 @@ command -v docker &> /dev/null \ echo "https://docs.docker.com/engine/install/ubuntu/"; exit 1; } -groups | grep -q docker || { - echo -e "{{RED}}Please finish the docker installation adding your user to the docker group{{CLEAR}}" - exit 1; } +case "$OS" in + "Linux") + groups | grep -q docker || { + echo -e "{{RED}}Please finish the docker installation adding your user to the docker group{{CLEAR}}" + exit 1; } + ;; + "Darwin") + ;; + *) + echo "Running on an unknown operating system: $OS" + exit 1 + ;; +esac if [ ! -d ~/.ssh ]; then echo -e "{{RED}}Please setup the SSH before use microCI{{CLEAR}}" diff --git a/src/BeamerPluginStepParser.cpp b/src/BeamerPluginStepParser.cpp index 3f89f68..21d0dea 100644 --- a/src/BeamerPluginStepParser.cpp +++ b/src/BeamerPluginStepParser.cpp @@ -120,7 +120,7 @@ void BeamerPluginStepParser::Parse(const YAML::Node &step) { --attach stdout \ --attach stderr \ --rm \ - --name microci_{{ FUNCTION_NAME }}_$(head -c 8 /proc/sys/kernel/random/uuid) \ + --name microci_{{ FUNCTION_NAME }}_{{ RANDOM_8 }} \ --workdir {{ WORKSPACE }} \ --volume "${MICROCI_PWD}":{{ WORKSPACE }} \ --user $(id -u):$(id -g) \ diff --git a/src/Makefile b/src/Makefile index c19f178..a92093a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -84,9 +84,9 @@ LDFLAGS+= -lintl # Mac ARM-specific settings ifdef IS_MAC_ARM - CXXFLAGS += -I/opt/homebrew/include # Homebrew ARM paths - LDFLAGS += -L/opt/homebrew/lib - # LIBS += -lmyarmlib +CXXFLAGS += -I/opt/homebrew/include +LDFLAGS += -L/opt/homebrew/lib +# LIBS += -lmyarmlib endif all: ../locales/pt_BR/microci.mo ../bin/microCI @@ -185,3 +185,8 @@ mac_deps: wget https://raw.githubusercontent.com/adishavit/argh/master/argh.h -O ../include/argh.h wget https://raw.githubusercontent.com/Rookfighter/inifile-cpp/master/include/inicpp.h -O ../include/inicpp.h +.PHONY: install_usr_local_bin +install_usr_local_bin: ../bin/microCI + sudo cp $< /usr/local/bin/ + sudo chmod 755 /usr/local/bin/microCI + diff --git a/src/MicroCI.cpp b/src/MicroCI.cpp index 27c09f5..0faef66 100644 --- a/src/MicroCI.cpp +++ b/src/MicroCI.cpp @@ -496,6 +496,14 @@ auto MicroCI::DefaultDataTemplate() const -> json { data["APPEND_LOG_TEE_FLAG"] = mAppendLog ? " -a" : ""; +#ifdef __APPLE__ + data["RANDOM_8"] = "$(uuidgen | head -c 8)"; +#endif + +#ifdef __linux__ + data["RANDOM_8"] = "$(head -c 8 /proc/sys/kernel/random/uuid)"; +#endif + return data; } diff --git a/src/MkdocsMaterialPluginStepParser.cpp b/src/MkdocsMaterialPluginStepParser.cpp index 3155392..7e866c5 100644 --- a/src/MkdocsMaterialPluginStepParser.cpp +++ b/src/MkdocsMaterialPluginStepParser.cpp @@ -81,7 +81,7 @@ void MkdocsMaterialPluginStepParser::Parse(const YAML::Node &step) { --attach stdout \ --attach stderr \ --rm \ - --name microci_{{ FUNCTION_NAME }}_$(head -c 8 /proc/sys/kernel/random/uuid) \ + --name microci_{{ FUNCTION_NAME }}_{{ RANDOM_8 }} \ --workdir {{ WORKSPACE }} \ --volume "${MICROCI_PWD}":{{ WORKSPACE }} \ --network {{ DOCKER_NETWORK }} \ diff --git a/src/PandocPluginStepParser.cpp b/src/PandocPluginStepParser.cpp index 9480a27..0b1f33f 100644 --- a/src/PandocPluginStepParser.cpp +++ b/src/PandocPluginStepParser.cpp @@ -84,7 +84,7 @@ void PandocPluginStepParser::Parse(const YAML::Node &step) { --attach stdout \ --attach stderr \ --rm \ - --name microci_{{ FUNCTION_NAME }}_$(head -c 8 /proc/sys/kernel/random/uuid) \ + --name microci_{{ FUNCTION_NAME }}_{{ RANDOM_8 }} \ --workdir {{ WORKSPACE }}/{{BASE_PATH}} \ --volume "${MICROCI_PWD}":{{ WORKSPACE }} \ --network {{ DOCKER_NETWORK }} \ diff --git a/src/PluginStepParser.cpp b/src/PluginStepParser.cpp index 64afe2a..a80fab5 100644 --- a/src/PluginStepParser.cpp +++ b/src/PluginStepParser.cpp @@ -270,7 +270,7 @@ void PluginStepParser::prepareRunDocker(const json &data, const set Date: Fri, 5 Sep 2025 16:17:40 +0400 Subject: [PATCH 5/9] Add uninstall option --- .gitignore | 7 +++++-- docs/00_uninstall.md | 8 ++++++++ src/main.cpp | 8 ++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 docs/00_uninstall.md diff --git a/.gitignore b/.gitignore index 8e430de..7a74e86 100644 --- a/.gitignore +++ b/.gitignore @@ -3,8 +3,8 @@ bin/microCI .ccls-cache dockerfiles/pikchr/pikchr docs/diagrams/*.png -include/argh.h -include/inicpp.h +# include/argh.h +# include/inicpp.h include/inja.hpp include/nlohmann/json.hpp include/sha1.h @@ -18,3 +18,6 @@ test/.env test/.env.yml test/failure_test/a.c .vim-bookmarks +macos/package/usr/local/bin +macos/MicroCI-*.pkg +.DS_Store diff --git a/docs/00_uninstall.md b/docs/00_uninstall.md new file mode 100644 index 0000000..d97acdf --- /dev/null +++ b/docs/00_uninstall.md @@ -0,0 +1,8 @@ +# How to uninstall + +Use the following command to remove **microCI** from your system. + +``` +microCI --uninstall | bash +``` + diff --git a/src/main.cpp b/src/main.cpp index ad4eb69..6fccd98 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -116,6 +116,7 @@ auto help() -> string { -U,--update-db Update observability database -u,--update Update microCI to stable stream -D,--update-dev Update microCI to development stream + -x,--uninstall Uninstall -i,--input file.yml Load the configuration from file.yml -n,--config gitlab_ci Create a .gitlab-ci.yml example config -n,--new skip Create a placeholder step @@ -443,6 +444,13 @@ sudo curl -fsSL \ -o /usr/bin/microCI sudo chmod 755 /usr/bin/microCI microCI --version +)"; + return 0; + } + if (cmdl[{"-x", "--uninstall"}]) { + cout << R"( +echo "🔥 Removing microCI..." +sudo rm -f /usr/bin/microCI )"; return 0; } From c8b3b7f9c8127ed15b96feb09030213be938d606 Mon Sep 17 00:00:00 2001 From: Geraldo Ribeiro Date: Sat, 6 Sep 2025 12:05:32 +0400 Subject: [PATCH 6/9] Add brew dependency tips --- .clang-format | 2 +- include/new/docker_build.hpp | 47 +++++++++++++------------- include/sh/MicroCI.hpp | 29 +++++++++++++++- sh/MicroCI.sh | 6 ++++ src/BashPluginStepParser.cpp | 3 +- src/BeamerPluginStepParser.cpp | 3 +- src/ClangFormatPluginStepParser.cpp | 3 +- src/ClangTidyPluginStepParser.cpp | 3 +- src/CppCheckPluginStepParser.cpp | 3 +- src/DockerBuildPluginStepParser.cpp | 3 +- src/DocmdPluginStepParser.cpp | 3 +- src/DoxygenPluginStepParser.cpp | 3 +- src/FetchPluginStepParser.cpp | 3 +- src/FlawfinderPluginStepParser.cpp | 3 +- src/GitDeployPluginStepParser.cpp | 3 +- src/GitPublishPluginStepParser.cpp | 3 +- src/MicroCI.cpp | 12 +++---- src/MinioPluginStepParser.cpp | 3 +- src/MkdocsMaterialPluginStepParser.cpp | 3 +- src/PandocPluginStepParser.cpp | 4 +-- src/PikchrPluginStepParser.cpp | 3 +- src/PlantumlPluginStepParser.cpp | 3 +- src/PluginStepParser.cpp | 5 +-- src/SkipPluginStepParser.cpp | 3 +- src/TemplatePluginStepParser.cpp | 3 +- src/VHDLFormatPluginStepParser.cpp | 3 +- src/main.cpp | 5 +-- 27 files changed, 110 insertions(+), 57 deletions(-) diff --git a/.clang-format b/.clang-format index 64d45c0..57bb044 100644 --- a/.clang-format +++ b/.clang-format @@ -3,5 +3,5 @@ BasedOnStyle: Google TabWidth: '2' UseTab: Never ColumnLimit: 120 - +AlignConsecutiveAssignments: true ... diff --git a/include/new/docker_build.hpp b/include/new/docker_build.hpp index 86d3340..ab2d1bc 100644 --- a/include/new/docker_build.hpp +++ b/include/new/docker_build.hpp @@ -29,8 +29,8 @@ // DON'T EDIT THIS FILE, INSTEAD UPDATE ../new/docker_build.yml unsigned char ___new_docker_build_yml[] = { - 0x23, 0x20, 0x20, 0x20, 0x23, 0x20, 0x64, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, - 0x20, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x23, 0x20, 0x20, 0x20, 0x23, 0x20, 0x64, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x20, + 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x0a, 0x23, 0x20, 0x20, 0x20, @@ -38,34 +38,33 @@ unsigned char ___new_docker_build_yml[] = { 0x0a, 0x73, 0x74, 0x65, 0x70, 0x73, 0x3a, - 0x0a, 0x20, 0x20, 0x2d, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3a, 0x20, 0x22, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, - 0x75, 0x69, 0x72, 0x20, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x6d, 0x20, 0x64, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x22, + 0x0a, 0x20, 0x20, 0x2d, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3a, 0x20, 0x22, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x20, 0x64, + 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x20, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x22, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, - 0x22, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0xc3, 0xa7, 0xc3, 0xa3, 0x6f, 0x20, 0x64, 0x65, 0x73, 0x74, 0x65, - 0x20, 0x70, 0x61, 0x73, 0x73, 0x6f, 0x22, + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, 0x22, + 0x42, 0x75, 0x69, 0x6c, 0x64, 0x73, 0x20, 0x61, 0x20, 0x64, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x20, 0x69, 0x6d, 0x61, + 0x67, 0x65, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x3a, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3a, 0x20, 0x64, 0x6f, 0x63, 0x6b, 0x65, - 0x72, 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3a, 0x20, 0x64, 0x6f, 0x63, 0x6b, 0x65, 0x72, + 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x3a, 0x20, 0x70, 0x61, 0x73, - 0x74, 0x61, 0x5f, 0x71, 0x75, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6d, 0x5f, 0x6f, 0x5f, 0x64, 0x6f, - 0x63, 0x6b, 0x65, 0x72, 0x66, 0x69, 0x6c, 0x65, + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x3a, 0x20, 0x66, 0x6f, 0x6c, 0x64, + 0x65, 0x72, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x64, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x66, 0x69, 0x6c, 0x65, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x64, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x66, 0x69, 0x6c, 0x65, 0x3a, - 0x20, 0x61, 0x6c, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2e, 0x44, 0x6f, 0x63, 0x6b, 0x65, - 0x72, 0x66, 0x69, 0x6c, 0x65, + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x64, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x66, 0x69, 0x6c, 0x65, 0x3a, 0x20, + 0x61, 0x6c, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2e, 0x44, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x66, + 0x69, 0x6c, 0x65, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x3a, 0x20, 0x69, 0x6e, 0x74, - 0x6d, 0x61, 0x69, 0x6e, 0x2f, 0x6d, 0x69, 0x6e, 0x68, 0x61, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x6d, + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x3a, 0x20, 0x69, 0x6e, 0x74, 0x6d, + 0x61, 0x69, 0x6e, 0x2f, 0x6d, 0x79, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3a, 0x20, 0x30, 0x2e, - 0x31, 0x2e, 0x30, + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3a, 0x20, 0x30, 0x2e, 0x31, + 0x2e, 0x30, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x73, 0x5f, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x20, - 0x74, 0x72, 0x75, 0x65, + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x73, 0x5f, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x20, 0x74, + 0x72, 0x75, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x75, 0x73, 0x68, 0x3a, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, @@ -73,10 +72,10 @@ unsigned char ___new_docker_build_yml[] = { 0x0a, - 0x0a, 0x23, 0x20, 0x76, 0x69, 0x6d, 0x3a, 0x20, 0x73, 0x70, 0x65, 0x6c, 0x6c, 0x20, 0x73, 0x70, 0x65, 0x6c, - 0x6c, 0x6c, 0x61, 0x6e, 0x67, 0x3d, 0x70, 0x74, 0x2c, 0x65, 0x6e, + 0x0a, 0x23, 0x20, 0x76, 0x69, 0x6d, 0x3a, 0x20, 0x73, 0x70, 0x65, 0x6c, 0x6c, 0x20, 0x73, 0x70, 0x65, 0x6c, 0x6c, + 0x6c, 0x61, 0x6e, 0x67, 0x3d, 0x65, 0x6e, 0x0a, 0x0a}; -unsigned int ___new_docker_build_yml_len = 376; +unsigned int ___new_docker_build_yml_len = 355; diff --git a/include/sh/MicroCI.hpp b/include/sh/MicroCI.hpp index 14db472..9dee59c 100644 --- a/include/sh/MicroCI.hpp +++ b/include/sh/MicroCI.hpp @@ -302,6 +302,10 @@ unsigned char ___sh_MicroCI_sh[] = { 0x7d, 0x7d, 0x54, 0x72, 0x79, 0x3a, 0x20, 0x7b, 0x7b, 0x47, 0x52, 0x45, 0x45, 0x4e, 0x7d, 0x7d, 0x73, 0x75, 0x64, 0x6f, 0x20, 0x61, 0x70, 0x74, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x20, 0x6a, 0x71, 0x22, 0x3b, + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x63, 0x68, 0x6f, 0x20, 0x22, 0x7b, 0x7b, 0x52, 0x45, 0x44, + 0x7d, 0x7d, 0x54, 0x72, 0x79, 0x3a, 0x20, 0x7b, 0x7b, 0x47, 0x52, 0x45, 0x45, 0x4e, 0x7d, 0x7d, 0x62, 0x72, 0x65, + 0x77, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x20, 0x6a, 0x71, 0x22, 0x3b, + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x78, 0x69, 0x74, 0x20, 0x31, 0x3b, 0x20, 0x7d, 0x0a, @@ -323,6 +327,10 @@ unsigned char ___sh_MicroCI_sh[] = { 0x7d, 0x7d, 0x54, 0x72, 0x79, 0x3a, 0x20, 0x7b, 0x7b, 0x47, 0x52, 0x45, 0x45, 0x4e, 0x7d, 0x7d, 0x73, 0x75, 0x64, 0x6f, 0x20, 0x73, 0x6e, 0x61, 0x70, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x20, 0x79, 0x71, 0x22, 0x3b, + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x63, 0x68, 0x6f, 0x20, 0x22, 0x7b, 0x7b, 0x52, 0x45, 0x44, + 0x7d, 0x7d, 0x54, 0x72, 0x79, 0x3a, 0x20, 0x7b, 0x7b, 0x47, 0x52, 0x45, 0x45, 0x4e, 0x7d, 0x7d, 0x62, 0x72, 0x65, + 0x77, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x20, 0x79, 0x71, 0x22, 0x3b, + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x78, 0x69, 0x74, 0x20, 0x31, 0x3b, 0x20, 0x7d, 0x0a, @@ -336,6 +344,15 @@ unsigned char ___sh_MicroCI_sh[] = { 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x7b, 0x7b, 0x43, 0x4c, 0x45, 0x41, 0x52, 0x7d, 0x7d, 0x22, 0x3b, + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x63, 0x68, 0x6f, 0x20, 0x22, 0x7b, 0x7b, 0x52, 0x45, 0x44, + 0x7d, 0x7d, 0x54, 0x72, 0x79, 0x3a, 0x20, 0x7b, 0x7b, 0x47, 0x52, 0x45, 0x45, 0x4e, 0x7d, 0x7d, 0x73, 0x75, 0x64, + 0x6f, 0x20, 0x61, 0x70, 0x74, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x20, 0x63, 0x75, 0x72, 0x6c, 0x22, + 0x3b, + + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x63, 0x68, 0x6f, 0x20, 0x22, 0x7b, 0x7b, 0x52, 0x45, 0x44, + 0x7d, 0x7d, 0x54, 0x72, 0x79, 0x3a, 0x20, 0x7b, 0x7b, 0x47, 0x52, 0x45, 0x45, 0x4e, 0x7d, 0x7d, 0x62, 0x72, 0x65, + 0x77, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x20, 0x63, 0x75, 0x72, 0x6c, 0x22, 0x3b, + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x78, 0x69, 0x74, 0x20, 0x31, 0x3b, 0x20, 0x7d, 0x0a, @@ -359,6 +376,16 @@ unsigned char ___sh_MicroCI_sh[] = { 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x2f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x2f, 0x75, 0x62, 0x75, 0x6e, 0x74, 0x75, 0x2f, 0x22, 0x3b, + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x63, 0x68, 0x6f, 0x20, 0x22, 0x53, 0x65, 0x65, 0x20, 0x70, 0x61, + 0x67, 0x65, 0x20, 0x27, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x20, 0x44, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x20, + 0x44, 0x65, 0x73, 0x6b, 0x74, 0x6f, 0x70, 0x20, 0x6f, 0x6e, 0x20, 0x4d, 0x61, 0x63, 0x27, 0x20, 0x61, 0x74, 0x22, + 0x3b, + + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x63, 0x68, 0x6f, 0x20, 0x22, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, + 0x2f, 0x2f, 0x64, 0x6f, 0x63, 0x73, 0x2e, 0x64, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x64, + 0x65, 0x73, 0x6b, 0x74, 0x6f, 0x70, 0x2f, 0x73, 0x65, 0x74, 0x75, 0x70, 0x2f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, + 0x6c, 0x2f, 0x6d, 0x61, 0x63, 0x2d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x2f, 0x22, 0x3b, + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x78, 0x69, 0x74, 0x20, 0x31, 0x3b, 0x20, 0x7d, 0x0a, @@ -944,4 +971,4 @@ unsigned char ___sh_MicroCI_sh[] = { 0x0a, 0x0a}; -unsigned int ___sh_MicroCI_sh_len = 9615; +unsigned int ___sh_MicroCI_sh_len = 9962; diff --git a/sh/MicroCI.sh b/sh/MicroCI.sh index 57cfc7d..d334255 100755 --- a/sh/MicroCI.sh +++ b/sh/MicroCI.sh @@ -60,22 +60,28 @@ PS4='Line $LINENO: ' command -v jq &> /dev/null \ || { echo -e "{{RED}}The utility jq was not found in the system{{CLEAR}}"; echo "{{RED}}Try: {{GREEN}}sudo apt install jq"; + echo "{{RED}}Try: {{GREEN}}brew install jq"; exit 1; } command -v yq &> /dev/null \ || { echo -e "{{RED}}The utility yq was not found in the system{{CLEAR}}"; echo "{{RED}}Try: {{GREEN}}sudo apt install yq"; echo "{{RED}}Try: {{GREEN}}sudo snap install yq"; + echo "{{RED}}Try: {{GREEN}}brew install yq"; exit 1; } command -v curl &> /dev/null \ || { echo -e "{{RED}}The utility curl was not found in the system{{CLEAR}}"; + echo "{{RED}}Try: {{GREEN}}sudo apt install curl"; + echo "{{RED}}Try: {{GREEN}}brew install curl"; exit 1; } command -v docker &> /dev/null \ || { echo -e "{{RED}}The utility docker was not found in the system{{CLEAR}}"; echo "See page 'Install Docker Engine on Ubuntu' at"; echo "https://docs.docker.com/engine/install/ubuntu/"; + echo "See page 'Install Docker Desktop on Mac' at"; + echo "https://docs.docker.com/desktop/setup/install/mac-install/"; exit 1; } case "$OS" in diff --git a/src/BashPluginStepParser.cpp b/src/BashPluginStepParser.cpp index 28d6d0d..37df1c9 100644 --- a/src/BashPluginStepParser.cpp +++ b/src/BashPluginStepParser.cpp @@ -27,9 +27,10 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. +#include "BashPluginStepParser.hpp" + #include -#include #include namespace microci { diff --git a/src/BeamerPluginStepParser.cpp b/src/BeamerPluginStepParser.cpp index 21d0dea..14af7b2 100644 --- a/src/BeamerPluginStepParser.cpp +++ b/src/BeamerPluginStepParser.cpp @@ -27,9 +27,10 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. +#include "BeamerPluginStepParser.hpp" + #include -#include #include namespace microci { diff --git a/src/ClangFormatPluginStepParser.cpp b/src/ClangFormatPluginStepParser.cpp index bfa8a92..055c3ae 100644 --- a/src/ClangFormatPluginStepParser.cpp +++ b/src/ClangFormatPluginStepParser.cpp @@ -27,9 +27,10 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. +#include "ClangFormatPluginStepParser.hpp" + #include -#include #include namespace microci { diff --git a/src/ClangTidyPluginStepParser.cpp b/src/ClangTidyPluginStepParser.cpp index 75b5336..4a1b384 100644 --- a/src/ClangTidyPluginStepParser.cpp +++ b/src/ClangTidyPluginStepParser.cpp @@ -27,9 +27,10 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. +#include "ClangTidyPluginStepParser.hpp" + #include -#include #include namespace microci { diff --git a/src/CppCheckPluginStepParser.cpp b/src/CppCheckPluginStepParser.cpp index 24252d8..f3870ae 100644 --- a/src/CppCheckPluginStepParser.cpp +++ b/src/CppCheckPluginStepParser.cpp @@ -27,9 +27,10 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. +#include "CppCheckPluginStepParser.hpp" + #include -#include #include namespace microci { diff --git a/src/DockerBuildPluginStepParser.cpp b/src/DockerBuildPluginStepParser.cpp index 44085f2..60b251b 100644 --- a/src/DockerBuildPluginStepParser.cpp +++ b/src/DockerBuildPluginStepParser.cpp @@ -27,9 +27,10 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. +#include "DockerBuildPluginStepParser.hpp" + #include -#include #include namespace microci { diff --git a/src/DocmdPluginStepParser.cpp b/src/DocmdPluginStepParser.cpp index b7c817c..910afe9 100644 --- a/src/DocmdPluginStepParser.cpp +++ b/src/DocmdPluginStepParser.cpp @@ -27,9 +27,10 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. +#include "DocmdPluginStepParser.hpp" + #include -#include #include namespace microci { diff --git a/src/DoxygenPluginStepParser.cpp b/src/DoxygenPluginStepParser.cpp index e949c99..105651f 100644 --- a/src/DoxygenPluginStepParser.cpp +++ b/src/DoxygenPluginStepParser.cpp @@ -27,9 +27,10 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. +#include "DoxygenPluginStepParser.hpp" + #include -#include #include namespace microci { diff --git a/src/FetchPluginStepParser.cpp b/src/FetchPluginStepParser.cpp index 0322ce1..9a4d26e 100644 --- a/src/FetchPluginStepParser.cpp +++ b/src/FetchPluginStepParser.cpp @@ -27,9 +27,10 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. +#include "FetchPluginStepParser.hpp" + #include -#include #include namespace microci { diff --git a/src/FlawfinderPluginStepParser.cpp b/src/FlawfinderPluginStepParser.cpp index 3a1de32..01ecfda 100644 --- a/src/FlawfinderPluginStepParser.cpp +++ b/src/FlawfinderPluginStepParser.cpp @@ -27,9 +27,10 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. +#include "FlawfinderPluginStepParser.hpp" + #include -#include #include namespace microci { diff --git a/src/GitDeployPluginStepParser.cpp b/src/GitDeployPluginStepParser.cpp index 78c0593..2ce6037 100644 --- a/src/GitDeployPluginStepParser.cpp +++ b/src/GitDeployPluginStepParser.cpp @@ -27,9 +27,10 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. +#include "GitDeployPluginStepParser.hpp" + #include -#include #include namespace microci { diff --git a/src/GitPublishPluginStepParser.cpp b/src/GitPublishPluginStepParser.cpp index 88cfe17..57592d7 100644 --- a/src/GitPublishPluginStepParser.cpp +++ b/src/GitPublishPluginStepParser.cpp @@ -27,9 +27,10 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. +#include "GitPublishPluginStepParser.hpp" + #include -#include #include namespace microci { diff --git a/src/MicroCI.cpp b/src/MicroCI.cpp index 0faef66..831cedd 100644 --- a/src/MicroCI.cpp +++ b/src/MicroCI.cpp @@ -37,14 +37,14 @@ using namespace std; #include -#include -#include -#include -#include +#include "MicroCI.hpp" +#include "inja.hpp" +#include "sh/MicroCI.hpp" +#include "sh/NotifyDiscord.hpp" // Resolve forward definition -#include -#include +#include "PluginStepParser.hpp" +#include "SkipPluginStepParser.hpp" namespace microci { diff --git a/src/MinioPluginStepParser.cpp b/src/MinioPluginStepParser.cpp index 16fe579..bd2e937 100644 --- a/src/MinioPluginStepParser.cpp +++ b/src/MinioPluginStepParser.cpp @@ -27,9 +27,10 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. +#include "MinioPluginStepParser.hpp" + #include -#include #include namespace microci { diff --git a/src/MkdocsMaterialPluginStepParser.cpp b/src/MkdocsMaterialPluginStepParser.cpp index 7e866c5..634a151 100644 --- a/src/MkdocsMaterialPluginStepParser.cpp +++ b/src/MkdocsMaterialPluginStepParser.cpp @@ -27,9 +27,10 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. +#include "MkdocsMaterialPluginStepParser.hpp" + #include -#include #include namespace microci { diff --git a/src/PandocPluginStepParser.cpp b/src/PandocPluginStepParser.cpp index 0b1f33f..be312ac 100644 --- a/src/PandocPluginStepParser.cpp +++ b/src/PandocPluginStepParser.cpp @@ -27,9 +27,9 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. -#include +#include "PandocPluginStepParser.hpp" -#include +#include namespace microci { using namespace std; diff --git a/src/PikchrPluginStepParser.cpp b/src/PikchrPluginStepParser.cpp index 9af6434..eabdb28 100644 --- a/src/PikchrPluginStepParser.cpp +++ b/src/PikchrPluginStepParser.cpp @@ -27,9 +27,10 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. +#include "PikchrPluginStepParser.hpp" + #include -#include #include namespace microci { diff --git a/src/PlantumlPluginStepParser.cpp b/src/PlantumlPluginStepParser.cpp index eacd858..ae18ca7 100644 --- a/src/PlantumlPluginStepParser.cpp +++ b/src/PlantumlPluginStepParser.cpp @@ -27,9 +27,10 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. +#include "PlantumlPluginStepParser.hpp" + #include -#include #include namespace microci { diff --git a/src/PluginStepParser.cpp b/src/PluginStepParser.cpp index a80fab5..2000455 100644 --- a/src/PluginStepParser.cpp +++ b/src/PluginStepParser.cpp @@ -27,10 +27,11 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. +#include "PluginStepParser.hpp" + #include -#include -#include +#include "MicroCI.hpp" namespace microci { diff --git a/src/SkipPluginStepParser.cpp b/src/SkipPluginStepParser.cpp index b13cbc2..b90e1f7 100644 --- a/src/SkipPluginStepParser.cpp +++ b/src/SkipPluginStepParser.cpp @@ -27,9 +27,10 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. +#include "SkipPluginStepParser.hpp" + #include -#include #include namespace microci { diff --git a/src/TemplatePluginStepParser.cpp b/src/TemplatePluginStepParser.cpp index 3a5ea68..4e9c78a 100644 --- a/src/TemplatePluginStepParser.cpp +++ b/src/TemplatePluginStepParser.cpp @@ -27,9 +27,10 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. +#include "TemplatePluginStepParser.hpp" + #include -#include #include namespace microci { diff --git a/src/VHDLFormatPluginStepParser.cpp b/src/VHDLFormatPluginStepParser.cpp index 39cf844..5abe751 100644 --- a/src/VHDLFormatPluginStepParser.cpp +++ b/src/VHDLFormatPluginStepParser.cpp @@ -27,9 +27,10 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. +#include "VHDLFormatPluginStepParser.hpp" + #include -#include #include namespace microci { diff --git a/src/main.cpp b/src/main.cpp index 6fccd98..cd4b57b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -39,11 +39,12 @@ using namespace std; -#include -#include #include #include +#include "argh.h" +#include "inicpp.h" + #define _(String) gettext(String) // Plugins From a8c1fd3b44d9d48f338640d48377987a8effb258 Mon Sep 17 00:00:00 2001 From: Geraldo Ribeiro Date: Sat, 6 Sep 2025 12:06:28 +0400 Subject: [PATCH 7/9] Reformat --- include/MicroCI.hpp | 2 +- include/PluginStepParser.hpp | 2 +- src/BashPluginStepParser.cpp | 20 +++++++-------- src/BeamerPluginStepParser.cpp | 26 ++++++++++---------- src/ClangFormatPluginStepParser.cpp | 10 ++++---- src/ClangTidyPluginStepParser.cpp | 12 ++++----- src/CppCheckPluginStepParser.cpp | 20 +++++++-------- src/DockerBuildPluginStepParser.cpp | 24 +++++++++--------- src/DocmdPluginStepParser.cpp | 28 ++++++++++----------- src/DoxygenPluginStepParser.cpp | 30 +++++++++++------------ src/FetchPluginStepParser.cpp | 28 ++++++++++----------- src/FlawfinderPluginStepParser.cpp | 10 ++++---- src/GitDeployPluginStepParser.cpp | 20 +++++++-------- src/GitPublishPluginStepParser.cpp | 30 +++++++++++------------ src/MicroCI.cpp | 34 +++++++++++++------------- src/MicroCIUtils.cpp | 4 +-- src/MinioPluginStepParser.cpp | 18 +++++++------- src/MkdocsMaterialPluginStepParser.cpp | 14 +++++------ src/PandocPluginStepParser.cpp | 12 ++++----- src/PikchrPluginStepParser.cpp | 14 +++++------ src/PlantumlPluginStepParser.cpp | 16 ++++++------ src/PluginStepParser.cpp | 24 +++++++++--------- src/SkipPluginStepParser.cpp | 12 ++++----- src/TemplatePluginStepParser.cpp | 16 ++++++------ src/VHDLFormatPluginStepParser.cpp | 14 +++++------ src/main.cpp | 16 ++++++------ 26 files changed, 228 insertions(+), 228 deletions(-) diff --git a/include/MicroCI.hpp b/include/MicroCI.hpp index bd5aeb6..c394aa0 100644 --- a/include/MicroCI.hpp +++ b/include/MicroCI.hpp @@ -116,7 +116,7 @@ class MicroCI { string mDefaultDockerImage; string mDefaultWorkspace; stringstream mScript; - bool mIsValid = true; + bool mIsValid = true; bool mAppendLog = false; map> mPluginParserMap; diff --git a/include/PluginStepParser.hpp b/include/PluginStepParser.hpp index 1277ef7..f0aa5d1 100644 --- a/include/PluginStepParser.hpp +++ b/include/PluginStepParser.hpp @@ -72,7 +72,7 @@ class PluginStepParser { void prepareRunDocker(const json &data, const set &envs, const set &volumes); MicroCI *mMicroCI = nullptr; - bool mIsValid = true; + bool mIsValid = true; }; } // namespace microci diff --git a/src/BashPluginStepParser.cpp b/src/BashPluginStepParser.cpp index 37df1c9..d53078f 100644 --- a/src/BashPluginStepParser.cpp +++ b/src/BashPluginStepParser.cpp @@ -41,8 +41,8 @@ using namespace std; // ---------------------------------------------------------------------- void BashPluginStepParser::Parse(const YAML::Node &step) { auto cmdsStr = string{}; - auto cmds = vector{}; - auto line = string{}; + auto cmds = vector{}; + auto line = string{}; list opts{}; auto data = mMicroCI->DefaultDataTemplate(); @@ -70,17 +70,17 @@ void BashPluginStepParser::Parse(const YAML::Node &step) { } } - auto volumes = parseVolumes(step); - auto envs = parseEnvs(step); - data = parseRunAs(step, data, "user"); - data = parseNetwork(step, data, "none"); - data = parseDevices(step, data); + auto volumes = parseVolumes(step); + auto envs = parseEnvs(step); + data = parseRunAs(step, data, "user"); + data = parseNetwork(step, data, "none"); + data = parseDevices(step, data); tie(data, volumes, envs) = parseSsh(step, data, volumes, envs); - data["STEP_NAME"] = stepName(step); + data["STEP_NAME"] = stepName(step); data["STEP_DESCRIPTION"] = stepDescription(step, "Execute commands at bash shell"); - data["FUNCTION_NAME"] = sanitizeName(stepName(step)); - data["DOCKER_IMAGE"] = stepDockerImage(step); + data["FUNCTION_NAME"] = sanitizeName(stepName(step)); + data["DOCKER_IMAGE"] = stepDockerImage(step); mMicroCI->Script() << "# bash \n"; beginFunction(data, envs); diff --git a/src/BeamerPluginStepParser.cpp b/src/BeamerPluginStepParser.cpp index 14af7b2..5a0aff7 100644 --- a/src/BeamerPluginStepParser.cpp +++ b/src/BeamerPluginStepParser.cpp @@ -41,14 +41,14 @@ using namespace std; // ---------------------------------------------------------------------- void BeamerPluginStepParser::Parse(const YAML::Node &step) { auto data = mMicroCI->DefaultDataTemplate(); - data = parseRunAs(step, data, "user"); - data = parseNetwork(step, data, "none"); + data = parseRunAs(step, data, "user"); + data = parseNetwork(step, data, "none"); - data["STEP_NAME"] = stepName(step); - data["FUNCTION_NAME"] = sanitizeName(stepName(step)); + data["STEP_NAME"] = stepName(step); + data["FUNCTION_NAME"] = sanitizeName(stepName(step)); data["STEP_DESCRIPTION"] = stepDescription(step, "Apresentação PDF criada a partir do markdown"); - data["DOCKER_IMAGE"] = stepDockerImage(step, "pandoc/latex:latest"); - data["WORKSPACE"] = stepDockerWorkspace(step, "/data"); + data["DOCKER_IMAGE"] = stepDockerImage(step, "pandoc/latex:latest"); + data["WORKSPACE"] = stepDockerWorkspace(step, "/data"); auto inputMD = string{}; if (step["plugin"]["source"] && step["plugin"]["source"].IsSequence()) { @@ -63,15 +63,15 @@ void BeamerPluginStepParser::Parse(const YAML::Node &step) { throw std::runtime_error("É obrigatório especificar uma lista de arquivos de entrada"); } - data["LANG"] = step["plugin"]["lang"].as("pt-BR"); - data["DATE"] = step["plugin"]["date"].as("01 de Abril de 2023"); - data["INSTITUTE"] = step["plugin"]["institute"].as("Nome da instituição"); - data["TITLE"] = step["plugin"]["title"].as("Título da apresentação"); - data["SUBTITLE"] = step["plugin"]["subtitle"].as("Subtítulo da apresentação"); - data["SUBJECT"] = step["plugin"]["subject"].as("Informação da propriedade Assunto do PDF"); + data["LANG"] = step["plugin"]["lang"].as("pt-BR"); + data["DATE"] = step["plugin"]["date"].as("01 de Abril de 2023"); + data["INSTITUTE"] = step["plugin"]["institute"].as("Nome da instituição"); + data["TITLE"] = step["plugin"]["title"].as("Título da apresentação"); + data["SUBTITLE"] = step["plugin"]["subtitle"].as("Subtítulo da apresentação"); + data["SUBJECT"] = step["plugin"]["subject"].as("Informação da propriedade Assunto do PDF"); data["SLIDE_LEVEL"] = step["plugin"]["slide-level"].as("2"); data["ASPECTRATIO"] = step["plugin"]["aspectratio"].as("169"); - data["OUTPUT_PDF"] = step["plugin"]["output"].as("output.pdf"); + data["OUTPUT_PDF"] = step["plugin"]["output"].as("output.pdf"); // data["HEADER_INCLUDES"] = ""; auto filename = string{"header-includes.yaml"}; diff --git a/src/ClangFormatPluginStepParser.cpp b/src/ClangFormatPluginStepParser.cpp index 055c3ae..cac3883 100644 --- a/src/ClangFormatPluginStepParser.cpp +++ b/src/ClangFormatPluginStepParser.cpp @@ -40,9 +40,9 @@ using namespace std; // // ---------------------------------------------------------------------- void ClangFormatPluginStepParser::Parse(const YAML::Node &step) { - auto data = mMicroCI->DefaultDataTemplate(); + auto data = mMicroCI->DefaultDataTemplate(); auto volumes = parseVolumes(step); - auto envs = parseEnvs(step); + auto envs = parseEnvs(step); list sourceList; data = parseRunAs(step, data, "user"); @@ -54,9 +54,9 @@ void ClangFormatPluginStepParser::Parse(const YAML::Node &step) { } } - data["STEP_NAME"] = stepName(step); - data["DOCKER_IMAGE"] = stepDockerImage(step, "intmain/microci_cpp_compiler:latest"); - data["FUNCTION_NAME"] = sanitizeName(stepName(step)); + data["STEP_NAME"] = stepName(step); + data["DOCKER_IMAGE"] = stepDockerImage(step, "intmain/microci_cpp_compiler:latest"); + data["FUNCTION_NAME"] = sanitizeName(stepName(step)); data["STEP_DESCRIPTION"] = stepDescription(step, "C++ code formatting"); beginFunction(data, envs); diff --git a/src/ClangTidyPluginStepParser.cpp b/src/ClangTidyPluginStepParser.cpp index 4a1b384..a23cb4b 100644 --- a/src/ClangTidyPluginStepParser.cpp +++ b/src/ClangTidyPluginStepParser.cpp @@ -40,10 +40,10 @@ using namespace std; // // ---------------------------------------------------------------------- void ClangTidyPluginStepParser::Parse(const YAML::Node &step) { - auto data = mMicroCI->DefaultDataTemplate(); + auto data = mMicroCI->DefaultDataTemplate(); auto volumes = parseVolumes(step); - auto envs = parseEnvs(step); - auto runAs = string{}; + auto envs = parseEnvs(step); + auto runAs = string{}; list checkList; list includeList; list systemIncludeList; @@ -85,9 +85,9 @@ void ClangTidyPluginStepParser::Parse(const YAML::Node &step) { } } - data["STEP_NAME"] = stepName(step); - data["DOCKER_IMAGE"] = stepDockerImage(step, "intmain/microci_cpp_compiler:latest"); - data["FUNCTION_NAME"] = sanitizeName(stepName(step)); + data["STEP_NAME"] = stepName(step); + data["DOCKER_IMAGE"] = stepDockerImage(step, "intmain/microci_cpp_compiler:latest"); + data["FUNCTION_NAME"] = sanitizeName(stepName(step)); data["STEP_DESCRIPTION"] = stepDescription(step, "C++ code check with clang-tidy"); beginFunction(data, envs); diff --git a/src/CppCheckPluginStepParser.cpp b/src/CppCheckPluginStepParser.cpp index f3870ae..e5c7572 100644 --- a/src/CppCheckPluginStepParser.cpp +++ b/src/CppCheckPluginStepParser.cpp @@ -46,11 +46,11 @@ void CppCheckPluginStepParser::Parse(const YAML::Node &step) { list sourceList; list opts{"--enable=all", "--inconclusive", "--xml", "--xml-version=2"}; - auto data = mMicroCI->DefaultDataTemplate(); + auto data = mMicroCI->DefaultDataTemplate(); auto volumes = parseVolumes(step); - auto envs = parseEnvs(step); - data = parseRunAs(step, data, "user"); - data = parseNetwork(step, data, "none"); + auto envs = parseEnvs(step); + data = parseRunAs(step, data, "user"); + data = parseNetwork(step, data, "none"); if (step["plugin"]["options"] && step["plugin"]["options"].IsSequence()) { for (const auto &opt : step["plugin"]["options"]) { @@ -78,13 +78,13 @@ void CppCheckPluginStepParser::Parse(const YAML::Node &step) { standard = step["plugin"]["std"].as(); } - data["STEP_NAME"] = stepName(step); - data["DOCKER_IMAGE"] = stepDockerImage(step, "intmain/microci_cpp_compiler:latest"); - data["FUNCTION_NAME"] = sanitizeName(stepName(step)); + data["STEP_NAME"] = stepName(step); + data["DOCKER_IMAGE"] = stepDockerImage(step, "intmain/microci_cpp_compiler:latest"); + data["FUNCTION_NAME"] = sanitizeName(stepName(step)); data["STEP_DESCRIPTION"] = stepDescription(step, "Verifica código C++"); - data["PLATFORM"] = platform; - data["STD"] = standard; - data["REPORT_TITLE"] = "MicroCI::CppCheck"; + data["PLATFORM"] = platform; + data["STD"] = standard; + data["REPORT_TITLE"] = "MicroCI::CppCheck"; beginFunction(data, envs); prepareRunDocker(data, envs, volumes); diff --git a/src/DockerBuildPluginStepParser.cpp b/src/DockerBuildPluginStepParser.cpp index 60b251b..3b7826e 100644 --- a/src/DockerBuildPluginStepParser.cpp +++ b/src/DockerBuildPluginStepParser.cpp @@ -40,23 +40,23 @@ using namespace std; // // ---------------------------------------------------------------------- void DockerBuildPluginStepParser::Parse(const YAML::Node &step) { - auto data = mMicroCI->DefaultDataTemplate(); - auto envs = parseEnvs(step); - data["STEP_NAME"] = stepName(step); - data["FUNCTION_NAME"] = sanitizeName(stepName(step)); + auto data = mMicroCI->DefaultDataTemplate(); + auto envs = parseEnvs(step); + data["STEP_NAME"] = stepName(step); + data["FUNCTION_NAME"] = sanitizeName(stepName(step)); data["STEP_DESCRIPTION"] = stepDescription(step, "Builds a docker image"); - auto folder = step["plugin"]["folder"].as("dockerfiles"); - auto dockerfile = step["plugin"]["dockerfile"].as("Dockerfile"); - auto targetName = step["plugin"]["target"].as("my_image"); + auto folder = step["plugin"]["folder"].as("dockerfiles"); + auto dockerfile = step["plugin"]["dockerfile"].as("Dockerfile"); + auto targetName = step["plugin"]["target"].as("my_image"); auto targetVersion = step["plugin"]["version"].as("0.1.0"); - auto isLatest = step["plugin"]["is_latest"].as(false); - auto doPush = step["plugin"]["push"].as(false); + auto isLatest = step["plugin"]["is_latest"].as(false); + auto doPush = step["plugin"]["push"].as(false); - data["FOLDER"] = folder; + data["FOLDER"] = folder; data["TARGET_NAME"] = targetName; - data["VERSION"] = targetVersion; - data["DOCKERFILE"] = dockerfile; + data["VERSION"] = targetVersion; + data["DOCKERFILE"] = dockerfile; beginFunction(data, envs); mMicroCI->Script() << inja::render(R"( \ diff --git a/src/DocmdPluginStepParser.cpp b/src/DocmdPluginStepParser.cpp index 910afe9..db10cff 100644 --- a/src/DocmdPluginStepParser.cpp +++ b/src/DocmdPluginStepParser.cpp @@ -40,11 +40,11 @@ using namespace std; // // ---------------------------------------------------------------------- void DocmdPluginStepParser::Parse(const YAML::Node &step) { - auto data = mMicroCI->DefaultDataTemplate(); - auto volumes = parseVolumes(step); - auto envs = parseEnvs(step); - bool toc = false; - bool details = false; + auto data = mMicroCI->DefaultDataTemplate(); + auto volumes = parseVolumes(step); + auto envs = parseEnvs(step); + bool toc = false; + bool details = false; bool show_source = false; bool show_banner = true; @@ -53,34 +53,34 @@ void DocmdPluginStepParser::Parse(const YAML::Node &step) { if (step["plugin"]["toc"]) { toc = step["plugin"]["toc"].as(); } - env.name = "DOCMD_TOC"; + env.name = "DOCMD_TOC"; env.value = toc ? "true" : "false"; envs.insert(env); if (step["plugin"]["details"]) { details = step["plugin"]["details"].as(); } - env.name = "DOCMD_DETAILS"; + env.name = "DOCMD_DETAILS"; env.value = details ? "true" : "false"; envs.insert(env); if (step["plugin"]["show_source"]) { show_source = step["plugin"]["show_source"].as(); } - env.name = "DOCMD_SHOW_SOURCE"; + env.name = "DOCMD_SHOW_SOURCE"; env.value = show_source ? "true" : "false"; envs.insert(env); if (step["plugin"]["show_banner"]) { show_banner = step["plugin"]["show_banner"].as(); } - env.name = "DOCMD_SHOW_BANNER"; + env.name = "DOCMD_SHOW_BANNER"; env.value = show_banner ? "true" : "false"; envs.insert(env); - data["STEP_NAME"] = stepName(step); - data["DOCKER_IMAGE"] = stepDockerImage(step, "intmain/microci_docmd:0.3"); - data["FUNCTION_NAME"] = sanitizeName(stepName(step)); + data["STEP_NAME"] = stepName(step); + data["DOCKER_IMAGE"] = stepDockerImage(step, "intmain/microci_docmd:0.3"); + data["FUNCTION_NAME"] = sanitizeName(stepName(step)); data["STEP_DESCRIPTION"] = stepDescription(step, "Extract documentation"); beginFunction(data, envs); @@ -88,8 +88,8 @@ void DocmdPluginStepParser::Parse(const YAML::Node &step) { if (step["plugin"]["items"] && step["plugin"]["items"].IsSequence()) { for (const auto &item : step["plugin"]["items"]) { if (item.IsSequence()) { - data["DOCMD_LANG"] = item[0].as(); - data["DOCMD_INPUT"] = item[1].as(); + data["DOCMD_LANG"] = item[0].as(); + data["DOCMD_INPUT"] = item[1].as(); data["DOCMD_OUTPUT"] = item[2].as(); prepareRunDocker(data, envs, volumes); diff --git a/src/DoxygenPluginStepParser.cpp b/src/DoxygenPluginStepParser.cpp index 105651f..aa604ca 100644 --- a/src/DoxygenPluginStepParser.cpp +++ b/src/DoxygenPluginStepParser.cpp @@ -40,10 +40,10 @@ using namespace std; // // ---------------------------------------------------------------------- void DoxygenPluginStepParser::Parse(const YAML::Node &step) { - auto header = string{}; - auto footer = string{}; + auto header = string{}; + auto footer = string{}; auto stylesheet = string{}; - auto doxyfile = string{"./Doxyfile"}; + auto doxyfile = string{"./Doxyfile"}; auto output_dir = string{"doxygen"}; if (step["plugin"]["html"]) { @@ -66,21 +66,21 @@ void DoxygenPluginStepParser::Parse(const YAML::Node &step) { output_dir = step["plugin"]["output_dir"].as(); } - auto data = mMicroCI->DefaultDataTemplate(); - auto volumes = parseVolumes(step); - auto envs = parseEnvs(step); - data = parseRunAs(step, data, "user"); - data = parseNetwork(step, data, "none"); + auto data = mMicroCI->DefaultDataTemplate(); + auto volumes = parseVolumes(step); + auto envs = parseEnvs(step); + data = parseRunAs(step, data, "user"); + data = parseNetwork(step, data, "none"); tie(data, volumes, envs) = parseSsh(step, data, volumes, envs); - data["STEP_NAME"] = stepName(step); + data["STEP_NAME"] = stepName(step); data["STEP_DESCRIPTION"] = stepDescription(step, "Execute commands at bash shell"); - data["FUNCTION_NAME"] = sanitizeName(stepName(step)); - data["DOCKER_IMAGE"] = stepDockerImage(step); - data["DOXYFILE"] = doxyfile; - data["HEADER"] = header; - data["FOOTER"] = footer; - data["STYLESHEET"] = stylesheet; + data["FUNCTION_NAME"] = sanitizeName(stepName(step)); + data["DOCKER_IMAGE"] = stepDockerImage(step); + data["DOXYFILE"] = doxyfile; + data["HEADER"] = header; + data["FOOTER"] = footer; + data["STYLESHEET"] = stylesheet; data["OUTPUT_DIRECTORY"] = output_dir; mMicroCI->Script() << "# bash \n"; diff --git a/src/FetchPluginStepParser.cpp b/src/FetchPluginStepParser.cpp index 9a4d26e..012260b 100644 --- a/src/FetchPluginStepParser.cpp +++ b/src/FetchPluginStepParser.cpp @@ -42,20 +42,20 @@ using namespace std; void FetchPluginStepParser::Parse(const YAML::Node &step) { auto data = mMicroCI->DefaultDataTemplate(); // data = parseRunAs(step, data, "user"); - data = parseRunAs(step, data, "root"); // From new version of bitname/git - data = parseNetwork(step, data, "bridge"); - data["STEP_NAME"] = stepName(step); - data["FUNCTION_NAME"] = sanitizeName(stepName(step)); + data = parseRunAs(step, data, "root"); // From new version of bitname/git + data = parseNetwork(step, data, "bridge"); + data["STEP_NAME"] = stepName(step); + data["FUNCTION_NAME"] = sanitizeName(stepName(step)); data["STEP_DESCRIPTION"] = stepDescription(step, "Baixa arquivos externos ao projeto"); - data["DOCKER_IMAGE"] = stepDockerImage(step, "bitnami/git:latest"); + data["DOCKER_IMAGE"] = stepDockerImage(step, "bitnami/git:latest"); - auto volumes = parseVolumes(step); - auto envs = parseEnvs(step); + auto volumes = parseVolumes(step); + auto envs = parseEnvs(step); tie(data, volumes, envs) = parseSsh(step, data, volumes, envs); // Suppress "Welcome to the Bitnami git container" EnvironmentVariable bitnamiDisableWelcomeMessage; - bitnamiDisableWelcomeMessage.name = "DISABLE_WELCOME_MESSAGE"; + bitnamiDisableWelcomeMessage.name = "DISABLE_WELCOME_MESSAGE"; bitnamiDisableWelcomeMessage.value = "true"; envs.insert(bitnamiDisableWelcomeMessage); @@ -70,9 +70,9 @@ void FetchPluginStepParser::Parse(const YAML::Node &step) { copySshIfAvailable(step, data); for (const auto &item : step["plugin"]["items"]) { - auto gitTag = item["tag"].as("master"); + auto gitTag = item["tag"].as("master"); data["GIT_TAG"] = gitTag; - data["TARGET"] = item["target"].as(defaultTarget); + data["TARGET"] = item["target"].as(defaultTarget); mMicroCI->Script() << inja::render( R"( \ && mkdir -p {{ TARGET }})", @@ -101,8 +101,8 @@ void FetchPluginStepParser::Parse(const YAML::Node &step) { gitRemote = "file://" + item["offline"].as(); } - data["GIT_REMOTE"] = gitRemote; - data["FILES"] = ""; // Todos os arquivos + data["GIT_REMOTE"] = gitRemote; + data["FILES"] = ""; // Todos os arquivos data["STRIP_COMPONENTS"] = " --strip-components=1"; // data["STRIP_COMPONENTS"] = ""; @@ -119,7 +119,7 @@ void FetchPluginStepParser::Parse(const YAML::Node &step) { } else { data["GIT_REMOTE"] = gitRemote = item["git_archive"].as(); } - bool isGithubURL = gitRemote.find("github.com") != string::npos; + bool isGithubURL = gitRemote.find("github.com") != string::npos; bool isDotGitEnded = gitRemote.substr(gitRemote.size() - 4) == ".git"; auto files = string{}; @@ -199,7 +199,7 @@ void FetchPluginStepParser::Parse(const YAML::Node &step) { } else if (item["url"]) { data["TARGET"] = item["target"].as(defaultTarget); - data["URL"] = item["url"].as(); + data["URL"] = item["url"].as(); mMicroCI->Script() << inja::render( R"( \ && pushd {{ TARGET }} \ diff --git a/src/FlawfinderPluginStepParser.cpp b/src/FlawfinderPluginStepParser.cpp index 01ecfda..c646dd1 100644 --- a/src/FlawfinderPluginStepParser.cpp +++ b/src/FlawfinderPluginStepParser.cpp @@ -40,9 +40,9 @@ using namespace std; // // ---------------------------------------------------------------------- void FlawfinderPluginStepParser::Parse(const YAML::Node &step) { - auto data = mMicroCI->DefaultDataTemplate(); + auto data = mMicroCI->DefaultDataTemplate(); auto volumes = parseVolumes(step); - auto envs = parseEnvs(step); + auto envs = parseEnvs(step); list sourceList; data = parseRunAs(step, data, "user"); @@ -54,9 +54,9 @@ void FlawfinderPluginStepParser::Parse(const YAML::Node &step) { } } - data["STEP_NAME"] = stepName(step); - data["DOCKER_IMAGE"] = stepDockerImage(step, "intmain/microci_flawfinder:latest"); - data["FUNCTION_NAME"] = sanitizeName(stepName(step)); + data["STEP_NAME"] = stepName(step); + data["DOCKER_IMAGE"] = stepDockerImage(step, "intmain/microci_flawfinder:latest"); + data["FUNCTION_NAME"] = sanitizeName(stepName(step)); data["STEP_DESCRIPTION"] = stepDescription(step, "Analisa o código fonte com flawfinder"); beginFunction(data, envs); diff --git a/src/GitDeployPluginStepParser.cpp b/src/GitDeployPluginStepParser.cpp index 2ce6037..cae0389 100644 --- a/src/GitDeployPluginStepParser.cpp +++ b/src/GitDeployPluginStepParser.cpp @@ -42,23 +42,23 @@ using namespace std; void GitDeployPluginStepParser::Parse(const YAML::Node &step) { auto envs = parseEnvs(step); auto data = mMicroCI->DefaultDataTemplate(); - data = parseRunAs(step, data, "user"); + data = parseRunAs(step, data, "user"); - const auto name = step["plugin"]["name"].as(); - const auto repo = step["plugin"]["repo"].as(); - const auto gitDir = step["plugin"]["git_dir"].as(); + const auto name = step["plugin"]["name"].as(); + const auto repo = step["plugin"]["repo"].as(); + const auto gitDir = step["plugin"]["git_dir"].as(); const auto workTree = step["plugin"]["work_tree"].as(); - auto clean = true; + auto clean = true; if (step["plugin"]["clean"]) { clean = step["plugin"]["clean"].as(); } - data["GIT_URL"] = repo; - data["GIT_DIR"] = gitDir; - data["GIT_WORK"] = workTree; - data["STEP_NAME"] = stepName(step); - data["FUNCTION_NAME"] = sanitizeName(stepName(step)); + data["GIT_URL"] = repo; + data["GIT_DIR"] = gitDir; + data["GIT_WORK"] = workTree; + data["STEP_NAME"] = stepName(step); + data["FUNCTION_NAME"] = sanitizeName(stepName(step)); data["STEP_DESCRIPTION"] = stepDescription(step); beginFunction(data, envs); diff --git a/src/GitPublishPluginStepParser.cpp b/src/GitPublishPluginStepParser.cpp index 57592d7..09ca94b 100644 --- a/src/GitPublishPluginStepParser.cpp +++ b/src/GitPublishPluginStepParser.cpp @@ -40,35 +40,35 @@ using namespace std; // // ---------------------------------------------------------------------- void GitPublishPluginStepParser::Parse(const YAML::Node &step) { - auto data = mMicroCI->DefaultDataTemplate(); + auto data = mMicroCI->DefaultDataTemplate(); auto volumes = parseVolumes(step); - auto envs = parseEnvs(step); + auto envs = parseEnvs(step); - data = parseRunAs(step, data, "root"); // From new version of bitname/git - data = parseNetwork(step, data, "bridge"); + data = parseRunAs(step, data, "root"); // From new version of bitname/git + data = parseNetwork(step, data, "bridge"); tie(data, volumes, envs) = parseSsh(step, data, volumes, envs); // Suppress "Welcome to the Bitnami git container" EnvironmentVariable bitnamiDisableWelcomeMessage; - bitnamiDisableWelcomeMessage.name = "DISABLE_WELCOME_MESSAGE"; + bitnamiDisableWelcomeMessage.name = "DISABLE_WELCOME_MESSAGE"; bitnamiDisableWelcomeMessage.value = "true"; envs.insert(bitnamiDisableWelcomeMessage); - const auto name = step["plugin"]["name"].as(); + const auto name = step["plugin"]["name"].as(); const auto gitURL = step["plugin"]["git_url"].as(); auto pluginCopyFrom = step["plugin"]["copy_from"].as("site"); - auto pluginCopyTo = step["plugin"]["copy_to"].as("/tmp/microci_deploy"); - auto cleanBefore = step["plugin"]["clean_before"].as(true); - auto gitBranch = step["plugin"]["branch"].as("main"); + auto pluginCopyTo = step["plugin"]["copy_to"].as("/tmp/microci_deploy"); + auto cleanBefore = step["plugin"]["clean_before"].as(true); + auto gitBranch = step["plugin"]["branch"].as("main"); - data["GIT_URL"] = gitURL; - data["PLUGIN_COPY_TO"] = pluginCopyTo; + data["GIT_URL"] = gitURL; + data["PLUGIN_COPY_TO"] = pluginCopyTo; data["PLUGIN_COPY_FROM"] = pluginCopyFrom; - data["GIT_BRANCH"] = gitBranch; - data["STEP_NAME"] = stepName(step); - data["DOCKER_IMAGE"] = stepDockerImage(step, "bitnami/git:latest"); - data["FUNCTION_NAME"] = sanitizeName(stepName(step)); + data["GIT_BRANCH"] = gitBranch; + data["STEP_NAME"] = stepName(step); + data["DOCKER_IMAGE"] = stepDockerImage(step, "bitnami/git:latest"); + data["FUNCTION_NAME"] = sanitizeName(stepName(step)); data["STEP_DESCRIPTION"] = stepDescription(step, "Publica arquivos em um repositório git"); beginFunction(data, envs); diff --git a/src/MicroCI.cpp b/src/MicroCI.cpp index 831cedd..95e3df6 100644 --- a/src/MicroCI.cpp +++ b/src/MicroCI.cpp @@ -53,7 +53,7 @@ namespace microci { // ---------------------------------------------------------------------- MicroCI::MicroCI() { mDefaultDockerImage = "debian:stable-slim"; - mDefaultWorkspace = "/microci_workspace"; + mDefaultWorkspace = "/microci_workspace"; } // ---------------------------------------------------------------------- @@ -261,7 +261,7 @@ void MicroCI::LoadEnvironmentFromYamlFile(const string &filename) { } for (auto it : dotEnv) { EnvironmentVariable env; - env.name = it.first.as(); + env.name = it.first.as(); env.value = it.second.as(); mEnvs.insert(env); } @@ -291,7 +291,7 @@ void MicroCI::LoadEnvironmentFromEnvFile(const string &filename) { auto eqPos = line.find_first_of("="); if (eqPos != string::npos) { EnvironmentVariable env; - env.name = line.substr(0, eqPos); + env.name = line.substr(0, eqPos); env.value = line.substr(eqPos + 1); mEnvs.insert(env); } @@ -311,7 +311,7 @@ auto MicroCI::ReadConfig(const string &filename) -> bool { // Global configuration { struct passwd *pw = getpwuid(getuid()); - auto globalEnv = fmt::format("{}/.microCI.env", pw->pw_dir); + auto globalEnv = fmt::format("{}/.microCI.env", pw->pw_dir); LoadEnvironmentFromEnvFile(globalEnv); } @@ -319,7 +319,7 @@ auto MicroCI::ReadConfig(const string &filename) -> bool { if (CI["envs"] and CI["envs"].IsMap()) { for (auto it : CI["envs"]) { EnvironmentVariable env; - env.name = it.first.as(); + env.name = it.first.as(); env.value = it.second.as(); mEnvs.insert(env); } @@ -476,23 +476,23 @@ auto MicroCI::DefaultEnvs() const -> set { return mEnvs; } // ---------------------------------------------------------------------- auto MicroCI::DefaultDataTemplate() const -> json { json data; - data["VERSION"] = fmt::format("v{} ", microCI_version).substr(0, 10); + data["VERSION"] = fmt::format("v{} ", microCI_version).substr(0, 10); data["WORKSPACE"] = mDefaultWorkspace; // Network docker: bridge (default), host, none - data["DOCKER_NETWORK"] = "none"; - data["DOCKER_IMAGE"] = mDefaultDockerImage; - data["RUN_AS"] = "root"; + data["DOCKER_NETWORK"] = "none"; + data["DOCKER_IMAGE"] = mDefaultDockerImage; + data["RUN_AS"] = "root"; data["MICROCI_STEP_SKIP"] = "no"; - data["MICROCI_YAML"] = mYamlFilename; + data["MICROCI_YAML"] = mYamlFilename; - data["BLUE"] = "\033[0;34m"; - data["YELLOW"] = "\033[0;33m"; + data["BLUE"] = "\033[0;34m"; + data["YELLOW"] = "\033[0;33m"; data["MAGENTA"] = "\033[0;35m"; - data["RED"] = "\033[0;31m"; - data["GREEN"] = "\033[0;32m"; - data["CYAN"] = "\033[0;36m"; - data["CLEAR"] = "\033[0m"; + data["RED"] = "\033[0;31m"; + data["GREEN"] = "\033[0;32m"; + data["CYAN"] = "\033[0;36m"; + data["CLEAR"] = "\033[0m"; data["APPEND_LOG_TEE_FLAG"] = mAppendLog ? " -a" : ""; @@ -539,7 +539,7 @@ void MicroCI::initBash(const YAML::Node &CI) { auto scriptMicroCI = string{reinterpret_cast(___sh_MicroCI_sh), ___sh_MicroCI_sh_len}; mScript << inja::render(scriptMicroCI, data) << endl; - auto envs = DefaultEnvs(); + auto envs = DefaultEnvs(); auto webhookEnv = EnvironmentVariable{"MICROCI_DISCORD_WEBHOOK", ""}; if (envs.count(webhookEnv)) { auto scriptNotifyDiscord = diff --git a/src/MicroCIUtils.cpp b/src/MicroCIUtils.cpp index 48ee1a6..c49f4a6 100644 --- a/src/MicroCIUtils.cpp +++ b/src/MicroCIUtils.cpp @@ -78,10 +78,10 @@ auto sanitizeName(const string &name) -> string { // Caracteres não permitidos são trocados por _ const auto allowedChars = "abcdefghijklmnopqrstuvwxyz01234567890"; - size_t found = ret.find_first_not_of(allowedChars); + size_t found = ret.find_first_not_of(allowedChars); while (found != string::npos) { ret[found] = '_'; - found = ret.find_first_not_of(allowedChars, found + 1); + found = ret.find_first_not_of(allowedChars, found + 1); } return ret; } diff --git a/src/MinioPluginStepParser.cpp b/src/MinioPluginStepParser.cpp index bd2e937..1e3735f 100644 --- a/src/MinioPluginStepParser.cpp +++ b/src/MinioPluginStepParser.cpp @@ -40,12 +40,12 @@ using namespace std; // // ---------------------------------------------------------------------- void MinioPluginStepParser::Parse(const YAML::Node &step) { - auto data = mMicroCI->DefaultDataTemplate(); + auto data = mMicroCI->DefaultDataTemplate(); auto volumes = parseVolumes(step); - auto envs = parseEnvs(step); + auto envs = parseEnvs(step); auto cmdsStr = string{}; - auto cmds = vector{}; - auto line = string{}; + auto cmds = vector{}; + auto line = string{}; data = parseRunAs(step, data, "user"); @@ -74,12 +74,12 @@ void MinioPluginStepParser::Parse(const YAML::Node &step) { } } - data["STEP_NAME"] = stepName(step); - data["DOCKER_IMAGE"] = stepDockerImage(step, "minio/mc:latest"); - data["FUNCTION_NAME"] = sanitizeName(stepName(step)); - data["STEP_DESCRIPTION"] = stepDescription(step, "Send files from/to the artifact manager"); + data["STEP_NAME"] = stepName(step); + data["DOCKER_IMAGE"] = stepDockerImage(step, "minio/mc:latest"); + data["FUNCTION_NAME"] = sanitizeName(stepName(step)); + data["STEP_DESCRIPTION"] = stepDescription(step, "Send files from/to the artifact manager"); data["DOCKER_ENTRYPOINT"] = ""; // remove o entrypoint padrão - data["DOCKER_NETWORK"] = "bridge"; + data["DOCKER_NETWORK"] = "bridge"; beginFunction(data, envs); prepareRunDocker(data, envs, volumes); diff --git a/src/MkdocsMaterialPluginStepParser.cpp b/src/MkdocsMaterialPluginStepParser.cpp index 634a151..6930890 100644 --- a/src/MkdocsMaterialPluginStepParser.cpp +++ b/src/MkdocsMaterialPluginStepParser.cpp @@ -41,7 +41,7 @@ using namespace std; // ---------------------------------------------------------------------- void MkdocsMaterialPluginStepParser::Parse(const YAML::Node &step) { auto action = string{"build"}; - auto port = string{"8000"}; + auto port = string{"8000"}; if (step["plugin"]["action"]) { action = step["plugin"]["action"].as(); @@ -54,14 +54,14 @@ void MkdocsMaterialPluginStepParser::Parse(const YAML::Node &step) { } auto data = mMicroCI->DefaultDataTemplate(); - data = parseNetwork(step, data, "host"); + data = parseNetwork(step, data, "host"); - data["ACTION"] = action; - data["PORT"] = port; - data["STEP_NAME"] = stepName(step); - data["FUNCTION_NAME"] = sanitizeName(stepName(step)); + data["ACTION"] = action; + data["PORT"] = port; + data["STEP_NAME"] = stepName(step); + data["FUNCTION_NAME"] = sanitizeName(stepName(step)); data["STEP_DESCRIPTION"] = stepDescription(step, "Documentação usando mkdocs_material"); - data["DOCKER_IMAGE"] = "intmain/microci_mkdocs_material:0.4"; + data["DOCKER_IMAGE"] = "intmain/microci_mkdocs_material:0.4"; // https://unix.stackexchange.com/questions/155551/how-to-debug-a-bash-script // exec 5> >(logger -t $0) diff --git a/src/PandocPluginStepParser.cpp b/src/PandocPluginStepParser.cpp index be312ac..ab43516 100644 --- a/src/PandocPluginStepParser.cpp +++ b/src/PandocPluginStepParser.cpp @@ -38,7 +38,7 @@ using namespace std; // // ---------------------------------------------------------------------- void PandocPluginStepParser::Parse(const YAML::Node &step) { - auto output = string{"output.pdf"}; + auto output = string{"output.pdf"}; auto basePath = string{"."}; list inputList; list optionList = {"--pdf-engine=xelatex"}; @@ -64,13 +64,13 @@ void PandocPluginStepParser::Parse(const YAML::Node &step) { } auto data = mMicroCI->DefaultDataTemplate(); - data = parseNetwork(step, data, "host"); + data = parseNetwork(step, data, "host"); - data["STEP_NAME"] = stepName(step); - data["FUNCTION_NAME"] = sanitizeName(stepName(step)); + data["STEP_NAME"] = stepName(step); + data["FUNCTION_NAME"] = sanitizeName(stepName(step)); data["STEP_DESCRIPTION"] = stepDescription(step, "Create documentation using pandoc"); - data["DOCKER_IMAGE"] = stepDockerImage(step, "intmain/microci_pandoc:latest"); - data["BASE_PATH"] = basePath; + data["DOCKER_IMAGE"] = stepDockerImage(step, "intmain/microci_pandoc:latest"); + data["BASE_PATH"] = basePath; auto envs = parseEnvs(step); beginFunction(data, envs); diff --git a/src/PikchrPluginStepParser.cpp b/src/PikchrPluginStepParser.cpp index eabdb28..fbffe9f 100644 --- a/src/PikchrPluginStepParser.cpp +++ b/src/PikchrPluginStepParser.cpp @@ -40,9 +40,9 @@ using namespace std; // // ---------------------------------------------------------------------- void PikchrPluginStepParser::Parse(const YAML::Node &step) { - auto data = mMicroCI->DefaultDataTemplate(); + auto data = mMicroCI->DefaultDataTemplate(); auto volumes = parseVolumes(step); - auto envs = parseEnvs(step); + auto envs = parseEnvs(step); list sourceList; // list opts = {"-nometadata", "-charset utf-8 ", "-r"}; @@ -63,7 +63,7 @@ void PikchrPluginStepParser::Parse(const YAML::Node &step) { set validTypes{"svg", "png", "pdf"}; - auto type = step["plugin"]["type"].as("svg"); + auto type = step["plugin"]["type"].as("svg"); auto outputFolder = step["plugin"]["output_folder"].as(""); // auto config = step["plugin"]["config"].as(""); @@ -85,11 +85,11 @@ void PikchrPluginStepParser::Parse(const YAML::Node &step) { // opts.push_back("-o /microci_workspace/" + outputFolder); // } - data["STEP_NAME"] = stepName(step); - data["DOCKER_IMAGE"] = stepDockerImage(step, "intmain/microci_pikchr:latest"); - data["FUNCTION_NAME"] = sanitizeName(stepName(step)); + data["STEP_NAME"] = stepName(step); + data["DOCKER_IMAGE"] = stepDockerImage(step, "intmain/microci_pikchr:latest"); + data["FUNCTION_NAME"] = sanitizeName(stepName(step)); data["STEP_DESCRIPTION"] = stepDescription(step, "Build diagrams from textual description"); - data["OUTPUT"] = outputFolder; + data["OUTPUT"] = outputFolder; beginFunction(data, envs); prepareRunDocker(data, envs, volumes); diff --git a/src/PlantumlPluginStepParser.cpp b/src/PlantumlPluginStepParser.cpp index ae18ca7..786d945 100644 --- a/src/PlantumlPluginStepParser.cpp +++ b/src/PlantumlPluginStepParser.cpp @@ -40,9 +40,9 @@ using namespace std; // // ---------------------------------------------------------------------- void PlantumlPluginStepParser::Parse(const YAML::Node &step) { - auto data = mMicroCI->DefaultDataTemplate(); + auto data = mMicroCI->DefaultDataTemplate(); auto volumes = parseVolumes(step); - auto envs = parseEnvs(step); + auto envs = parseEnvs(step); list sourceList; list opts = {"-nometadata", "-charset utf-8 ", "-r"}; @@ -61,9 +61,9 @@ void PlantumlPluginStepParser::Parse(const YAML::Node &step) { } } - auto type = step["plugin"]["type"].as("png"); + auto type = step["plugin"]["type"].as("png"); auto outputFolder = step["plugin"]["output_folder"].as(""); - auto config = step["plugin"]["config"].as(""); + auto config = step["plugin"]["config"].as(""); // para executar com GUI // -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/ @@ -78,11 +78,11 @@ void PlantumlPluginStepParser::Parse(const YAML::Node &step) { opts.push_back("-o /microci_workspace/" + outputFolder); } - data["STEP_NAME"] = stepName(step); - data["DOCKER_IMAGE"] = stepDockerImage(step, "intmain/microci_plantuml:latest"); - data["FUNCTION_NAME"] = sanitizeName(stepName(step)); + data["STEP_NAME"] = stepName(step); + data["DOCKER_IMAGE"] = stepDockerImage(step, "intmain/microci_plantuml:latest"); + data["FUNCTION_NAME"] = sanitizeName(stepName(step)); data["STEP_DESCRIPTION"] = stepDescription(step, "Build diagrams from textual description"); - data["OUTPUT"] = outputFolder; + data["OUTPUT"] = outputFolder; beginFunction(data, envs); prepareRunDocker(data, envs, volumes); diff --git a/src/PluginStepParser.cpp b/src/PluginStepParser.cpp index 2000455..d295190 100644 --- a/src/PluginStepParser.cpp +++ b/src/PluginStepParser.cpp @@ -49,7 +49,7 @@ void PluginStepParser::invalidConfigurationDetected() { mIsValid = false; } // // ---------------------------------------------------------------------- auto PluginStepParser::parseRunAs(const YAML::Node &step, const json &data, const string &defaultValue) const -> json { - auto data_ = data; + auto data_ = data; data_["RUN_AS"] = defaultValue; if (step["run_as"]) { data_["RUN_AS"] = step["run_as"].as(); @@ -62,7 +62,7 @@ auto PluginStepParser::parseRunAs(const YAML::Node &step, const json &data, cons // ---------------------------------------------------------------------- auto PluginStepParser::parseNetwork(const YAML::Node &step, const json &data, const string &defaultValue) const -> json { - auto data_ = data; + auto data_ = data; data_["DOCKER_NETWORK"] = defaultValue; if (step["network"]) { data_["DOCKER_NETWORK"] = step["network"].as(); @@ -93,7 +93,7 @@ auto PluginStepParser::stepDockerImage(const YAML::Node &step, const string &ima // // ---------------------------------------------------------------------- auto PluginStepParser::parseDevices(const YAML::Node &step, const json &data) const -> json { - auto data_ = data; + auto data_ = data; data_["DOCKER_DEVICES"] = json::array(); if (step["devices"] and step["devices"].IsSequence()) { @@ -129,7 +129,7 @@ auto PluginStepParser::parseEnvs(const YAML::Node &step) const -> set(); + env.name = it.first.as(); env.value = it.second.as(); ret.insert(env); } @@ -209,7 +209,7 @@ void PluginStepParser::endFunction(const json &data) { )", data); - auto envs = mMicroCI->DefaultEnvs(); + auto envs = mMicroCI->DefaultEnvs(); auto webhookEnv = EnvironmentVariable{"MICROCI_DISCORD_WEBHOOK", ""}; if (envs.count(webhookEnv)) { mMicroCI->Script() << inja::render(R"( @@ -300,11 +300,11 @@ auto PluginStepParser::parseSsh(const YAML::Node &step, const json &data, const const set &envs) const -> tuple, set> { auto sshMountForCopy = string{"${HOME}/.ssh"}; - auto volumes_ = volumes; - auto data_ = data; - auto envs_ = envs; + auto volumes_ = volumes; + auto data_ = data; + auto envs_ = envs; - data_["SSH_COPY_TO"] = string{}; + data_["SSH_COPY_TO"] = string{}; data_["SSH_COPY_FROM"] = "/.microCI_ssh"; if (step["ssh"]) { @@ -326,8 +326,8 @@ auto PluginStepParser::parseSsh(const YAML::Node &step, const json &data, const // Temporary mounting for copy DockerVolume vol; vol.destination = "/.microCI_ssh"; - vol.source = sshMountForCopy; - vol.mode = "ro"; + vol.source = sshMountForCopy; + vol.mode = "ro"; volumes_.insert(vol); } return {data_, volumes_, envs_}; @@ -360,7 +360,7 @@ auto PluginStepParser::parseVolumes(const YAML::Node &step) const -> set(); - vol.source = volume["source"].as(); + vol.source = volume["source"].as(); if (volume["mode"]) { vol.mode = volume["mode"].as(); } else { diff --git a/src/SkipPluginStepParser.cpp b/src/SkipPluginStepParser.cpp index b90e1f7..380c32f 100644 --- a/src/SkipPluginStepParser.cpp +++ b/src/SkipPluginStepParser.cpp @@ -40,15 +40,15 @@ using namespace std; // // ---------------------------------------------------------------------- void SkipPluginStepParser::Parse(const YAML::Node &step) { - auto data = mMicroCI->DefaultDataTemplate(); - auto envs = parseEnvs(step); + auto data = mMicroCI->DefaultDataTemplate(); + auto envs = parseEnvs(step); auto volumes = parseVolumes(step); data["MICROCI_STEP_SKIP"] = "yes"; - data["STEP_NAME"] = stepName(step); - data["STEP_DESCRIPTION"] = stepDescription(step, "This step will be ignored"); - data["FUNCTION_NAME"] = sanitizeName(stepName(step)); - data["DOCKER_IMAGE"] = stepDockerImage(step); + data["STEP_NAME"] = stepName(step); + data["STEP_DESCRIPTION"] = stepDescription(step, "This step will be ignored"); + data["FUNCTION_NAME"] = sanitizeName(stepName(step)); + data["DOCKER_IMAGE"] = stepDockerImage(step); beginFunction(data, envs); mMicroCI->Script() << " echo 'This step do nothing!'\n"; diff --git a/src/TemplatePluginStepParser.cpp b/src/TemplatePluginStepParser.cpp index 4e9c78a..7b17b16 100644 --- a/src/TemplatePluginStepParser.cpp +++ b/src/TemplatePluginStepParser.cpp @@ -40,16 +40,16 @@ using namespace std; // // ---------------------------------------------------------------------- void TemplatePluginStepParser::Parse(const YAML::Node &step) { - auto data = mMicroCI->DefaultDataTemplate(); + auto data = mMicroCI->DefaultDataTemplate(); auto volumes = parseVolumes(step); - auto envs = parseEnvs(step); + auto envs = parseEnvs(step); // bool toc = false; // bool details = false; // bool show_source = false; // bool show_banner = true; EnvironmentVariable env; - env.name = "RUST_BACKTRACE"; + env.name = "RUST_BACKTRACE"; env.value = "full"; envs.insert(env); @@ -81,9 +81,9 @@ void TemplatePluginStepParser::Parse(const YAML::Node &step) { // env.value = show_banner ? "true" : "false"; // envs.insert(env); - data["STEP_NAME"] = stepName(step); - data["DOCKER_IMAGE"] = stepDockerImage(step, "chevdor/tera:latest"); - data["FUNCTION_NAME"] = sanitizeName(stepName(step)); + data["STEP_NAME"] = stepName(step); + data["DOCKER_IMAGE"] = stepDockerImage(step, "chevdor/tera:latest"); + data["FUNCTION_NAME"] = sanitizeName(stepName(step)); data["STEP_DESCRIPTION"] = stepDescription(step, "Generate output from template"); beginFunction(data, envs); @@ -91,8 +91,8 @@ void TemplatePluginStepParser::Parse(const YAML::Node &step) { if (step["plugin"]["items"] && step["plugin"]["items"].IsSequence()) { for (const auto &item : step["plugin"]["items"]) { if (item.IsSequence()) { - data["TEMPLATE_DATA"] = item[0].as(); - data["TEMPLATE_INPUT"] = item[1].as(); + data["TEMPLATE_DATA"] = item[0].as(); + data["TEMPLATE_INPUT"] = item[1].as(); data["TEMPLATE_OUTPUT"] = item[2].as(); prepareRunDocker(data, envs, volumes); diff --git a/src/VHDLFormatPluginStepParser.cpp b/src/VHDLFormatPluginStepParser.cpp index 5abe751..3fe8fab 100644 --- a/src/VHDLFormatPluginStepParser.cpp +++ b/src/VHDLFormatPluginStepParser.cpp @@ -40,11 +40,11 @@ using namespace std; // // ---------------------------------------------------------------------- void VHDLFormatPluginStepParser::Parse(const YAML::Node &step) { - auto data = mMicroCI->DefaultDataTemplate(); - auto volumes = parseVolumes(step); - auto envs = parseEnvs(step); - data = parseRunAs(step, data, "user"); - data = parseNetwork(step, data, "none"); + auto data = mMicroCI->DefaultDataTemplate(); + auto volumes = parseVolumes(step); + auto envs = parseEnvs(step); + data = parseRunAs(step, data, "user"); + data = parseNetwork(step, data, "none"); tie(data, volumes, envs) = parseSsh(step, data, volumes, envs); list sourceList; @@ -63,9 +63,9 @@ void VHDLFormatPluginStepParser::Parse(const YAML::Node &step) { data["STEP_DESCRIPTION"] = stepDescription(step, "Process source code to make readable or match to a project code style"); data["FUNCTION_NAME"] = sanitizeName(stepName(step)); - data["DOCKER_IMAGE"] = stepDockerImage(step, "intmain/microci_ghdl:latest"); + data["DOCKER_IMAGE"] = stepDockerImage(step, "intmain/microci_ghdl:latest"); - auto emacsConfigFilename = inja::render("{{ WORKSPACE }}/.emacs_vhdl_formatter.lisp", data); + auto emacsConfigFilename = inja::render("{{ WORKSPACE }}/.emacs_vhdl_formatter.lisp", data); data["EMACS_VHDL_FORMATTER_FILENAME"] = emacsConfigFilename; ostringstream emacsConfig; diff --git a/src/main.cpp b/src/main.cpp index cd4b57b..2c53e44 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -162,7 +162,7 @@ void loadMicroCIEnviromentVariables(MicroCI &uCI, char **envp) { if (envStr.size() > 7 and envStr.substr(0, 8) == "MICROCI_") { auto pos = envStr.find_first_of("="); EnvironmentVariable environmentVariable; - environmentVariable.name = envStr.substr(0, pos); + environmentVariable.name = envStr.substr(0, pos); environmentVariable.value = envStr.substr(pos + 1); uCI.SetEnvironmentVariable(environmentVariable); } @@ -398,10 +398,10 @@ void loadGitlabEnvironmentVariables(MicroCI &uCI, char **envp) { for (char **env = envp; *env != nullptr; env++) { auto envStr = string{*env}; - auto pos = envStr.find_first_of("="); + auto pos = envStr.find_first_of("="); if (pos != string::npos) { EnvironmentVariable environmentVariable; - environmentVariable.name = envStr.substr(0, pos); + environmentVariable.name = envStr.substr(0, pos); environmentVariable.value = envStr.substr(pos + 1); if (allowedEnvironmentVariables.count(environmentVariable.name) == 1) { uCI.SetEnvironmentVariable(environmentVariable); @@ -693,7 +693,7 @@ sudo rm -f /usr/bin/microCI pwd.erase(pwd.size() - 1); // remove a barra no final } - auto gitRemoteOrigin = string{}; + auto gitRemoteOrigin = string{}; auto gitConfigFilename = pwd + "/.git/config"; if (filesystem::exists(gitConfigFilename)) { ini::IniFile gitConfigIni; @@ -710,7 +710,7 @@ sudo rm -f /usr/bin/microCI EVP_MD_CTX *mdctx; unsigned char *md5_digest; unsigned int md5_digest_len = EVP_MD_size(EVP_md5()); - mdctx = EVP_MD_CTX_new(); + mdctx = EVP_MD_CTX_new(); EVP_DigestInit_ex(mdctx, EVP_md5(), nullptr); EVP_DigestUpdate(mdctx, pwd.c_str(), pwd.size()); md5_digest = (unsigned char *)OPENSSL_malloc(md5_digest_len); @@ -728,15 +728,15 @@ sudo rm -f /usr/bin/microCI } pwdRepoId = pwdRepoId.substr(0, 7); - dbJson["repos"][pwdRepoId]["path"] = pwd; + dbJson["repos"][pwdRepoId]["path"] = pwd; dbJson["repos"][pwdRepoId]["origin"] = gitRemoteOrigin; size_t stepNo = 0; for (auto step : CI["steps"]) { spdlog::debug("{} {}", stepNo, step["name"].as()); - dbJson["repos"][pwdRepoId]["steps"][stepNo]["name"] = step["name"].as(); + dbJson["repos"][pwdRepoId]["steps"][stepNo]["name"] = step["name"].as(); dbJson["repos"][pwdRepoId]["steps"][stepNo]["plugin"] = step["plugin"]["name"].as(); - dbJson["repos"][pwdRepoId]["steps"][stepNo]["only"] = bool(step["only"]); + dbJson["repos"][pwdRepoId]["steps"][stepNo]["only"] = bool(step["only"]); if (step["description"]) { dbJson["repos"][pwdRepoId]["steps"][stepNo]["description"] = step["description"].as(); } From 582566f7498e35b1f19ac374b45bfe4731a14f4a Mon Sep 17 00:00:00 2001 From: Geraldo Ribeiro Date: Sat, 6 Sep 2025 12:29:02 +0400 Subject: [PATCH 8/9] Fix merge --- src/PluginStepParser.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PluginStepParser.cpp b/src/PluginStepParser.cpp index b820d17..60420e5 100644 --- a/src/PluginStepParser.cpp +++ b/src/PluginStepParser.cpp @@ -28,11 +28,10 @@ // IN THE SOFTWARE. #include "PluginStepParser.hpp" +#include "MicroCI.hpp" #include -#include "MicroCI.hpp" - namespace microci { // ---------------------------------------------------------------------- @@ -300,6 +299,7 @@ auto PluginStepParser::parseSsh(const YAML::Node &step, const json &data, const const set &envs) const -> tuple, set> { auto sshMountForCopy = string{"${HOME}/.ssh"}; + auto sshKeyFormat = string{"id_rsa"}; auto volumes_ = volumes; auto data_ = data; auto envs_ = envs; From 3e10470076b81b95746c02dea3776e90a7b0c048 Mon Sep 17 00:00:00 2001 From: Geraldo Ribeiro Date: Sat, 6 Sep 2025 12:33:42 +0400 Subject: [PATCH 9/9] Use libintl only on mac --- src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index a92093a..3718432 100644 --- a/src/Makefile +++ b/src/Makefile @@ -80,11 +80,11 @@ CXXFLAGS+= -std=c++17 # LDFLAGS+= -lstdc++fs LDFLAGS+= -lyaml-cpp LDFLAGS+= -lcrypto -LDFLAGS+= -lintl # Mac ARM-specific settings ifdef IS_MAC_ARM CXXFLAGS += -I/opt/homebrew/include +LDFLAGS+= -lintl LDFLAGS += -L/opt/homebrew/lib # LIBS += -lmyarmlib endif