Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update global workflows #37

Merged
merged 4 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 53 additions & 10 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,34 @@
# Generated from CLion C/C++ Code Style settings
BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: DontAlign
AlignConsecutiveAssignments: false
AlignAfterOpenBracket: BlockIndent
AlignConsecutiveAssignments: None
AlignEscapedNewlines: DontAlign
AlignOperands: Align
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Always
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortLambdasOnASingleLine: All
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: None
AllowShortLoopsOnASingleLine: true
AlignTrailingComments: false
AlwaysBreakAfterReturnType: All
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: MultiLine
BreakBeforeBraces: Custom
BinPackArguments: false
BinPackParameters: false
BracedInitializerIndentWidth: 2
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterExternBlock: true
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
Expand All @@ -36,39 +43,75 @@ BraceWrapping:
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: true
BreakArrays: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: false
BreakConstructorInitializers: AfterColon
BreakInheritanceList: AfterColon
ColumnLimit: 0
CompactNamespaces: false
ContinuationIndentWidth: 2
Cpp11BracedListStyle: true
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: Always
ExperimentalAutoDetectBinPacking: true
FixNamespaceComments: true
IncludeBlocks: Regroup
IndentAccessModifiers: false
IndentCaseBlocks: true
IndentCaseLabels: true
IndentExternBlock: Indent
IndentGotoLabels: true
IndentPPDirectives: BeforeHash
IndentWidth: 2
IndentWrappedFunctionNames: true
InsertBraces: true
InsertNewlineAtEOF: true
KeepEmptyLinesAtTheStartOfBlocks: false
LineEnding: LF
MaxEmptyLinesToKeep: 1
NamespaceIndentation: All
ObjCBinPackProtocolList: Never
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
PackConstructorInitializers: Never
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 1
PenaltyBreakString: 1
PenaltyBreakFirstLessLess: 0
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 100000000
PointerAlignment: Right
ReferenceAlignment: Pointer
ReflowComments: true
RemoveBracesLLVM: false
RemoveSemicolon: false
SeparateDefinitionBlocks: Always
SortIncludes: CaseInsensitive
SortUsingDeclarations: Lexicographic
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: true
SpaceBeforeCtorInitializerColon: false
SpaceBeforeInheritanceColon: false
SpaceBeforeJsonColon: false
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: Never
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInLineCommentPrefix:
Maximum: 3
Minimum: 1
SpacesInParentheses: false
SpacesInSquareBrackets: false
TabWidth: 2
Cpp11BracedListStyle: false
UseTab: Never
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@

version: 2
updates:
- package-ecosystem: "cargo"
directory: "/"
schedule:
interval: "daily"
time: "07:30"
open-pull-requests-limit: 10

- package-ecosystem: "docker"
directory: "/"
schedule:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ jobs:
# Doxygen from Ubuntu is too old, need Doxygen >= 1.10
DOCS=OFF
else
DOCS=ON
# Doxygen 1.13 is incompatible with doxygen-awesome-css
DOCS=OFF
fi

cmake \
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/common-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,28 @@ jobs:
exit 1
fi

- name: Rust - find Cargo.toml
id: run_cargo
if: always()
run: |
# check if Cargo.toml exists
if [ -f "Cargo.toml" ]; then
echo "found_cargo=true" >> $GITHUB_OUTPUT
else
echo "found_cargo=false" >> $GITHUB_OUTPUT
fi

- name: Rust - setup toolchain
if: always() && steps.run_cargo.outputs.found_cargo == 'true'
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt

- name: Rust - cargo fmt
if: always() && steps.run_cargo.outputs.found_cargo == 'true'
run: |
cargo fmt -- --check

- name: YAML - find files
id: yaml_files
if: always()
Expand Down
2 changes: 2 additions & 0 deletions scripts/update_clang_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
'tests',
]
file_types = [
'c',
'cpp',
'h',
'hpp',
'm',
'mm'
]
Expand Down
83 changes: 42 additions & 41 deletions src/example.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* @file src/example.c
* @brief Example usage of the tray library.
*/
// standard includes
#include <stdio.h>
#include <string.h>

Expand All @@ -13,6 +14,7 @@
#define TRAY_APPKIT 1
#endif

// local includes
#include "tray.h"

#if TRAY_APPINDICATOR
Expand All @@ -28,35 +30,30 @@

static struct tray tray;

