Skip to content

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardstock committed Oct 1, 2020
0 parents commit 057379a
Show file tree
Hide file tree
Showing 39 changed files with 3,973 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .circleci/conan_deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

conan install toolbox/3.1.1@edwardstock/latest --build=missing
conan install boost/1.72.0@ --build=missing
conan install nlohmann_json/3.7.3@ --build=missing
conan install yaml-cpp/0.6.3@ --build=missing
conan install libsodium/1.0.18@ --build=missing
20 changes: 20 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: 2.1
commands:
do_all:
steps:
- git clone --recursive https://github.com/edwardstock/dockerpack /root/dockerpack
- bash cfg/package_make.sh -t archive
- bash _build/package_upload.sh -t github

jobs:
build_all:
docker:
- image: docker.edwardstock.com/gcc_dev_el7:latest
steps:
- do_all

workflows:
version: 2.1
build_and_test:
jobs:
- build_all
26 changes: 26 additions & 0 deletions .circleci/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash

if [ ! -d "/tmp/pkgs" ]; then
mkdir -p /tmp/pkgs
fi

# fetching cmake

if [ ! -f "/tmp/pkgs/cmake.sh" ]; then
wget -O /tmp/pkgs/cmake.sh https://github.com/Kitware/CMake/releases/download/v3.14.5/cmake-3.14.5-Linux-x86_64.sh
fi

if [ ! -f "/usr/bin/cmake" ]; then
sh /tmp/pkgs/cmake.sh --skip-license --prefix=/usr
fi

# github uploader
ghr_file="ghr_v0.13.0_linux_amd64"
if [ ! -f "/tmp/pkgs/ghr.tar.gz" ]; then
wget -O /tmp/pkgs/ghr.tar.gz https://github.com/tcnksm/ghr/releases/download/v0.13.0/${ghr_file}.tar.gz
fi

if [ ! -f "/usr/bin/ghr" ]; then
tar -xvf /tmp/pkgs/ghr.tar.gz -C /tmp/pkgs
cp /tmp/pkgs/ghr_*/ghr /usr/bin
fi
118 changes: 118 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 0
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentPPDirectives: None
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: true
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 4
UseTab: Never
...

