Skip to content

Commit e48b89a

Browse files
codethinkicodethinkiLukas Thomann
authored
Master/move vcpkg caching to nuget (#12)
**Original Issue**: [#11] closes #11 ### Summary Adds the vcpkg nuget mode --------- Co-authored-by: codethinki <lukas.jmy@outlook.de> Co-authored-by: Lukas Thomann <lukas.thomann@outlook.com>
1 parent 81b01fd commit e48b89a

7 files changed

Lines changed: 230 additions & 86 deletions

File tree

.clang-format

Lines changed: 68 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,94 @@
11
---
2-
AccessModifierOffset: -1
3-
AlignAfterOpenBracket: AlwaysBreak
2+
Language: Cpp
3+
BasedOnStyle: LLVM
4+
AccessModifierOffset: -4
5+
AlignAfterOpenBracket: BlockIndent
46
AlignConsecutiveAssignments: false
57
AlignConsecutiveDeclarations: false
6-
AlignEscapedNewlinesLeft: true
7-
AlignOperands: false
8-
AlignTrailingComments: false
8+
AlignOperands: false
9+
AlignEscapedNewlines: Left
10+
AllowAllArgumentsOnNextLine: false
911
AllowAllParametersOfDeclarationOnNextLine: false
10-
AllowShortBlocksOnASingleLine: false
11-
AllowShortCaseLabelsOnASingleLine: false
12-
AllowShortFunctionsOnASingleLine: Empty
12+
AllowShortBlocksOnASingleLine: Empty
13+
AllowShortCaseLabelsOnASingleLine: true
14+
AllowShortFunctionsOnASingleLine: All
1315
AllowShortIfStatementsOnASingleLine: false
16+
AllowShortLambdasOnASingleLine: All
1417
AllowShortLoopsOnASingleLine: false
1518
AlwaysBreakAfterReturnType: None
16-
AlwaysBreakBeforeMultilineStrings: true
17-
AlwaysBreakTemplateDeclarations: true
19+
AlwaysBreakTemplateDeclarations: Yes
1820
BinPackArguments: false
1921
BinPackParameters: false
2022
BraceWrapping:
21-
AfterClass: false
23+
AfterCaseLabel: false
24+
AfterClass: false
2225
AfterControlStatement: false
23-
AfterEnum: false
24-
AfterFunction: false
25-
AfterNamespace: false
26-
AfterObjCDeclaration: false
27-
AfterStruct: false
28-
AfterUnion: false
29-
BeforeCatch: false
30-
BeforeElse: false
31-
IndentBraces: false
32-
BreakBeforeBinaryOperators: None
33-
BreakBeforeBraces: Attach
26+
AfterEnum: false
27+
AfterFunction: false
28+
AfterNamespace: false
29+
AfterStruct: false
30+
AfterUnion: false
31+
AfterExternBlock: false
32+
BeforeCatch: false
33+
BeforeElse: false
34+
BeforeLambdaBody: false
35+
BeforeWhile: false
36+
SplitEmptyFunction: false
37+
SplitEmptyRecord: false
38+
SplitEmptyNamespace: false
39+
BreakBeforeBraces: Custom
3440
BreakBeforeTernaryOperators: true
35-
BreakConstructorInitializersBeforeComma: false
36-
BreakAfterJavaFieldAnnotations: false
37-
BreakStringLiterals: false
38-
ColumnLimit: 80
39-
CommentPragmas: '^ IWYU pragma:'
40-
ConstructorInitializerAllOnOneLineOrOnePerLine: true
41-
ConstructorInitializerIndentWidth: 4
41+
BreakConstructorInitializers: AfterColon
42+
BreakInheritanceList: BeforeComma
43+
ColumnLimit: 110
44+
CompactNamespaces: false
45+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
4246
ContinuationIndentWidth: 4
43-
Cpp11BracedListStyle: true
44-
DerivePointerAlignment: false
45-
DisableFormat: false
46-
ForEachMacros: [ FOR_EACH, FOR_EACH_R, FOR_EACH_RANGE, ]
47+
EmptyLineAfterAccessModifier: Never
48+
EmptyLineBeforeAccessModifier: LogicalBlock
49+
FixNamespaceComments: false
50+
IncludeBlocks: Preserve
4751
IncludeCategories:
48-
- Regex: '^<.*\.h(pp)?>'
49-
Priority: 1
50-
- Regex: '^<.*'
51-
Priority: 2
52-
- Regex: '.*'
53-
Priority: 3
52+
- Regex: '^".*'
53+
Priority: 1
54+
- Regex: '^<.*'
55+
Priority: 2
56+
- Regex: '.*'
57+
Priority: 3
58+
IncludeIsMainRegex: '([-_](test|unittest))?$'
59+
IndentCaseBlocks: false
5460
IndentCaseLabels: true
61+
IndentGotoLabels: true
5562
IndentPPDirectives: None
56-
IndentWidth: 2
63+
IndentWidth: 4
5764
IndentWrappedFunctionNames: false
58-
KeepEmptyLinesAtTheStartOfBlocks: false
65+
InsertNewlineAtEOF: true
5966
MacroBlockBegin: ''
60-
MacroBlockEnd: ''
61-
MaxEmptyLinesToKeep: 1
62-
NamespaceIndentation: None
63-
ObjCBlockIndentWidth: 2
64-
ObjCSpaceAfterProperty: false
65-
ObjCSpaceBeforeProtocolList: false
66-
PenaltyBreakBeforeFirstCallParameter: 1
67-
PenaltyBreakComment: 300
68-
PenaltyBreakFirstLessLess: 120
69-
PenaltyBreakString: 1000
70-
PenaltyExcessCharacter: 1000000
71-
PenaltyReturnTypeOnItsOwnLine: 200
67+
MacroBlockEnd: ''
68+
MaxEmptyLinesToKeep: 2
69+
NamespaceIndentation: Inner
7270
PointerAlignment: Left
73-
ReflowComments: true
74-
SortIncludes: true
75-
SpaceAfterCStyleCast: false
71+
RequiresClausePosition: WithPreceding
72+
SpaceAfterCStyleCast: true
73+
SpaceAfterLogicalNot: false
74+
SpaceAfterTemplateKeyword: false
7675
SpaceBeforeAssignmentOperators: true
77-
SpaceBeforeParens: ControlStatements
76+
SpaceBeforeCtorInitializerColon: true
77+
SpaceBeforeInheritanceColon: true
78+
SpaceBeforeParens: Never
79+
SpaceBeforeRangeBasedForLoopColon: true
80+
SpaceBeforeSquareBrackets: false
7881
SpaceInEmptyParentheses: false
7982
SpacesBeforeTrailingComments: 1
80-
SpacesInAngles: false
81-
SpacesInContainerLiterals: true
83+
SpacesInAngles: false
84+
SpacesInConditionalStatement: false
8285
SpacesInCStyleCastParentheses: false
8386
SpacesInParentheses: false
8487
SpacesInSquareBrackets: false
85-
Standard: Cpp11
86-
TabWidth: 8
87-
UseTab: Never
88+
TabWidth: 4
89+
UseTab: Never
90+
PenaltyBreakBeforeFirstCallParameter: 0
91+
PenaltyBreakTemplateDeclaration: 0
92+
PenaltyReturnTypeOnItsOwnLine: 10
8893
...
94+

.clang_tidy

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
Checks:
2+
# --- 1. Enable broad categories by default ---
3+
- 'bugprone-*'
4+
- 'misc-*'
5+
- 'modernize-*'
6+
- 'performance-*'
7+
- 'readability-*'
8+
- 'mpi-*'
9+
- 'openmp-*'
10+
11+
# --- 2. CERT (C++ Secure Coding Standards) ---
12+
- 'cert-err52-cpp'
13+
- 'cert-err60-cpp'
14+
- 'cert-err34-c'
15+
- 'cert-err33-c'
16+
- 'cert-str34-c'
17+
- 'cert-mem57-cpp'
18+
- 'cert-msc50-cpp'
19+
- 'cert-oop57-cpp'
20+
- 'cert-msc51-cpp'
21+
- 'cert-dcl58-cpp'
22+
- 'cert-flp30-c'
23+
24+
# --- 3. C++ Core Guidelines ---
25+
- 'cppcoreguidelines-avoid-capturing-lambda-coroutines'
26+
- 'cppcoreguidelines-avoid-const-or-ref-data-members'
27+
- 'cppcoreguidelines-misleading-capture-default-by-value'
28+
- 'cppcoreguidelines-prefer-member-initializer'
29+
- 'cppcoreguidelines-no-suspend-with-lock'
30+
- 'cppcoreguidelines-rvalue-reference-param-not-moved'
31+
- 'cppcoreguidelines-explicit-virtual-functions'
32+
- 'cppcoreguidelines-slicing'
33+
- 'cppcoreguidelines-pro-type-cstyle-cast'
34+
- 'cppcoreguidelines-interfaces-global-init'
35+
- 'cppcoreguidelines-pro-type-static-cast-downcast'
36+
- 'cppcoreguidelines-narrowing-conversions'
37+
- 'cppcoreguidelines-pro-bounds-constant-array-index'
38+
- 'cppcoreguidelines-missing-std-forward'
39+
- 'cppcoreguidelines-avoid-magic-numbers'
40+
- 'cppcoreguidelines-pro-bounds-array-to-pointer-decay'
41+
42+
# --- 4. High Integrity C++ ---
43+
- 'hicpp-multiway-paths-covered'
44+
45+
# --- 5. Portability ---
46+
- 'portability-std-allocator-const'
47+
- 'portability-simd-intrinsics'
48+
49+
# --- 6. Exclusions (Disabling specific checks) ---
50+
# Exclusions for 'bugprone-*'
51+
- '-bugprone-switch-missing-default-case'
52+
- '-bugprone-casting-through-void'
53+
- '-bugprone-exception-escape'
54+
- '-bugprone-tagged-union-member-count'
55+
- '-bugprone-suspicious-stringview-data-usage'
56+
- '-bugprone-multiple-new-in-one-expression'
57+
- '-bugprone-incorrect-enable-shared-from-this'
58+
- '-bugprone-misleading-setter-of-reference'
59+
- '-bugprone-nondeterministic-pointer-iteration-order'
60+
- '-bugprone-incorrect-enable-if'
61+
- '-bugprone-unintended-char-ostream-output'
62+
- '-bugprone-bool-pointer-implicit-conversion'
63+
- '-bugprone-crtp-constructor-accessibility'
64+
- '-bugprone-multi-level-implicit-pointer-conversion'
65+
- '-bugprone-easily-swappable-parameters'
66+
- '-bugprone-non-zero-enum-to-bool-conversion'
67+
- '-bugprone-not-null-terminated-result'
68+
- '-bugprone-standalone-empty'
69+
70+
# Exclusions for 'misc-*'
71+
- '-misc-unused-parameters'
72+
- '-misc-misleading-identifier'
73+
- '-misc-confusable-identifiers'
74+
- '-misc-misleading-bidirectional'
75+
- '-misc-header-include-cycle'
76+
- '-misc-non-private-member-variables-in-classes'
77+
- '-misc-redundant-expression'
78+
79+
# Exclusions for 'modernize-*'
80+
- '-modernize-use-designated-initializers'
81+
- '-modernize-use-trailing-return-type'
82+
- '-modernize-avoid-c-arrays'
83+
- '-modernize-macro-to-enum'
84+
85+
# Exclusions for 'performance-*'
86+
- '-performance-noexcept-swap'
87+
- '-performance-noexcept-destructor'
88+
- '-performance-enum-size'
89+
- '-performance-no-int-to-ptr'
90+
- '-performance-avoid-endl'
91+
92+
# Exclusions for 'readability-*'
93+
- '-readability-named-parameter'
94+
- '-readability-function-size'
95+
- '-readability-identifier-length'
96+
- '-readability-uppercase-literal-suffix'
97+
- '-readability-math-missing-parentheses'
98+
- '-readability-operators-representation'
99+
- '-readability-ambiguous-smartptr-reset-call'
100+
- '-readability-implicit-bool-conversion'
101+
- '-readability-braces-around-statements'
102+
- '-readability-qualified-auto'
103+
- '-readability-container-data-pointer'
104+
- '-readability-avoid-unconditional-preprocessor-if'
105+
- '-readability-function-cognitive-complexity'
106+
- '-readability-identifier-naming'
107+
- '-readability-enum-initial-value'

.github/actions/build-flashmini/action.yml

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,18 @@ inputs:
1414
runs:
1515
using: "composite"
1616
steps:
17-
# --- 1. Restore Vcpkg ---
18-
- name: Restore Vcpkg
19-
id: vcpkg
20-
uses: ./.github/actions/restore-cache
21-
with:
22-
path: vcpkg_installed
23-
key: vcpkg-${{ inputs.cache_prefix }}-${{ inputs.compiler }}-${{ inputs.backend }}-${{ hashFiles('vcpkg.json') }}
24-
global-tag: vcpkg-${{ inputs.cache_prefix }}-${{ inputs.compiler }}-${{ inputs.backend }}
25-
gh-token: ${{ github.token }}
26-
27-
# --- 2. Configure ---
17+
# --- 1. setup vcpkg cache ---
18+
- name: setup vcpkg
19+
uses: ./.github/actions/setup-vcpkg-cache
20+
21+
# --- 2. configure ---
2822
- name: Configure CMake
2923
shell: bash
3024
run: |
3125
[ -f ci/CMakeUserPresets.json ] && cp ci/CMakeUserPresets.json CMakeUserPresets.json
3226
cmake --preset ci_${{ inputs.compiler }}_af_${{ inputs.backend }}
3327
34-
# --- 3. Save Vcpkg ---
35-
- name: Save Vcpkg
36-
if: steps.vcpkg.outputs.cache-hit != 'true'
37-
uses: ./.github/actions/save-cache
38-
with:
39-
path: vcpkg_installed
40-
key: ${{ steps.vcpkg.outputs.primary-key }}
41-
global-tag: vcpkg-${{ inputs.cache_prefix }}-${{ inputs.compiler }}-${{ inputs.backend }}
42-
gh-token: ${{ github.token }}
43-
44-
# --- 4. Restore BuildCache ---
28+
# --- 4. restore BuildCache ---
4529
- name: Restore BuildCache
4630
id: buildcache
4731
uses: ./.github/actions/restore-cache
@@ -52,12 +36,12 @@ runs:
5236
global-tag: buildcache-${{ inputs.cache_prefix }}-${{ inputs.compiler }}-${{ inputs.backend }}
5337
gh-token: ${{ github.token }}
5438

55-
# --- 5. Build ---
39+
# --- 5. build ---
5640
- name: Build
5741
shell: bash
5842
run: cmake --build --preset ci_${{ inputs.compiler }}_af_${{ inputs.backend }}
5943

60-
# --- 6. Save BuildCache ---
44+
# --- 6. save BuildCache ---
6145
- name: Save BuildCache
6246
if: always()
6347
uses: ./.github/actions/save-cache
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: 'Vcpkg Cache'
2+
description: 'sets up vcpkg to use NuGet for caching'
3+
inputs:
4+
gh-token:
5+
description: 'GitHub Token for GHCR auth'
6+
required: true
7+
default: ${{ github.token }}
8+
9+
runs:
10+
using: "composite"
11+
steps:
12+
# --- WINDOWS: (dotnet nuget) ---
13+
- name: setup vcpkg nuget source
14+
if: runner.os == 'Windows'
15+
shell: bash
16+
run: |
17+
dotnet nuget add source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" \
18+
--name "GitHub" \
19+
--username "${{ github.repository_owner }}" \
20+
--password "${{ inputs.gh-token }}" \
21+
--store-password-in-clear-text
22+
23+
# --- other: (mono + nuget.exe) ---
24+
- name: setup vcpkg nuget source
25+
if: runner.os != 'Windows'
26+
shell: bash
27+
run: |
28+
# download nuget.exe
29+
wget -qO nuget.exe https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
30+
NUGET_PATH="$(pwd)/nuget.exe"
31+
32+
# add source
33+
mono "$NUGET_PATH" sources add \
34+
-Name "GitHub" \
35+
-Source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" \
36+
-UserName "${{ github.repository_owner }}" \
37+
-Password "${{ inputs.gh-token }}" \
38+
-StorePasswordInClearText
39+
40+
# set API key for push
41+
mono "$NUGET_PATH" setapikey "${{ inputs.gh-token }}" \
42+
-Source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"

ci/CMakeUserPresets.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
"hidden": true,
77
"cacheVariables": {
88
"VCPKG_INSTALLED_DIR": "${sourceDir}/vcpkg_installed"
9+
},
10+
"environment": {
11+
"VCPKG_BINARY_SOURCES" : "clear;nuget,GitHub,readwrite"
912
}
1013
},
1114
{

ci/docker/linux/Dockerfile.cpu

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ RUN pacman -Syu --noconfirm && \
1212
vcpkg \
1313
wget \
1414
cloc \
15+
mono \
1516
buildcache-git
1617

1718
ENV VCPKG_ROOT=/opt/vcpkg

ci/docker/linux/Dockerfile.cuda

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ RUN pacman -Syu --noconfirm && \
1414
vcpkg \
1515
wget \
1616
cloc \
17+
mono \
1718
buildcache-git
1819

1920
ENV VCPKG_ROOT=/opt/vcpkg

0 commit comments

Comments
 (0)