Skip to content

Commit

Permalink
Merge branch 'dev' into 'master'
Browse files Browse the repository at this point in the history
Release 2.1.1

See merge request bone/bemos-modbus!3
  • Loading branch information
dns13 committed Jan 11, 2023
2 parents 860a639 + 638c65c commit 2a8f0c7
Show file tree
Hide file tree
Showing 25 changed files with 1,315 additions and 1,138 deletions.
11 changes: 11 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
BasedOnStyle: Google
ColumnLimit: 120
IndentWidth: 4
TabWidth: 4
UseTab: Always
AllowShortFunctionsOnASingleLine: Empty
AllowShortBlocksOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: Never
NamespaceIndentation: All
AccessModifierOffset: -4
IndentCaseLabels: false
32 changes: 32 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
Checks: >-
-*,
bugprone-*,
-bugprone-easily-swappable-parameters,
cert-*,
-cert-dcl16-c,
clang-analyzer-*,
concurrency-*,
cppcoreguidelines-*,
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-pro-type-vararg,
misc-*,
-misc-no-recursion,
modernize-*,
performance-*,
portability-*,
readability-*,
-readability-magic-numbers,
-readability-else-after-return,
-readability-braces-around-statements,
-readability-uppercase-literal-suffix,
-readability-identifier-length
HeaderFilterRegex: ''
FormatStyle: none
CheckOptions:
- { key: readability-identifier-naming.ClassCase, value: CamelCase }
- { key: readability-identifier-naming.StructCase, value: lower_case }
- { key: readability-identifier-naming.VariableCase, value: lower_case }
- { key: readability-identifier-naming.FunctionCase, value: camelBack }
- { key: readability-identifier-naming.ParameterCase, value: lower_case }
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
*.o
*.d
bemos_modbus
gitrev.hpp
gitrev.hpp.md5
compiler_flags
*.sublime-workspace
/bemos_modbus
*.sublime-workspace
build*/
compile_commands.json
.cache/
176 changes: 92 additions & 84 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,125 +1,133 @@
image: docker.bestsens.de/bone/docker-build-image:2.0.3

variables:
GIT_SUBMODULE_STRATEGY: recursive

stages:
- build
- build-image
- deploy
- release

.artifacts: &artifacts
expire_in: 4 weeks
paths:
- build/bemos_modbus
- build/bemos_modbus.dbg

## Build ##############################################################################################################
build:arm:
before_script:
- git submodule sync --recursive
- git submodule update --init --recursive
image: docker.bestsens.de/bone/musl-build-image
stage: build
artifacts:
expire_in: 4 weeks
<<: *artifacts
name: "${CI_PROJECT_NAME}_${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA}_arm"
paths:
- bemos_modbus
cache:
- key: "global_cache"
paths:
- .cache/
- key: "${CI_COMMIT_REF_SLUG}_arm"
paths:
- build/
script:
- source /opt/boneos/2.0.3/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi
- export CCACHE_DIR=${PWD}/.cache/ccache
- mkdir -p build
- cd build
- if [ "${CI_COMMIT_TAG}" == "" ]; then
make systemd STRIP=true APP_VERSION_BRANCH=${CI_COMMIT_REF_SLUG} APP_VERSION_GITREV=${CI_COMMIT_SHORT_SHA};
cmake .. -GNinja
-DGIT_BRANCH=${CI_COMMIT_REF_SLUG}
-DGIT_COMMIT_HASH=${CI_COMMIT_SHORT_SHA}
-DCPM_SOURCE_CACHE=../.cache/CPM
-DBUILD_TESTS=OFF
-DCMAKE_TOOLCHAIN_FILE=../libs/bone_helper/cmake/arm-bemos-linux-musleabihf.cmake;
else
make systemd STRIP=true APP_VERSION_BRANCH=master APP_VERSION_GITREV=${CI_COMMIT_SHORT_SHA};
cmake .. -GNinja
-DGIT_BRANCH=master
-DGIT_COMMIT_HASH=${CI_COMMIT_SHORT_SHA}
-DCPM_SOURCE_CACHE=../.cache/CPM
-DBUILD_TESTS=OFF
-DCMAKE_TOOLCHAIN_FILE=../libs/bone_helper/cmake/arm-bemos-linux-musleabihf.cmake;
fi
- ninja

build:i686:
before_script:
- git submodule sync --recursive
- git submodule update --init --recursive
stage: build
artifacts:
expire_in: 4 weeks
<<: *artifacts
name: "${CI_PROJECT_NAME}_${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA}_i686"
paths:
- bemos_modbus
- Dockerfile
cache:
- key: "global_cache"
paths:
- .cache/
- key: "${CI_COMMIT_REF_SLUG}_i686"
paths:
- build/
script:
- export CCACHE_DIR=${PWD}/.cache/ccache
- mkdir -p build
- cd build
- if [ "${CI_COMMIT_TAG}" == "" ]; then
make STRIP=true APP_VERSION_BRANCH=${CI_COMMIT_REF_SLUG} APP_VERSION_GITREV=${CI_COMMIT_SHORT_SHA};
cmake .. -GNinja
-DGIT_BRANCH=${CI_COMMIT_REF_SLUG}
-DGIT_COMMIT_HASH=${CI_COMMIT_SHORT_SHA}
-DCPM_SOURCE_CACHE=../.cache/CPM;
else
make STRIP=true APP_VERSION_BRANCH=master APP_VERSION_GITREV=${CI_COMMIT_SHORT_SHA};
cmake .. -GNinja
-DGIT_BRANCH=master
-DGIT_COMMIT_HASH=${CI_COMMIT_SHORT_SHA}
-DCPM_SOURCE_CACHE=../.cache/CPM;
fi
- ninja

