Skip to content

Commit af9734f

Browse files
committed
Added lint and format as Taskfile targets
1 parent aecae6f commit af9734f

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

Diff for: .github/workflows/test.yaml

+13-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Install Go
2323
uses: actions/setup-go@v2
2424
with:
25-
go-version: "1.14"
25+
go-version: "1.16"
2626

2727
- name: Install Go deps
2828
# Since 10/23/2019 pwsh is the default shell
@@ -50,16 +50,27 @@ jobs:
5050
- name: Install Poetry
5151
run: pip install poetry
5252

53+
- name: Install buf (protoc linter)
54+
if: runner.os == 'Linux'
55+
run: |
56+
go install github.com/bufbuild/buf/cmd/buf@latest
57+
go install github.com/bufbuild/buf/cmd/protoc-gen-buf-breaking@latest
58+
go install github.com/bufbuild/buf/cmd/protoc-gen-buf-lint@latest
59+
shell: bash
60+
5361
- name: Check the code is good
62+
if: runner.os == 'Linux'
5463
run: task check
5564

5665
- name: Install protoc compiler
66+
if: runner.os == 'Linux'
5767
uses: arduino/setup-protoc@v1
5868
with:
5969
repo-token: ${{ secrets.GITHUB_TOKEN }}
6070

6171
- name: Check protocol buffers compile correctly
62-
run: task protoc
72+
if: runner.os == 'Linux'
73+
run: task protoc:compile
6374

6475
- name: Build the CLI
6576
run: task build

Diff for: Taskfile.yml

+18
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,13 @@ tasks:
7777
- npx {{ .PRETTIER }} --write "**/*.md"
7878

7979
protoc:
80+
desc: Lint, format and compile protobuf definitions
81+
deps:
82+
- protoc:check
83+
- protoc:format
84+
- protoc:compile
85+
86+
protoc:compile:
8087
desc: Compile protobuf definitions
8188
cmds:
8289
- '{{ default "protoc" .PROTOC_BINARY }} --proto_path=rpc --go_out=plugins=grpc,paths=source_relative:rpc ./rpc/cc/arduino/cli/commands/v1/*.proto'
@@ -92,6 +99,16 @@ tasks:
9299
- '{{ default "protoc" .PROTOC_BINARY }} --doc_out=./docs/rpc --doc_opt=markdown,settings.md --proto_path=rpc ./rpc/cc/arduino/cli/settings/v1/*.proto'
93100
- '{{ default "protoc" .PROTOC_BINARY }} --doc_out=./docs/rpc --doc_opt=markdown,debug.md --proto_path=rpc ./rpc/cc/arduino/cli/debug/v1/*.proto'
94101

102+
protoc:check:
103+
desc: Perform linting of the protobuf definitions
104+
cmds:
105+
- buf lint rpc
106+
107+
protoc:format:
108+
desc: Perform formatting of the protobuf definitions
109+
cmds:
110+
- clang-format -i rpc/cc/arduino/cli/*/*/*.proto
111+
95112
build:
96113
desc: Build the project
97114
cmds:
@@ -134,6 +151,7 @@ tasks:
134151
- task: python:check
135152
- task: docs:check
136153
- task: config:check
154+
- task: protoc:check
137155

138156
config:check:
139157
desc: Check linting of configuration and supporting files

Diff for: rpc/buf.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ lint:
44
ENUM_ZERO_VALUE_SUFFIX:
55
- cc/arduino/cli/commands/v1/lib.proto
66
- cc/arduino/cli/monitor/v1/monitor.proto
7+
RPC_REQUEST_STANDARD_NAME:
8+
- cc/arduino/cli/debug/v1/debug.proto

0 commit comments

Comments
 (0)