Skip to content

Commit

Permalink
Add new CI step for lint validation (#4903)
Browse files Browse the repository at this point in the history
* fix lint error

* add new CI step for lint

* commit change after lint

* add missing dependency of makefile rule

* address comments: remove excessive artifact paths
  • Loading branch information
shijiesheng authored Jul 18, 2022
1 parent b0d1f06 commit 25e221b
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 5 deletions.
14 changes: 14 additions & 0 deletions .buildkite/pipeline-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@ steps:
run: unit-test
config: docker/buildkite/docker-compose.yml

- label: ":golangci-lint: validate code is clean"
agents:
queue: "workers"
docker: "*"
command: "./scripts/buildkite/golint.sh"
artifact_paths: []
retry:
automatic:
limit: 1
plugins:
- docker-compose#v3.0.0:
run: unit-test
config: docker/buildkite/docker-compose.yml

- label: ":golang: integration test with cassandra"
agents:
queue: "workers"
Expand Down
14 changes: 14 additions & 0 deletions .buildkite/pipeline-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@ steps:
run: unit-test
config: docker/buildkite/docker-compose.yml

- label: ":golangci-lint: validate code is clean"
agents:
queue: "workers"
docker: "*"
command: "./scripts/buildkite/golint.sh"
artifact_paths: []
retry:
automatic:
limit: 1
plugins:
- docker-compose#v3.0.0:
run: unit-test
config: docker/buildkite/docker-compose.yml

- label: ":golang: integration test with cassandra"
agents:
queue: "workers"
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ lint: ## (re)run the linter
fmt: $(BUILD)/fmt ## run goimports

# not identical to the intermediate target, but does provide the same codegen (or more).
copyright: $(BIN)/copyright ## update copyright headers
copyright: $(BIN)/copyright | $(BUILD) ## update copyright headers
$(BIN)/copyright
$Q touch $(BUILD)/copyright

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions common/reconciliation/invariant/collection_enumer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions proto/buf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,9 @@ build:
lint: # Uber style rules: https://docs.buf.build/migration-prototool/#uber1-uber2
use:
- DEFAULT
ignore_only:
FIELD_LOWER_SNAKE_CASE:
- uber/cadence/history/v1/service.proto
- uber/cadence/matching/v1/service.proto
enum_zero_value_suffix: _INVALID
service_suffix: API
12 changes: 12 additions & 0 deletions scripts/buildkite/golint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

set -ex

make go-generate && make fmt && make lint && make copyright

if [ -n "$(git status --porcelain)" ]; then
echo "There are changes after make go-generate && make fmt && make lint && make copyright"
echo "Please rerun the command and commit the changes"
git status --porcelain
exit 1
fi
4 changes: 2 additions & 2 deletions service/worker/scanner/executions/scantype_enumer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 25e221b

Please sign in to comment.