deploy:arm:
## Create persistent archives #########################################################################################
.deploy: &deploy
stage: deploy
when: on_success
variables:
GIT_STRATEGY: none
only:
- tags
artifacts:
name: "${CI_PROJECT_NAME}_${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA}_arm"
paths:
- bemos_modbus
variables:
GIT_STRATEGY: none
script:
- echo '1'

deploy:arm:
<<: *deploy
artifacts:
<<: *artifacts
name: "${CI_PROJECT_NAME}_${CI_COMMIT_REF_NAME}_arm"
expire_in:
reports:
dotenv: generate_executables.env
dependencies:
- build:arm
script:
- echo GE_JOB_ID=$CI_JOB_ID >> generate_executables.env

deploy:i686:
stage: deploy
when: on_success
variables:
GIT_STRATEGY: none
only:
- tags
<<: *deploy
artifacts:
name: "${CI_PROJECT_NAME}_${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA}_i686"
paths:
- bemos_modbus
script:
- echo '1'
dependencies:
- build:i686

build-image:
image: docker:latest
stage: build-image
variables:
GIT_STRATEGY: none
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build --pull -t $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME .
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
<<: *artifacts
name: "${CI_PROJECT_NAME}_${CI_COMMIT_REF_NAME}_i686"
expire_in:
dependencies:
- build:i686

release-image:
image: docker:latest
stage: deploy
variables:
GIT_STRATEGY: none
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
- docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME $CI_REGISTRY_IMAGE:latest
- docker push $CI_REGISTRY_IMAGE:latest
## Release ############################################################################################################
release_job:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
needs:
- job: deploy:arm
artifacts: true
only:
- tags
dependencies:
- build-image

staging:
stage: deploy
when: manual
environment: staging
variables:
GIT_STRATEGY: none
script:
- fab staging deploy_to_bone:bemos_modbus -f /root/fabfile.py
- fab staging restart_service:bemos-modbus -f /root/fabfile.py
dependencies:
- build:arm

production:
stage: deploy
when: manual
environment: production
variables:
GIT_STRATEGY: none
script:
- fab production deploy_to_bone:bemos_modbus -f /root/fabfile.py
- fab production restart_service:bemos-modbus -f /root/fabfile.py
dependencies:
- build:arm
- echo 'releasing $_CI_COMMIT_TAG'
release:
name: '$CI_COMMIT_TAG'
description: 'Automatically created'
tag_name: '$CI_COMMIT_TAG'
ref: '$CI_COMMIT_TAG'
assets:
links:
- name: "Linux ARM"
url: "https://gitlab.bestsens.de/bone/bemos-modbus/-/jobs/${GE_JOB_ID}/artifacts/download"
12 changes: 0 additions & 12 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
[submodule "libs/bone_helper"]
path = libs/bone_helper
url = ../bone_helper.git
[submodule "libs/json"]
path = libs/json
url = https://github.com/nlohmann/json.git
[submodule "libs/cxxopts"]
path = libs/cxxopts
url = https://github.com/jarro2783/cxxopts.git
[submodule "libs/spdlog"]
path = libs/spdlog
url = https://github.com/gabime/spdlog.git
[submodule "libs/fmt"]
path = libs/fmt
url = https://github.com/fmtlib/fmt.git
78 changes: 78 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{
"files.associations": {
"any": "cpp",
"array": "cpp",
"atomic": "cpp",
"bit": "cpp",
"*.tcc": "cpp",
"bitset": "cpp",
"cctype": "cpp",
"charconv": "cpp",
"chrono": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"codecvt": "cpp",
"compare": "cpp",
"complex": "cpp",
"concepts": "cpp",
"condition_variable": "cpp",
"csignal": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"forward_list": "cpp",
"list": "cpp",
"map": "cpp",
"set": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"ratio": "cpp",
"regex": "cpp",
"string": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"future": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"mutex": "cpp",
"new": "cpp",
"ostream": "cpp",
"ranges": "cpp",
"span": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"stop_token": "cpp",
"streambuf": "cpp",
"thread": "cpp",
"cinttypes": "cpp",
"typeindex": "cpp",
"typeinfo": "cpp",
"valarray": "cpp",
"variant": "cpp"
}
}
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## 2.1.1 (11.01.2023)
- automatically determine target gid & uid
- update nlohmann/json library to v3.11.2 (https://github.com/nlohmann/json/releases/tag/v3.11.2)
- update fmt library to v9.1.0 (https://github.com/fmtlib/fmt/releases/tag/9.1.0)
- update spdlog library to v1.11.0 (https://github.com/gabime/spdlog/releases/tag/v1.11.0)
- update cxxopts library to v3.0.0 (https://github.com/jarro2783/cxxopts/releases/tag/v3.0.0)
- update bone_helper submodule to use boost::asio
- add IPv6 support
- allow to use statically compiled OpenSSL 3
- allow to use with musl
- require C++20

## 2.1.0 (01.12.2020)
- add gitrev and branch to `--version` info
- fix for crash connection handling
Expand Down
Loading

0 comments on commit 2a8f0c7

Please sign in to comment.