diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index b6d8b2c..c1e9974 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,6 +1,6 @@ -## What does this PR do? +# What does this PR do? diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6a6b706..9deb1d8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,73 +1,12 @@ -name: "CI" -on: - push: - branches: - - master - pull_request: - branches: - - master - workflow_dispatch: - +name: pull-request +on: pull_request jobs: - - lint: - if: ${{ github.event_name != 'workflow_dispatch' }} + build: runs-on: ubuntu-latest - steps: - - name: checkout source - uses: actions/checkout@v3 - - - name: run protolint - uses: plexsystems/protolint-action@v0.2.0 - with: - configDirectory: . - - release: - if: ${{ github.event_name == 'workflow_dispatch' }} - runs-on: ubuntu-latest - - steps: - - name: checkout source - uses: actions/checkout@v3 - - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: 3.x - - - name: Cache python libs - uses: actions/cache@v3 - id: cache-pip # needed in if test - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip - - - name: Upgrade python tools - shell: bash - run: | - python -m pip install --upgrade pip - - - name: Get release version string - run: echo "version=$(./scripts/buildinfo.py short)" >> $GITHUB_OUTPUT - id: version - - - name: Create release - uses: actions/create-release@v1 - id: create_release - with: - release_name: Meshtastic Protobufs ${{ steps.version.outputs.version }} - tag_name: v${{ steps.version.outputs.version }} - body: Protobufs for version ${{ steps.version.outputs.version }} release of Meshtastic firmware - env: - GITHUB_TOKEN: ${{ github.token }} - - - name: Bump version.properties - run: >- - scripts/bump_version.py - - - name: Create version.properties pull request - uses: peter-evans/create-pull-request@v3 - with: - add-paths: | - version.properties \ No newline at end of file + - uses: actions/checkout@v2 + - uses: bufbuild/buf-setup-action@v1 + - uses: bufbuild/buf-lint-action@v1 + - uses: bufbuild/buf-breaking-action@v1 + with: + against: "https://github.com/${GITHUB_REPOSITORY}.git#branch=master" diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml new file mode 100644 index 0000000..ff8c73f --- /dev/null +++ b/.github/workflows/create_release.yml @@ -0,0 +1,72 @@ +name: "CI" +on: + push: + branches: + - master + pull_request: + branches: + - master + workflow_dispatch: + +jobs: + lint: + if: ${{ github.event_name != 'workflow_dispatch' }} + runs-on: ubuntu-latest + + steps: + - name: checkout source + uses: actions/checkout@v3 + + - name: run protolint + uses: plexsystems/protolint-action@v0.2.0 + with: + configDirectory: . + + release: + if: ${{ github.event_name == 'workflow_dispatch' }} + runs-on: ubuntu-latest + + steps: + - name: checkout source + uses: actions/checkout@v3 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: 3.x + + - name: Cache python libs + uses: actions/cache@v3 + id: cache-pip # needed in if test + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip + + - name: Upgrade python tools + shell: bash + run: | + python -m pip install --upgrade pip + + - name: Get release version string + run: echo "version=$(./scripts/buildinfo.py short)" >> $GITHUB_OUTPUT + id: version + + - name: Create release + uses: actions/create-release@v1 + id: create_release + with: + release_name: Meshtastic Protobufs ${{ steps.version.outputs.version }} + tag_name: v${{ steps.version.outputs.version }} + body: Protobufs for version ${{ steps.version.outputs.version }} release of Meshtastic firmware + env: + GITHUB_TOKEN: ${{ github.token }} + + - name: Bump version.properties + run: >- + scripts/bump_version.py + + - name: Create version.properties pull request + uses: peter-evans/create-pull-request@v3 + with: + add-paths: | + version.properties diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 0000000..d9d52a2 --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,19 @@ +name: Nightly +on: + schedule: + - cron: 0 8 * * 1-5 + workflow_dispatch: {} + +jobs: + trunk_check: + name: Trunk Check Upload + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Trunk Check + uses: trunk-io/trunk-action@v1 + with: + trunk-token: ${{ secrets.TRUNK_TOKEN }} diff --git a/.github/workflows/update_docs.yml b/.github/workflows/update_docs.yml deleted file mode 100644 index 0a085ed..0000000 --- a/.github/workflows/update_docs.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Update docs -on: - push: - branches: - - master - -jobs: - - update-docs: - environment: Production - runs-on: ubuntu-latest - - steps: - - name: Update Docs - uses: benc-uk/workflow-dispatch@v1 - with: - workflow: "Update protobufs" - repo: meshtastic/meshtastic - token: ${{ secrets.ACCESS_TOKEN }} diff --git a/.protolint.yaml b/.protolint.yaml deleted file mode 100644 index f681e62..0000000 --- a/.protolint.yaml +++ /dev/null @@ -1,20 +0,0 @@ ---- -lint: - - rules: - - remove: - - ENUM_FIELD_NAMES_PREFIX - - ENUM_FIELD_NAMES_UPPER_SNAKE_CASE - - ENUM_NAMES_UPPER_CAMEL_CASE - - FIELD_NAMES_LOWER_SNAKE_CASE - - ENUM_FIELD_NAMES_ZERO_VALUE_END_WITH - - REPEATED_FIELD_NAMES_PLURALIZED - - ORDER - - rules_option: - max_line_length: - max_chars: 180 - - indent: - style: 2 diff --git a/.trunk/.gitignore b/.trunk/.gitignore new file mode 100644 index 0000000..cf2f254 --- /dev/null +++ b/.trunk/.gitignore @@ -0,0 +1,7 @@ +*out +*logs +*actions +*notifications +plugins +user_trunk.yaml +user.yaml diff --git a/.trunk/configs/.markdownlint.yaml b/.trunk/configs/.markdownlint.yaml new file mode 100644 index 0000000..fb94039 --- /dev/null +++ b/.trunk/configs/.markdownlint.yaml @@ -0,0 +1,10 @@ +# 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/trunk.yaml b/.trunk/trunk.yaml new file mode 100644 index 0000000..4c10872 --- /dev/null +++ b/.trunk/trunk.yaml @@ -0,0 +1,28 @@ +version: 0.1 +cli: + version: 1.3.1 +plugins: + sources: + - id: trunk + ref: v0.0.8 + uri: https://github.com/trunk-io/plugins +lint: + enabled: + - buf-lint@1.12.0 + - buf-breaking@1.12.0 + - actionlint@1.6.22 + - markdownlint@0.33.0 + - prettier@2.8.3 + - gitleaks@8.15.2 + - git-diff-check +runtimes: + enabled: + - go@1.18.3 + - 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 3dd642c..4a9f50e 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,3 +1,3 @@ { - "recommendations": ["zxh404.vscode-proto3", "plex.vscode-protolint"] + "recommendations": ["trunk.io", "pbkit.vscode-pbkit"] } diff --git a/.vscode/settings.json b/.vscode/settings.json index cad7657..3b48997 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,4 @@ { - "cmake.configureOnOpen": false -} \ No newline at end of file + "editor.formatOnSave": true, + "editor.defaultFormatter": "trunk.io" +} diff --git a/README.md b/README.md index 771dfa3..447383e 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ The [Protobuf](https://developers.google.com/protocol-buffers) message definitions for the Meshtastic project (used by apps and the device firmware). -**[Documentation/API Reference](https://meshtastic.org/docs/developers/protobufs/api)** +**[Documentation/API Reference](https://buf.build/meshtastic/protobufs)** ## Stats diff --git a/buf.yaml b/buf.yaml new file mode 100644 index 0000000..876ff3f --- /dev/null +++ b/buf.yaml @@ -0,0 +1,11 @@ +version: v1 +name: "buf.build/meshtastic/protobufs" +deps: [] +build: + excludes: [] +breaking: + use: + - FILE +lint: + use: + - MINIMAL diff --git a/admin.options b/meshtastic/admin.options similarity index 100% rename from admin.options rename to meshtastic/admin.options diff --git a/admin.proto b/meshtastic/admin.proto similarity index 96% rename from admin.proto rename to meshtastic/admin.proto index 8b203d9..3b21d5d 100644 --- a/admin.proto +++ b/meshtastic/admin.proto @@ -1,18 +1,19 @@ syntax = "proto3"; +package meshtastic; + option java_package = "com.geeksville.mesh"; option optimize_for = LITE_RUNTIME; option go_package = "github.com/meshtastic/go/generated"; option csharp_namespace = "Meshtastic.Protobufs"; - -import "channel.proto"; -import "config.proto"; -import "device_metadata.proto"; -import "mesh.proto"; -import "module_config.proto"; - option java_outer_classname = "AdminProtos"; +import "meshtastic/channel.proto"; +import "meshtastic/config.proto"; +import "meshtastic/device_metadata.proto"; +import "meshtastic/mesh.proto"; +import "meshtastic/module_config.proto"; + /* * This message is handled by the Admin module and is responsible for all settings/channel read/write operations. * This message is used to do settings operations to both remote AND local nodes. diff --git a/apponly.options b/meshtastic/apponly.options similarity index 100% rename from apponly.options rename to meshtastic/apponly.options diff --git a/apponly.proto b/meshtastic/apponly.proto similarity index 89% rename from apponly.proto rename to meshtastic/apponly.proto index be58039..7057fa0 100644 --- a/apponly.proto +++ b/meshtastic/apponly.proto @@ -1,15 +1,16 @@ syntax = "proto3"; +package meshtastic; + option java_package = "com.geeksville.mesh"; option optimize_for = LITE_RUNTIME; option go_package = "github.com/meshtastic/go/generated"; option csharp_namespace = "Meshtastic.Protobufs"; - -import "channel.proto"; -import "config.proto"; - option java_outer_classname = "AppOnlyProtos"; +import "meshtastic/channel.proto"; +import "meshtastic/config.proto"; + /* * This is the most compact possible representation for a set of channels. * It includes only one PRIMARY channel (which must be first) and diff --git a/cannedmessages.options b/meshtastic/cannedmessages.options similarity index 100% rename from cannedmessages.options rename to meshtastic/cannedmessages.options diff --git a/cannedmessages.proto b/meshtastic/cannedmessages.proto similarity index 95% rename from cannedmessages.proto rename to meshtastic/cannedmessages.proto index e0ea3d9..ba46487 100644 --- a/cannedmessages.proto +++ b/meshtastic/cannedmessages.proto @@ -1,5 +1,7 @@ syntax = "proto3"; +package meshtastic; + option java_package = "com.geeksville.mesh"; option java_outer_classname = "CannedMessageConfigProtos"; option optimize_for = LITE_RUNTIME; diff --git a/channel.options b/meshtastic/channel.options similarity index 100% rename from channel.options rename to meshtastic/channel.options diff --git a/channel.proto b/meshtastic/channel.proto similarity index 99% rename from channel.proto rename to meshtastic/channel.proto index 18ef287..1ac4f23 100644 --- a/channel.proto +++ b/meshtastic/channel.proto @@ -1,10 +1,10 @@ syntax = "proto3"; -option java_package = "com.geeksville.mesh"; +package meshtastic; +option java_package = "com.geeksville.mesh"; option optimize_for = LITE_RUNTIME; option go_package = "github.com/meshtastic/go/generated"; - option java_outer_classname = "ChannelProtos"; option csharp_namespace = "Meshtastic.Protobufs"; diff --git a/config.options b/meshtastic/config.options similarity index 100% rename from config.options rename to meshtastic/config.options diff --git a/config.proto b/meshtastic/config.proto similarity index 99% rename from config.proto rename to meshtastic/config.proto index 72a5867..4ba2ee1 100644 --- a/config.proto +++ b/meshtastic/config.proto @@ -1,5 +1,7 @@ syntax = "proto3"; +package meshtastic; + option java_package = "com.geeksville.mesh"; option java_outer_classname = "ConfigProtos"; option optimize_for = LITE_RUNTIME; diff --git a/device_metadata.options b/meshtastic/device_metadata.options similarity index 100% rename from device_metadata.options rename to meshtastic/device_metadata.options diff --git a/device_metadata.proto b/meshtastic/device_metadata.proto similarity index 97% rename from device_metadata.proto rename to meshtastic/device_metadata.proto index ee73d83..795addf 100644 --- a/device_metadata.proto +++ b/meshtastic/device_metadata.proto @@ -1,9 +1,10 @@ syntax = "proto3"; +package meshtastic; + option java_package = "com.geeksville.mesh"; option optimize_for = LITE_RUNTIME; option go_package = "github.com/meshtastic/go/generated"; - option java_outer_classname = "DeviceMetadataProtos"; option csharp_namespace = "Meshtastic.Protobufs"; diff --git a/deviceonly.options b/meshtastic/deviceonly.options similarity index 100% rename from deviceonly.options rename to meshtastic/deviceonly.options diff --git a/deviceonly.proto b/meshtastic/deviceonly.proto similarity index 97% rename from deviceonly.proto rename to meshtastic/deviceonly.proto index a7e1f0d..39a9247 100644 --- a/deviceonly.proto +++ b/meshtastic/deviceonly.proto @@ -1,15 +1,16 @@ syntax = "proto3"; +package meshtastic; + option java_package = "com.geeksville.mesh"; option optimize_for = LITE_RUNTIME; option go_package = "github.com/meshtastic/go/generated"; - -import "channel.proto"; -import "mesh.proto"; - option java_outer_classname = "DeviceOnly"; option csharp_namespace = "Meshtastic.Protobufs"; +import "meshtastic/channel.proto"; +import "meshtastic/mesh.proto"; + /* * This message is never sent over the wire, but it is used for serializing DB * state to flash in the device code diff --git a/localonly.proto b/meshtastic/localonly.proto similarity index 96% rename from localonly.proto rename to meshtastic/localonly.proto index 46c83d8..2986943 100644 --- a/localonly.proto +++ b/meshtastic/localonly.proto @@ -1,15 +1,16 @@ syntax = "proto3"; +package meshtastic; + option java_package = "com.geeksville.mesh"; option optimize_for = LITE_RUNTIME; option go_package = "github.com/meshtastic/go/generated"; - -import "config.proto"; -import "module_config.proto"; - option java_outer_classname = "LocalOnlyProtos"; option csharp_namespace = "Meshtastic.Protobufs"; +import "meshtastic/config.proto"; +import "meshtastic/module_config.proto"; + /* * Protobuf structures common to apponly.proto and deviceonly.proto * This is never sent over the wire, only for local use diff --git a/mesh.options b/meshtastic/mesh.options similarity index 100% rename from mesh.options rename to meshtastic/mesh.options diff --git a/mesh.proto b/meshtastic/mesh.proto similarity index 99% rename from mesh.proto rename to meshtastic/mesh.proto index c9a2251..67dc362 100644 --- a/mesh.proto +++ b/meshtastic/mesh.proto @@ -1,18 +1,19 @@ syntax = "proto3"; +package meshtastic; + option java_package = "com.geeksville.mesh"; option optimize_for = LITE_RUNTIME; option go_package = "github.com/meshtastic/go/generated"; - -import "channel.proto"; -import "config.proto"; -import "module_config.proto"; -import "portnums.proto"; -import "telemetry.proto"; - option java_outer_classname = "MeshProtos"; option csharp_namespace = "Meshtastic.Protobufs"; +import "meshtastic/channel.proto"; +import "meshtastic/config.proto"; +import "meshtastic/module_config.proto"; +import "meshtastic/portnums.proto"; +import "meshtastic/telemetry.proto"; + /* * a gps position */ diff --git a/module_config.options b/meshtastic/module_config.options similarity index 100% rename from module_config.options rename to meshtastic/module_config.options diff --git a/module_config.proto b/meshtastic/module_config.proto similarity index 99% rename from module_config.proto rename to meshtastic/module_config.proto index 4b4ad87..3a4f080 100644 --- a/module_config.proto +++ b/meshtastic/module_config.proto @@ -1,5 +1,7 @@ syntax = "proto3"; +package meshtastic; + option java_package = "com.geeksville.mesh"; option java_outer_classname = "ModuleConfigProtos"; option optimize_for = LITE_RUNTIME; diff --git a/mqtt.options b/meshtastic/mqtt.options similarity index 100% rename from mqtt.options rename to meshtastic/mqtt.options diff --git a/mqtt.proto b/meshtastic/mqtt.proto similarity index 93% rename from mqtt.proto rename to meshtastic/mqtt.proto index 9b491e7..610a15c 100644 --- a/mqtt.proto +++ b/meshtastic/mqtt.proto @@ -1,14 +1,15 @@ syntax = "proto3"; +package meshtastic; + option java_package = "com.geeksville.mesh"; option optimize_for = LITE_RUNTIME; option go_package = "github.com/meshtastic/go/generated"; - -import "mesh.proto"; - option java_outer_classname = "MQTTProtos"; option csharp_namespace = "Meshtastic.Protobufs"; +import "meshtastic/mesh.proto"; + /* * This message wraps a MeshPacket with extra metadata about the sender and how it arrived. */ diff --git a/portnums.proto b/meshtastic/portnums.proto similarity index 99% rename from portnums.proto rename to meshtastic/portnums.proto index 4b0ddf4..d37d6bf 100644 --- a/portnums.proto +++ b/meshtastic/portnums.proto @@ -1,5 +1,7 @@ syntax = "proto3"; +package meshtastic; + option java_package = "com.geeksville.mesh"; option java_outer_classname = "Portnums"; option optimize_for = LITE_RUNTIME; diff --git a/remote_hardware.proto b/meshtastic/remote_hardware.proto similarity index 98% rename from remote_hardware.proto rename to meshtastic/remote_hardware.proto index 3340a31..89a8e6b 100644 --- a/remote_hardware.proto +++ b/meshtastic/remote_hardware.proto @@ -1,5 +1,7 @@ syntax = "proto3"; +package meshtastic; + option java_package = "com.geeksville.mesh"; option java_outer_classname = "RemoteHardware"; option optimize_for = LITE_RUNTIME; diff --git a/rtttl.options b/meshtastic/rtttl.options similarity index 100% rename from rtttl.options rename to meshtastic/rtttl.options diff --git a/rtttl.proto b/meshtastic/rtttl.proto similarity index 95% rename from rtttl.proto rename to meshtastic/rtttl.proto index 2655c10..44c3dd2 100644 --- a/rtttl.proto +++ b/meshtastic/rtttl.proto @@ -1,5 +1,7 @@ syntax = "proto3"; +package meshtastic; + option java_package = "com.geeksville.mesh"; option java_outer_classname = "RTTTLConfigProtos"; option optimize_for = LITE_RUNTIME; diff --git a/storeforward.proto b/meshtastic/storeforward.proto similarity index 99% rename from storeforward.proto rename to meshtastic/storeforward.proto index 74bf606..3af5ac9 100644 --- a/storeforward.proto +++ b/meshtastic/storeforward.proto @@ -1,5 +1,7 @@ syntax = "proto3"; +package meshtastic; + option java_package = "com.geeksville.mesh"; option java_outer_classname = "StoreAndForwardProtos"; option optimize_for = LITE_RUNTIME; diff --git a/telemetry.options b/meshtastic/telemetry.options similarity index 100% rename from telemetry.options rename to meshtastic/telemetry.options diff --git a/telemetry.proto b/meshtastic/telemetry.proto similarity index 93% rename from telemetry.proto rename to meshtastic/telemetry.proto index 3d210cf..2fc81b9 100644 --- a/telemetry.proto +++ b/meshtastic/telemetry.proto @@ -1,9 +1,10 @@ syntax = "proto3"; +package meshtastic; + option java_package = "com.geeksville.mesh"; option optimize_for = LITE_RUNTIME; option go_package = "github.com/meshtastic/go/generated"; - option java_outer_classname = "TelemetryProtos"; option csharp_namespace = "Meshtastic.Protobufs";