static void
toggle_cb(struct tray_menu *item) {
static void toggle_cb(struct tray_menu *item) {

Check warning on line 33 in src/example.c

View check run for this annotation

Codecov / codecov/patch

src/example.c#L33

Added line #L33 was not covered by tests
printf("toggle cb\n");
item->checked = !item->checked;
tray_update(&tray);
}

static void
hello_cb(struct tray_menu *item) {
static void hello_cb(struct tray_menu *item) {

Check warning on line 39 in src/example.c

View check run for this annotation

Codecov / codecov/patch

src/example.c#L39

Added line #L39 was not covered by tests
(void) item;
printf("hello cb\n");
if (strcmp(tray.icon, TRAY_ICON1) == 0) {
tray.icon = TRAY_ICON2;
}
else {
} else {

Check warning on line 44 in src/example.c

View check run for this annotation

Codecov / codecov/patch

src/example.c#L44

Added line #L44 was not covered by tests
tray.icon = TRAY_ICON1;
}
tray_update(&tray);
}

static void
quit_cb(struct tray_menu *item) {
static void quit_cb(struct tray_menu *item) {

Check warning on line 50 in src/example.c

View check run for this annotation

Codecov / codecov/patch

src/example.c#L50

Added line #L50 was not covered by tests
(void) item;
printf("quit cb\n");
tray_exit();
}

static void
submenu_cb(struct tray_menu *item) {
static void submenu_cb(struct tray_menu *item) {

Check warning on line 56 in src/example.c

View check run for this annotation

Codecov / codecov/patch

src/example.c#L56

Added line #L56 was not covered by tests
(void) item;
printf("submenu: clicked on %s\n", item->text);
tray_update(&tray);
Expand All @@ -70,43 +67,47 @@
#endif
.menu =
(struct tray_menu[]) {
{ .text = "Hello", .cb = hello_cb },
{ .text = "Checked", .checked = 1, .checkbox = 1, .cb = toggle_cb },
{ .text = "Disabled", .disabled = 1 },
{ .text = "-" },
{ .text = "SubMenu",
.submenu =
(struct tray_menu[]) {
{ .text = "FIRST", .checked = 1, .checkbox = 1, .cb = submenu_cb },
{ .text = "SECOND",
.submenu =
(struct tray_menu[]) {
{ .text = "THIRD",
.submenu =
(struct tray_menu[]) {
{ .text = "7", .cb = submenu_cb },
{ .text = "-" },
{ .text = "8", .cb = submenu_cb },
{ .text = NULL } } },
{ .text = "FOUR",
.submenu =
(struct tray_menu[]) {
{ .text = "5", .cb = submenu_cb },
{ .text = "6", .cb = submenu_cb },
{ .text = NULL } } },
{ .text = NULL } } },
{ .text = NULL } } },
{ .text = "-" },
{ .text = "Quit", .cb = quit_cb },
{ .text = NULL } },
{.text = "Hello", .cb = hello_cb},
{.text = "Checked", .checked = 1, .checkbox = 1, .cb = toggle_cb},
{.text = "Disabled", .disabled = 1},
{.text = "-"},
{.text = "SubMenu",
.submenu =
(struct tray_menu[]) {
{.text = "FIRST", .checked = 1, .checkbox = 1, .cb = submenu_cb},
{.text = "SECOND",
.submenu =
(struct tray_menu[]) {
{.text = "THIRD",
.submenu =
(struct tray_menu[]) {
{.text = "7", .cb = submenu_cb},
{.text = "-"},
{.text = "8", .cb = submenu_cb},
{.text = NULL}
}},
{.text = "FOUR",
.submenu =
(struct tray_menu[]) {
{.text = "5", .cb = submenu_cb},
{.text = "6", .cb = submenu_cb},
{.text = NULL}
}},
{.text = NULL}
}},
{.text = NULL}
}},
{.text = "-"},
{.text = "Quit", .cb = quit_cb},
{.text = NULL}
},
};

/**
* @brief Main entry point.
* @return 0 on success, 1 on error.
*/
int
main() {
int main() {

Check warning on line 110 in src/example.c

View check run for this annotation

Codecov / codecov/patch

src/example.c#L110

Added line #L110 was not covered by tests
if (tray_init(&tray) < 0) {
printf("failed to create tray\n");
return 1;
Expand Down
Loading
Loading