From 2982d3017bd0c2db5046b4c9678847467b5e5015 Mon Sep 17 00:00:00 2001 From: Sacha Weatherstone Date: Fri, 29 Mar 2024 19:20:16 +1000 Subject: [PATCH] cleanup & update actions --- .github/workflows/ci.yml | 4 +- .github/workflows/create_tag.yml | 4 +- .github/workflows/publish.yml | 2 +- .github/workflows/pull_request.yml | 6 +-- .trunk/.gitignore | 8 ---- .trunk/configs/.markdownlint.yaml | 10 ----- .trunk/configs/.yamllint.yaml | 10 ----- .trunk/trunk.yaml | 33 -------------- .vscode/extensions.json | 2 +- .vscode/settings.json | 2 +- nanopb.proto | 71 +++++++++++++++--------------- 11 files changed, 45 insertions(+), 107 deletions(-) delete mode 100644 .trunk/.gitignore delete mode 100644 .trunk/configs/.markdownlint.yaml delete mode 100644 .trunk/configs/.yamllint.yaml delete mode 100644 .trunk/trunk.yaml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9322ba5..1023c96 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,11 +17,11 @@ jobs: uses: actions/checkout@v4 - name: Setup Buf - uses: bufbuild/buf-setup-action@v1.26.1 + uses: bufbuild/buf-setup-action@v1.30.0 with: github_token: ${{ github.token }} - name: Push to schema registry - uses: bufbuild/buf-push-action@v1.1.1 + uses: bufbuild/buf-push-action@v1.2.0 with: buf_token: ${{ secrets.BUF_TOKEN }} diff --git a/.github/workflows/create_tag.yml b/.github/workflows/create_tag.yml index 482ea79..e8233c7 100644 --- a/.github/workflows/create_tag.yml +++ b/.github/workflows/create_tag.yml @@ -50,7 +50,7 @@ jobs: echo "NEW_VERSION=v$MAJOR.$MINOR.$PATCH" >> $GITHUB_OUTPUT - name: Create release - uses: ncipollo/release-action@v1.13.0 + uses: ncipollo/release-action@v1 with: name: Meshtastic Protobufs ${{ steps.version.outputs.NEW_VERSION }} tag: ${{ steps.version.outputs.NEW_VERSION }} @@ -58,7 +58,7 @@ jobs: token: ${{ github.token }} - name: Setup Buf - uses: bufbuild/buf-setup-action@v1.26.1 + uses: bufbuild/buf-setup-action@v1.30.0 with: github_token: ${{ github.token }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a54687d..8ea8360 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -17,7 +17,7 @@ jobs: uses: actions/checkout@v4 - name: Setup Buf - uses: bufbuild/buf-setup-action@v1.26.1 + uses: bufbuild/buf-setup-action@v1.30.0 with: github_token: ${{ github.token }} diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 598c808..11232ca 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -13,15 +13,15 @@ jobs: uses: actions/checkout@v4 - name: Setup Buf - uses: bufbuild/buf-setup-action@v1.26.1 + uses: bufbuild/buf-setup-action@v1.30.0 with: github_token: ${{ github.token }} - name: Lint - uses: bufbuild/buf-lint-action@v1.0.3 + uses: bufbuild/buf-lint-action@v1.1.1 - name: Push to schema registry - uses: bufbuild/buf-push-action@v1.1.1 + uses: bufbuild/buf-push-action@v1.2.0 with: buf_token: ${{ secrets.BUF_TOKEN }} draft: ${{ github.ref_name != 'master'}} diff --git a/.trunk/.gitignore b/.trunk/.gitignore deleted file mode 100644 index 1e24652..0000000 --- a/.trunk/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -*out -*logs -*actions -*notifications -*tools -plugins -user_trunk.yaml -user.yaml diff --git a/.trunk/configs/.markdownlint.yaml b/.trunk/configs/.markdownlint.yaml deleted file mode 100644 index fb94039..0000000 --- a/.trunk/configs/.markdownlint.yaml +++ /dev/null @@ -1,10 +0,0 @@ -# Autoformatter friendly markdownlint config (all formatting rules disabled) -default: true -blank_lines: false -bullet: false -html: false -indentation: false -line_length: false -spaces: false -url: false -whitespace: false diff --git a/.trunk/configs/.yamllint.yaml b/.trunk/configs/.yamllint.yaml deleted file mode 100644 index 4d44466..0000000 --- a/.trunk/configs/.yamllint.yaml +++ /dev/null @@ -1,10 +0,0 @@ -rules: - quoted-strings: - required: only-when-needed - extra-allowed: ["{|}"] - empty-values: - forbid-in-block-mappings: true - forbid-in-flow-mappings: true - key-duplicates: {} - octal-values: - forbid-implicit-octal: true diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml deleted file mode 100644 index acdfaad..0000000 --- a/.trunk/trunk.yaml +++ /dev/null @@ -1,33 +0,0 @@ -version: 0.1 -cli: - version: 1.16.2 -plugins: - sources: - - id: trunk - ref: v1.2.5 - uri: https://github.com/trunk-io/plugins -lint: - enabled: - - checkov@2.4.9 - - trivy@0.45.1 - - trufflehog@3.57.0 - - yamllint@1.32.0 - - buf-lint@1.26.1 - - buf-breaking@1.26.1 - - actionlint@1.6.26 - - markdownlint@0.37.0 - - prettier@3.0.3 - - gitleaks@8.18.0 - - git-diff-check -runtimes: - enabled: - - python@3.10.8 - - go@1.21.0 - - node@18.12.1 -actions: - disabled: - - trunk-announce - - trunk-check-pre-push - - trunk-fmt-pre-commit - enabled: - - trunk-upgrade-available diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 56e433b..157b291 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,3 +1,3 @@ { - "recommendations": ["trunk.io", "pbkit.vscode-pbkit", "bufbuild.vscode-buf"] + "recommendations": ["pbkit.vscode-pbkit", "bufbuild.vscode-buf"] } diff --git a/.vscode/settings.json b/.vscode/settings.json index 3b48997..60415c3 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,4 @@ { "editor.formatOnSave": true, - "editor.defaultFormatter": "trunk.io" + "editor.defaultFormatter": "pbkit.vscode-pbkit" } diff --git a/nanopb.proto b/nanopb.proto index 5e36eaa..2f27e34 100644 --- a/nanopb.proto +++ b/nanopb.proto @@ -6,40 +6,41 @@ // for memory-limited environments. syntax = "proto2"; + import "google/protobuf/descriptor.proto"; option java_package = "fi.kapsi.koti.jpa.nanopb"; enum FieldType { - FT_DEFAULT = 0; // Automatically decide field type, generate static field if possible. - FT_CALLBACK = 1; // Always generate a callback field. - FT_POINTER = 4; // Always generate a dynamically allocated field. - FT_STATIC = 2; // Generate a static field or raise an exception if not possible. - FT_IGNORE = 3; // Ignore the field completely. - FT_INLINE = 5; // Legacy option, use the separate 'fixed_length' option instead + FT_DEFAULT = 0; // Automatically decide field type, generate static field if possible. + FT_CALLBACK = 1; // Always generate a callback field. + FT_POINTER = 4; // Always generate a dynamically allocated field. + FT_STATIC = 2; // Generate a static field or raise an exception if not possible. + FT_IGNORE = 3; // Ignore the field completely. + FT_INLINE = 5; // Legacy option, use the separate 'fixed_length' option instead } enum IntSize { - IS_DEFAULT = 0; // Default, 32/64bit based on type in .proto - IS_8 = 8; - IS_16 = 16; - IS_32 = 32; - IS_64 = 64; + IS_DEFAULT = 0; // Default, 32/64bit based on type in .proto + IS_8 = 8; + IS_16 = 16; + IS_32 = 32; + IS_64 = 64; } enum TypenameMangling { - M_NONE = 0; // Default, no typename mangling - M_STRIP_PACKAGE = 1; // Strip current package name - M_FLATTEN = 2; // Only use last path component - M_PACKAGE_INITIALS = 3; // Replace the package name by the initials + M_NONE = 0; // Default, no typename mangling + M_STRIP_PACKAGE = 1; // Strip current package name + M_FLATTEN = 2; // Only use last path component + M_PACKAGE_INITIALS = 3; // Replace the package name by the initials } enum DescriptorSize { - DS_AUTO = 0; // Select minimal size based on field type - DS_1 = 1; // 1 word; up to 15 byte fields, no arrays - DS_2 = 2; // 2 words; up to 4095 byte fields, 4095 entry arrays - DS_4 = 4; // 4 words; up to 2^32-1 byte fields, 2^16-1 entry arrays - DS_8 = 8; // 8 words; up to 2^32-1 entry arrays + DS_AUTO = 0; // Select minimal size based on field type + DS_1 = 1; // 1 word; up to 15 byte fields, no arrays + DS_2 = 2; // 2 words; up to 4095 byte fields, 4095 entry arrays + DS_4 = 4; // 4 words; up to 2^32-1 byte fields, 2^16-1 entry arrays + DS_8 = 8; // 8 words; up to 2^32-1 entry arrays } // This is the inner options message, which basically defines options for @@ -49,32 +50,32 @@ message NanoPBOptions { // Allocated size for 'bytes' and 'string' fields. // For string fields, this should include the space for null terminator. optional int32 max_size = 1; - + // Maximum length for 'string' fields. Setting this is equivalent // to setting max_size to a value of length+1. optional int32 max_length = 14; - + // Allocated number of entries in arrays ('repeated' fields) optional int32 max_count = 2; - + // Size of integer fields. Can save some memory if you don't need // full 32 bits for the value. optional IntSize int_size = 7 [default = IS_DEFAULT]; // Force type of field (callback or static allocation) optional FieldType type = 3 [default = FT_DEFAULT]; - + // Use long names for enums, i.e. EnumName_EnumValue. optional bool long_names = 4 [default = true]; - + // Add 'packed' attribute to generated structs. // Note: this cannot be used on CPUs that break on unaligned // accesses to variables. optional bool packed_struct = 5 [default = false]; - + // Add 'packed' attribute to generated enums. optional bool packed_enum = 10 [default = false]; - + // Skip this message optional bool skip_message = 6 [default = false]; @@ -89,7 +90,7 @@ message NanoPBOptions { // Proto3 singular field does not generate a "has_" flag optional bool proto3 = 12 [default = false]; - + // Force proto3 messages to have no "has_" flag. // This was default behavior until nanopb-0.4.0. optional bool proto3_singular_msgs = 21 [default = false]; @@ -139,7 +140,7 @@ message NanoPBOptions { // Package name that applies only for nanopb. optional string package = 25; - + // Override type of the field in generated C code. Only to be used with related field types optional google.protobuf.FieldDescriptorProto.Type type_override = 27; @@ -152,7 +153,7 @@ message NanoPBOptions { // A field that can become a static member of a c struct (e.g. int, bool, etc) // will be a a static field. // Fields with dynamic length are converted to either a pointer or a callback. - optional FieldType fallback_type = 29 [default = FT_CALLBACK]; + optional FieldType fallback_type = 29 [default = FT_CALLBACK]; } // Extensions to protoc 'Descriptor' type in order to define options @@ -167,19 +168,17 @@ message NanoPBOptions { // -------------------------------- extend google.protobuf.FileOptions { - optional NanoPBOptions nanopb_fileopt = 1010; + optional NanoPBOptions nanopb_fileopt = 1010; } extend google.protobuf.MessageOptions { - optional NanoPBOptions nanopb_msgopt = 1010; + optional NanoPBOptions nanopb_msgopt = 1010; } extend google.protobuf.EnumOptions { - optional NanoPBOptions nanopb_enumopt = 1010; + optional NanoPBOptions nanopb_enumopt = 1010; } extend google.protobuf.FieldOptions { - optional NanoPBOptions nanopb = 1010; + optional NanoPBOptions nanopb = 1010; } - -