Skip to content

Commit 4be4c9f

Browse files
authored
Init github actions (#1)
* Init github actions
1 parent 19883e2 commit 4be4c9f

15 files changed

+472
-35
lines changed

.clang-format

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
BasedOnStyle: Google
2+
NamespaceIndentation: All
3+
BreakBeforeBinaryOperators: NonAssignment
4+
AlignOperands: true
5+
DerivePointerAlignment: false
6+
PointerAlignment: Right
7+
BinPackArguments: false
8+
BinPackParameters: false
9+
AllowShortFunctionsOnASingleLine: Empty
10+
IncludeBlocks: Preserve

.clang-tidy

+262
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,262 @@
1+
---
2+
Checks: '-*,clang-analyzer-*,clang-diagnostic-*,readability-*,modernize-*,boost-*,bugprone-*,cppcoreguidelines-*,google-*,hicpp-*,performance-*,readability-*,-google-readability-namespace-comments,-readability-inconsistent-declaration-parameter-name,-readability-braces-around-statements,-hicpp-signed-bitwise,-google-runtime-references,-cppcoreguidelines-avoid-magic-numbers,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-readability-magic-numbers,-hicpp-explicit-conversions,-hicpp-uppercase-literal-suffix,-readability-uppercase-literal-suffix,-hicpp-no-array-decay,-hicpp-special-member-functions,-bugprone-narrowing-conversions,-modernize-use-nodiscard,-google-readability-braces-around-statements,-hicpp-braces-around-statements,-bugprone-suspicious-semicolon,-readability-named-parameter,-hicpp-named-parameter,-readability-identifier-naming,-modernize-use-trailing-return-type'
3+
WarningsAsErrors: 'modernize-*,cppcoreguidelines-*,boost-*,performance-*,google-build-using-namespace,readability-else-after-return,google-readability-todo'
4+
HeaderFilterRegex: '\.(hpp|h)'
5+
AnalyzeTemporaryDtors: false
6+
FormatStyle: .clang-format
7+
CheckOptions:
8+
- key: bugprone-argument-comment.StrictMode
9+
value: '0'
10+
- key: bugprone-assert-side-effect.AssertMacros
11+
value: assert
12+
- key: bugprone-assert-side-effect.CheckFunctionCalls
13+
value: '0'
14+
- key: bugprone-dangling-handle.HandleClasses
15+
value: 'std::basic_string_view;std::experimental::basic_string_view'
16+
- key: bugprone-exception-escape.FunctionsThatShouldNotThrow
17+
value: ''
18+
- key: bugprone-exception-escape.IgnoredExceptions
19+
value: ''
20+
- key: bugprone-misplaced-widening-cast.CheckImplicitCasts
21+
value: '0'
22+
- key: bugprone-sizeof-expression.WarnOnSizeOfCompareToConstant
23+
value: '1'
24+
- key: bugprone-sizeof-expression.WarnOnSizeOfConstant
25+
value: '1'
26+
- key: bugprone-sizeof-expression.WarnOnSizeOfIntegerExpression
27+
value: '0'
28+
- key: bugprone-sizeof-expression.WarnOnSizeOfThis
29+
value: '1'
30+
- key: bugprone-string-constructor.LargeLengthThreshold
31+
value: '8388608'
32+
- key: bugprone-string-constructor.WarnOnLargeLength
33+
value: '1'
34+
- key: bugprone-suspicious-enum-usage.StrictMode
35+
value: '0'
36+
- key: bugprone-suspicious-missing-comma.MaxConcatenatedTokens
37+
value: '5'
38+
- key: bugprone-suspicious-missing-comma.RatioThreshold
39+
value: '0.200000'
40+
- key: bugprone-suspicious-missing-comma.SizeThreshold
41+
value: '5'
42+
- key: bugprone-suspicious-string-compare.StringCompareLikeFunctions
43+
value: ''
44+
- key: bugprone-suspicious-string-compare.WarnOnImplicitComparison
45+
value: '1'
46+
- key: bugprone-suspicious-string-compare.WarnOnLogicalNotComparison
47+
value: '0'
48+
- key: bugprone-unused-return-value.CheckedFunctions
49+
value: '::std::async;::std::launder;::std::remove;::std::remove_if;::std::unique;::std::unique_ptr::release;::std::basic_string::empty;::std::vector::empty'
50+
- key: cppcoreguidelines-no-malloc.Allocations
51+
value: '::malloc;::calloc'
52+
- key: cppcoreguidelines-no-malloc.Deallocations
53+
value: '::free'
54+
- key: cppcoreguidelines-no-malloc.Reallocations
55+
value: '::realloc'
56+
- key: cppcoreguidelines-owning-memory.LegacyResourceConsumers
57+
value: '::free;::realloc;::freopen;::fclose'
58+
- key: cppcoreguidelines-owning-memory.LegacyResourceProducers
59+
value: '::malloc;::aligned_alloc;::realloc;::calloc;::fopen;::freopen;::tmpfile'
60+
- key: cppcoreguidelines-pro-bounds-constant-array-index.GslHeader
61+
value: ''
62+
- key: cppcoreguidelines-pro-bounds-constant-array-index.IncludeStyle
63+
value: '0'
64+
- key: cppcoreguidelines-pro-type-member-init.IgnoreArrays
65+
value: '0'
66+
- key: cppcoreguidelines-special-member-functions.AllowMissingMoveFunctions
67+
value: '0'
68+
- key: cppcoreguidelines-special-member-functions.AllowSoleDefaultDtor
69+
value: '1'
70+
- key: google-build-namespaces.HeaderFileExtensions
71+
value: ',h,hh,hpp,hxx'
72+
- key: google-global-names-in-headers.HeaderFileExtensions
73+
value: ',h,hh,hpp,hxx'
74+
- key: google-readability-braces-around-statements.ShortStatementLines
75+
value: '1'
76+
- key: google-readability-function-size.BranchThreshold
77+
value: '4294967295'
78+
- key: google-readability-function-size.LineThreshold
79+
value: '4294967295'
80+
- key: google-readability-function-size.NestingThreshold
81+
value: '4294967295'
82+
- key: google-readability-function-size.ParameterThreshold
83+
value: '4294967295'
84+
- key: google-readability-function-size.StatementThreshold
85+
value: '800'
86+
- key: google-readability-function-size.VariableThreshold
87+
value: '4294967295'
88+
- key: google-readability-namespace-comments.ShortNamespaceLines
89+
value: '10'
90+
- key: google-readability-namespace-comments.SpacesBeforeComments
91+
value: '2'
92+
- key: google-runtime-int.SignedTypePrefix
93+
value: int
94+
- key: google-runtime-int.TypeSuffix
95+
value: ''
96+
- key: google-runtime-int.UnsignedTypePrefix
97+
value: uint
98+
- key: google-runtime-references.WhiteListTypes
99+
value: ''
100+
- key: hicpp-braces-around-statements.ShortStatementLines
101+
value: '0'
102+
- key: hicpp-function-size.BranchThreshold
103+
value: '4294967295'
104+
- key: hicpp-function-size.LineThreshold
105+
value: '4294967295'
106+
- key: hicpp-function-size.NestingThreshold
107+
value: '4294967295'
108+
- key: hicpp-function-size.ParameterThreshold
109+
value: '4294967295'
110+
- key: hicpp-function-size.StatementThreshold
111+
value: '800'
112+
- key: hicpp-function-size.VariableThreshold
113+
value: '4294967295'
114+
- key: hicpp-member-init.IgnoreArrays
115+
value: '0'
116+
- key: hicpp-move-const-arg.CheckTriviallyCopyableMove
117+
value: '1'
118+
- key: hicpp-multiway-paths-covered.WarnOnMissingElse
119+
value: '0'
120+
- key: hicpp-named-parameter.IgnoreFailedSplit
121+
value: '0'
122+
- key: hicpp-no-malloc.Allocations
123+
value: '::malloc;::calloc'
124+
- key: hicpp-no-malloc.Deallocations
125+
value: '::free'
126+
- key: hicpp-no-malloc.Reallocations
127+
value: '::realloc'
128+
- key: hicpp-special-member-functions.AllowMissingMoveFunctions
129+
value: '0'
130+
- key: hicpp-special-member-functions.AllowSoleDefaultDtor
131+
value: '0'
132+
- key: hicpp-use-auto.MinTypeNameLength
133+
value: '5'
134+
- key: hicpp-use-auto.RemoveStars
135+
value: '0'
136+
- key: hicpp-use-emplace.ContainersWithPushBack
137+
value: '::std::vector;::std::list;::std::deque'
138+
- key: hicpp-use-emplace.SmartPointers
139+
value: '::std::shared_ptr;::std::unique_ptr;::std::auto_ptr;::std::weak_ptr'
140+
- key: hicpp-use-emplace.TupleMakeFunctions
141+
value: '::std::make_pair;::std::make_tuple'
142+
- key: hicpp-use-emplace.TupleTypes
143+
value: '::std::pair;::std::tuple'
144+
- key: hicpp-use-equals-default.IgnoreMacros
145+
value: '1'
146+
- key: hicpp-use-noexcept.ReplacementString
147+
value: ''
148+
- key: hicpp-use-noexcept.UseNoexceptFalse
149+
value: '1'
150+
- key: hicpp-use-nullptr.NullMacros
151+
value: ''
152+
- key: modernize-loop-convert.MaxCopySize
153+
value: '16'
154+
- key: modernize-loop-convert.MinConfidence
155+
value: reasonable
156+
- key: modernize-loop-convert.NamingStyle
157+
value: CamelCase
158+
- key: modernize-make-shared.IgnoreMacros
159+
value: '1'
160+
- key: modernize-make-shared.IncludeStyle
161+
value: '0'
162+
- key: modernize-make-shared.MakeSmartPtrFunction
163+
value: 'std::make_shared'
164+
- key: modernize-make-shared.MakeSmartPtrFunctionHeader
165+
value: memory
166+
- key: modernize-make-unique.IgnoreMacros
167+
value: '1'
168+
- key: modernize-make-unique.IncludeStyle
169+
value: '0'
170+
- key: modernize-make-unique.MakeSmartPtrFunction
171+
value: 'std::make_unique'
172+
- key: modernize-make-unique.MakeSmartPtrFunctionHeader
173+
value: memory
174+
- key: modernize-pass-by-value.IncludeStyle
175+
value: google
176+
- key: modernize-pass-by-value.ValuesOnly
177+
value: '0'
178+
- key: modernize-raw-string-literal.ReplaceShorterLiterals
179+
value: '0'
180+
- key: modernize-replace-auto-ptr.IncludeStyle
181+
value: google
182+
- key: modernize-replace-random-shuffle.IncludeStyle
183+
value: google
184+
- key: modernize-use-auto.MinTypeNameLength
185+
value: '5'
186+
- key: modernize-use-auto.RemoveStars
187+
value: '0'
188+
- key: modernize-use-default-member-init.IgnoreMacros
189+
value: '1'
190+
- key: modernize-use-default-member-init.UseAssignment
191+
value: '0'
192+
- key: modernize-use-emplace.ContainersWithPushBack
193+
value: '::std::vector;::std::list;::std::deque'
194+
- key: modernize-use-emplace.SmartPointers
195+
value: '::std::shared_ptr;::std::unique_ptr;::std::auto_ptr;::std::weak_ptr'
196+
- key: modernize-use-emplace.TupleMakeFunctions
197+
value: '::std::make_pair;::std::make_tuple'
198+
- key: modernize-use-emplace.TupleTypes
199+
value: '::std::pair;::std::tuple'
200+
- key: modernize-use-equals-default.IgnoreMacros
201+
value: '1'
202+
- key: modernize-use-noexcept.ReplacementString
203+
value: ''
204+
- key: modernize-use-noexcept.UseNoexceptFalse
205+
value: '1'
206+
- key: modernize-use-nullptr.NullMacros
207+
value: 'NULL'
208+
- key: modernize-use-transparent-functors.SafeMode
209+
value: '0'
210+
- key: modernize-use-using.IgnoreMacros
211+
value: '1'
212+
- key: performance-faster-string-find.StringLikeClasses
213+
value: 'std::basic_string'
214+
- key: performance-for-range-copy.WarnOnAllAutoCopies
215+
value: '0'
216+
- key: performance-inefficient-string-concatenation.StrictMode
217+
value: '0'
218+
- key: performance-inefficient-vector-operation.VectorLikeClasses
219+
value: '::std::vector'
220+
- key: performance-move-const-arg.CheckTriviallyCopyableMove
221+
value: '1'
222+
- key: performance-move-constructor-init.IncludeStyle
223+
value: google
224+
- key: performance-type-promotion-in-math-fn.IncludeStyle
225+
value: google
226+
- key: performance-unnecessary-value-param.IncludeStyle
227+
value: google
228+
- key: readability-braces-around-statements.ShortStatementLines
229+
value: '0'
230+
- key: readability-function-size.BranchThreshold
231+
value: '4294967295'
232+
- key: readability-function-size.LineThreshold
233+
value: '4294967295'
234+
- key: readability-function-size.NestingThreshold
235+
value: '4294967295'
236+
- key: readability-function-size.ParameterThreshold
237+
value: '4294967295'
238+
- key: readability-function-size.StatementThreshold
239+
value: '800'
240+
- key: readability-function-size.VariableThreshold
241+
value: '4294967295'
242+
- key: readability-identifier-naming.IgnoreFailedSplit
243+
value: '0'
244+
- key: readability-implicit-bool-conversion.AllowIntegerConditions
245+
value: '0'
246+
- key: readability-implicit-bool-conversion.AllowPointerConditions
247+
value: '0'
248+
- key: readability-inconsistent-declaration-parameter-name.IgnoreMacros
249+
value: '1'
250+
- key: readability-inconsistent-declaration-parameter-name.Strict
251+
value: '0'
252+
- key: readability-simplify-boolean-expr.ChainedConditionalAssignment
253+
value: '0'
254+
- key: readability-simplify-boolean-expr.ChainedConditionalReturn
255+
value: '0'
256+
- key: readability-simplify-subscript-expr.Types
257+
value: '::std::basic_string;::std::basic_string_view;::std::vector;::std::array'
258+
- key: readability-static-accessed-through-instance.NameSpecifierNestingThreshold
259+
value: '3'
260+
- key: cppcoreguidelines-macro-usage.CheckCapsOnly
261+
value: '1'
262+
...

.github/workflows/ci.yml

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
tags: [ '*' ]
7+
pull_request:
8+
9+
env:
10+
BUILD_DIR: build
11+
CTEST_OUTPUT_ON_FAILURE: 1
12+
GITHUB_HUNTER_USERNAME: ${{ secrets.HUNTER_USERNAME }}
13+
GITHUB_HUNTER_TOKEN: ${{ secrets.HUNTER_TOKEN }}
14+
CACHE_VERSION: v01
15+
CACHE_PATHS: |
16+
~/.ccache
17+
~/.hunter
18+
19+
jobs:
20+
MacOS:
21+
runs-on: macos-latest
22+
steps:
23+
- uses: actions/checkout@v2
24+
- uses: actions/cache@v2
25+
with:
26+
path: ${{ env.CACHE_PATHS }}
27+
key: ${{ github.job }}-${{ env.CACHE_VERSION }}
28+
- name: build
29+
env:
30+
DEVELOPER_DIR: /Applications/Xcode_11.7.app/Contents/Developer
31+
run: ./scripts/build.sh
32+
33+
Linux:
34+
strategy:
35+
fail-fast: false
36+
matrix:
37+
options:
38+
- name: "Linux: gcc-9"
39+
run: ./scripts/build.sh -DCMAKE_CXX_COMPIILER=g++-9
40+
- name: "Linux: clang-10"
41+
run: ./scripts/build.sh -DCMAKE_CXX_COMPILER=clang++-10
42+
name: "${{ matrix.options.name }}"
43+
runs-on: ubuntu-latest
44+
steps:
45+
- uses: actions/checkout@v2
46+
- uses: actions/cache@v2
47+
with:
48+
path: ${{ env.CACHE_PATHS }}
49+
key: ${{ github.job }}-${{ matrix.options.name }}-${{ env.CACHE_VERSION }}
50+
- name: "${{ matrix.options.name }}"
51+
run: "${{ matrix.options.run }}"
52+
53+
clang-tidy:
54+
name: "Linux: clang-tidy"
55+
runs-on: ubuntu-latest
56+
container: soramitsu/kagome-dev:2-minideb
57+
steps:
58+
- uses: actions/checkout@v2
59+
with:
60+
fetch-depth: 0
61+
- uses: actions/cache@v2
62+
with:
63+
path: ${{ env.CACHE_PATHS }}
64+
key: ${{ github.job }}-${{ env.CACHE_VERSION }}
65+
- name: clang-tidy
66+
env:
67+
BUILD_TARGET: all
68+
run: |
69+
./scripts/build.sh
70+
./scripts/generate_clang_tidy_diff.sh

CMakeLists.txt

+7-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
cmake_minimum_required(VERSION 3.12)
77

88
include(${CMAKE_CURRENT_LIST_DIR}/cmake/HunterGate.cmake)
9-
9+
set(HUNTER_STATUS_DEBUG ON)
1010
HunterGate(
11-
URL https://github.com/soramitsu/soramitsu-hunter/archive/master.tar.gz
12-
SHA1 39113c56b1d6be190b13995348816710dc1715f7
11+
URL https://github.com/soramitsu/soramitsu-hunter/archive/9ca72322e8d9de70d360dc7f371b223d32999123.zip
12+
SHA1 37cc1150526fb9c5dcf197f918e5d9aab611823f
1313
)
1414

1515
project(Scale CXX)
@@ -18,6 +18,8 @@ set(CMAKE_CXX_STANDARD 17)
1818
set(CMAKE_CXX_STANDARD_REQUIRED ON)
1919
set(CMAKE_CXX_EXTENSIONS OFF)
2020

21+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
22+
2123
option(BUILD_TESTS "Whether to include the test suite in build" OFF)
2224

2325
hunter_add_package(Boost)
@@ -28,7 +30,8 @@ find_package(Microsoft.GSL CONFIG REQUIRED)
2830

2931
add_subdirectory(src)
3032

31-
if (${BUILD_TESTS})
33+
if (BUILD_TESTS)
34+
enable_testing()
3235
add_subdirectory(test ${CMAKE_BINARY_DIR}/tests_bin)
3336
endif()
3437

0 commit comments

Comments
 (0)