25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
build/**
_build/**
_build_package/**
output/**
cmake-build-*
!.gitkeep
.idea/
CMakeCache.txt
.directory
.editorconfig
*.a
*.dylib
*.dll
*.obj
*.cpp.o
*.c.o
.vs
.vscode
*.junk
CMakeSettings.json
include/bigmath/bigmath_config.h
out
venv
tmp
dockerpack.lock
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "libs/termcolor"]
path = libs/termcolor
url = https://github.com/ikalnytskyi/termcolor.git
108 changes: 108 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
cmake_minimum_required(VERSION 3.12)
project(dockerpack
VERSION 0.1.0
DESCRIPTION "DockerPack is a small simple docker-based local stateful CI to test and deploy projects that should be built on multiple environments."
LANGUAGES CXX
)

set(CMAKE_CXX_STANDARD 17)

add_definitions(-DDOCKERPACK_VERSION="${PROJECT_VERSION}")
cmake_policy(SET CMP0074 NEW)

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/modules)
if (WIN32)
execute_process(COMMAND cmd /C "echo ${CMAKE_PROJECT_VERSION} > ${CMAKE_CURRENT_SOURCE_DIR}/version")
else ()
execute_process(COMMAND bash -c "echo ${CMAKE_PROJECT_VERSION} > ${CMAKE_CURRENT_SOURCE_DIR}/version")
endif ()


include(modules/compilers_flags.cmake)


set(HEADERS
src/execmd.h
src/data.h
src/config.h
src/state.h
src/builder.h
src/docker.h
src/utils.h)

set(SOURCES
${HEADERS}
src/main.cpp
src/execmd.cpp
src/config.cpp
src/state.cpp
src/builder.cpp
src/docker.cpp
src/data.cpp
src/utils.cpp)

add_executable(dockerpack ${SOURCES})

include(ConanInit)
conan_init()

target_link_libraries(${PROJECT_NAME} CONAN_PKG::toolbox)
target_link_libraries(${PROJECT_NAME} CONAN_PKG::boost)
target_link_libraries(${PROJECT_NAME} CONAN_PKG::nlohmann_json)
target_link_libraries(${PROJECT_NAME} CONAN_PKG::yaml-cpp)
target_link_libraries(${PROJECT_NAME} CONAN_PKG::libsodium)
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/libs/termcolor/include)

if (ENABLE_TEST)

set(gtest_force_shared_crt ${ENABLE_SHARED} CACHE BOOL "" FORCE)

if (APPLE)
add_definitions(-DGTEST_USE_OWN_TR1_TUPLE)
add_definitions(-D__GLIBCXX__)
endif ()

enable_testing()
add_definitions(-DDOCKERPACK_TESTING=1)

add_executable(${PROJECT_NAME}-test
tests/main.cpp)

target_link_libraries(${PROJECT_NAME}-test CONAN_PKG::gtest)

target_link_libraries(${PROJECT_NAME}-test CONAN_PKG::toolbox)
target_link_libraries(${PROJECT_NAME}-test CONAN_PKG::boost)
target_link_libraries(${PROJECT_NAME}-test CONAN_PKG::nlohmann_json)
target_link_libraries(${PROJECT_NAME}-test CONAN_PKG::yaml-cpp)
target_link_libraries(${PROJECT_NAME}-test CONAN_PKG::libsodium)
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/libs/termcolor/include)

if (NOT MSVC)
target_compile_options(${PROJECT_NAME}-test PRIVATE -Wno-missing-field-initializers)
endif ()

if (WITH_COVERAGE)
set(COVERAGE_LCOV_EXCLUDES
'libs/*'
'/usr/include/*'
'tests/*'
'boost/*'
'/usr/include/*'
'/usr/local/*'
'v1'
'4.9'
)
include(modules/CodeCoverage.cmake)
append_coverage_compiler_flags()
setup_target_for_coverage_lcov(
NAME ${PROJECT_NAME}-coverage
EXECUTABLE ${PROJECT_NAME}-test
DEPENDENCIES ${PROJECT_NAME}-test
)
endif ()

add_test(NAME test-all COMMAND ${CMAKE_CURRENT_BINARY_DIR}/bin/${PROJECT_NAME}-test)

endif ()

include(package)
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright © 2020 Eduard Maximovich

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.
60 changes: 60 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
DockerPack
----------------
DockerPack is a small simple local stateful docker-based CI to test and deploy projects that should be built on multiple environments.

[![CircleCI](https://circleci.com/gh/edwardstock/dockerpack/tree/master.svg?style=svg)](https://circleci.com/gh/edwardstock/dockerpack/tree/master)


## Features
Build your own images to build and test your projects faster than cloud CI, as
dockerpack supports build state and you can any time access interactive shell to fix some issues for specified image.<br/>
DockerPack saves success build steps to avoid boilerplate rework.<br/>
Also **dockerpack.yaml** syntax almost looks like github actions or CircleCI.


## Build requirements
* cmake >= 3.12
* gnu gcc 5+/clang 5+/msvc
* make
* toolbox/3.1.1
* boost 1.72.0
* nlohmann/json
* yaml-cpp
* libsodium


## Download

### RPM
Supported distributions:
- centos 7, 8
- fedora 32-34

Steps:
* Create `bintray-edwardstock.repo` file inside `/etc/yum.repos.d`
* Add below to this file
```ini
[bintray-edwardstock]
name=bintray-edwardstock
baseurl=https://dl.bintray.com/edwardstock/rh/[centos OR fedora]/$releasever/$basearch
gpgcheck=0
repo_gpgcheck=1
enabled=1
```
* Add repository gpg to trusted
```bash
curl -s https://bintray.com/user/downloadSubjectPublicKey?username=bintray | gpg --import
```
* Update repository `yum -y update` or `dnf update`
* Install `yum install dockerpack`

### DEB
Supported distributions:
- debian: stretch, buster
- ubuntu: xenial, bionic, focal, groovy

```bash
echo "deb https://dl.bintray.com/edwardstock/debian {distribution} main" | sudo tee -a /etc/apt/sources.list
curl -s https://bintray.com/user/downloadSubjectPublicKey?username=bintray | sudo apt-key add -
apt update && apt install dockerpack
```
Loading

0 comments on commit 057379a

Please sign in to comment.