diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 4703255357..558e23e0ba 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -30,7 +30,7 @@ steps: - label: "check generated" if: build.message !~ /\[doc\]/ command: - - ./tools/licensechecker.py $(find go acceptance -type f -iname '*.go') + - echo "--- go_deps.bzl" - mkdir -p /tmp/test-artifacts - cp go.mod go.sum go_deps.bzl /tmp/test-artifacts/ - make go_deps.bzl -B @@ -38,17 +38,22 @@ steps: - diff -u /tmp/test-artifacts/go.mod go.mod - diff -u /tmp/test-artifacts/go.sum go.sum - diff -u /tmp/test-artifacts/go_deps.bzl go_deps.bzl + - echo "--- protobuf" - cp -R pkg/proto/ /tmp/test-artifacts - make protobuf - diff -ur /tmp/test-artifacts/proto/ pkg/proto/ + - echo "--- licenses" - mkdir -p /tmp/test-artifacts/licenses - ./tools/licenses.sh /tmp/test-artifacts/licenses - diff -rNu3 /tmp/test-artifacts/licenses ./licenses/data + - echo "--- gomocks" - ./tools/gomocks.py diff + - echo "--- antlr" - rm -rf /tmp/test-artifacts/antlr - cp -R antlr/ /tmp/test-artifacts/antlr - make antlr - diff -ur /tmp/test-artifacts/antlr/ antlr/ + - echo "--- testdata" - ./tools/update_testdata.sh timeout_in_minutes: 20 key: check_generated diff --git a/tools/lint.sh b/tools/lint.sh index 37e1024b2f..2d2654f9f3 100755 --- a/tools/lint.sh +++ b/tools/lint.sh @@ -21,9 +21,8 @@ run_silently() { go_lint() { lint_header "go" local TMPDIR=$(mktemp -d /tmp/scion-lint.XXXXXXX) - local LOCAL_DIRS="$(find ./* -maxdepth 0 -type d )" # Find go files to lint, excluding generated code. For linelen and misspell. - find $LOCAL_DIRS -type f -iname '*.go' \ + find -type f -iname '*.go' \ -a '!' -ipath '*.pb.go' \ -a '!' -ipath '*.gen.go' \ -a '!' -ipath './antlr/*' \ @@ -42,7 +41,7 @@ go_lint() { # See: https://github.com/bazelbuild/rules_go/issues/511 # Instead we'll just run the commands from Go SDK directly. GOSDK=$(bazel info output_base 2>/dev/null)/external/go_sdk/bin - out=$($GOSDK/gofmt -d -s $( cat $TMPDIR/gofiles.list) ); + out=$(xargs -a $TMPDIR/gofiles.list $GOSDK/gofmt -d -s); if [ -n "$out" ]; then in_red "$out"; ret=1; fi lint_step "linelen (lll)" out=$($TMPDIR/lll -w 4 -l 100 --files -e '`comment:"|`ini:"|https?:|`sql:"|gorm:"|`json:"|`yaml:|nolint:lll' < $TMPDIR/gofiles.list) @@ -50,6 +49,9 @@ go_lint() { lint_step "misspell" out=$(xargs -a $TMPDIR/gofiles.list $TMPDIR/misspell -error) if [ -n "$out" ]; then in_red "$out"; ret=1; fi + lint_step "licensechecker" + out=$(xargs -a $TMPDIR/gofiles.list tools/licensechecker.py) + if [ -n "$out" ]; then in_red "$out"; ret=1; fi lint_step "bazel" run_silently make gazelle GAZELLE_MODE=diff || ret=1 bazel test --config lint || ret=1