From 4adb739a7e6ff2db0cde495eec7c9131d1bea4ae Mon Sep 17 00:00:00 2001 From: Artsiom Koltun Date: Wed, 26 Jun 2024 09:51:25 +0200 Subject: [PATCH] ci: add apilinter Signed-off-by: Artsiom Koltun --- inventory/Makefile | 7 ++++++- network/cloud/Makefile | 6 +++++- network/evpn-gw/Makefile | 7 ++++++- network/k8s/Makefile | 6 +++++- network/opinetcommon/Makefile | 7 ++++++- network/telco/Makefile | 6 +++++- security/Makefile | 7 ++++++- storage/Makefile | 7 ++++++- 8 files changed, 45 insertions(+), 8 deletions(-) diff --git a/inventory/Makefile b/inventory/Makefile index e2d7a0f1..3f0d3563 100644 --- a/inventory/Makefile +++ b/inventory/Makefile @@ -2,7 +2,7 @@ # Copyright (C) 2022 Intel Corporation # Copyright (c) 2022 Dell Inc, or its subsidiaries. -all: buflint bufgen doc +all: buflint apilint bufgen doc doc: rm -rf ./google @@ -16,6 +16,11 @@ doc: rm -rf "${PWD}"/google +apilint: + curl -kL https://github.com/googleapis/googleapis/archive/master.tar.gz | tar --strip=1 -zxvf - googleapis-master/google/api + docker run --user=$(id -u):$(id -g) --rm --entrypoint=sh -v "${PWD}":/out -w /out ghcr.io/docker-multiarch/google-api-linter:1.56.1 -c "api-linter /out/*.proto --output-format github --set-exit-status" + rm -rf "${PWD}"/google + buflint: docker run --rm -v "${PWD}":/out -w /out bufbuild/buf lint diff --git a/network/cloud/Makefile b/network/cloud/Makefile index d6da076a..cdf3739d 100644 --- a/network/cloud/Makefile +++ b/network/cloud/Makefile @@ -2,7 +2,7 @@ # Copyright (C) 2022 Intel Corporation # Copyright (c) 2022 Dell Inc, or its subsidiaries. -all: buflint bufgen doc +all: buflint apilint bufgen doc doc: rm -rf ./google @@ -16,6 +16,10 @@ doc: rm -rf "${PWD}"/google +apilint: + curl -kL https://github.com/googleapis/googleapis/archive/master.tar.gz | tar --strip=1 -zxvf - googleapis-master/google/api + docker run --user=$(id -u):$(id -g) --rm --entrypoint=sh -v "${PWD}/../../network/opinetcommon":/common -v "${PWD}":/out -w /out ghcr.io/docker-multiarch/google-api-linter:1.56.1 -c "api-linter -I /common /out/*.proto --output-format github --disable-rule=core::0123 --disable-rule=core::0131 --disable-rule=core::0132 --disable-rule=core::0133 --disable-rule=core::0134 --disable-rule=core::0140 --disable-rule=core::0156 --disable-rule=core::0158 --disable-rule=core::0191 --disable-rule=core::0192 --disable-rule=core::0203 --disable-rule=core::0216 --disable-rule=client-libraries::4232::required-fields --set-exit-status" + rm -rf "${PWD}"/google buflint: docker run --rm -v "${PWD}/../opinetcommon":/opinnetcommon -v "${PWD}":/out -w /out bufbuild/buf lint diff --git a/network/evpn-gw/Makefile b/network/evpn-gw/Makefile index bb2d8917..6822c1d0 100644 --- a/network/evpn-gw/Makefile +++ b/network/evpn-gw/Makefile @@ -3,7 +3,7 @@ # Copyright (c) 2022 Dell Inc, or its subsidiaries. # Copyright (C) 2023 Nordix Foundation. -all: buflint bufgen doc +all: buflint apilint bufgen doc doc: rm -rf ./google @@ -17,6 +17,11 @@ doc: rm -rf "${PWD}"/google +apilint: + curl -kL https://github.com/googleapis/googleapis/archive/master.tar.gz | tar --strip=1 -zxvf - googleapis-master/google/api + docker run --user=$(id -u):$(id -g) --rm --entrypoint=sh -v "${PWD}/../../network/opinetcommon":/common -v "${PWD}":/out -w /out ghcr.io/docker-multiarch/google-api-linter:1.56.1 -c "api-linter -I /common /out/*.proto --output-format github --set-exit-status" + rm -rf "${PWD}"/google + buflint: docker run --rm -v "${PWD}/../opinetcommon":/opinnetcommon -v "${PWD}":/out -w /out bufbuild/buf lint diff --git a/network/k8s/Makefile b/network/k8s/Makefile index 0eef99ef..d5481045 100644 --- a/network/k8s/Makefile +++ b/network/k8s/Makefile @@ -2,7 +2,7 @@ # Copyright (C) 2022 Intel Corporation # Copyright (c) 2022 Dell Inc, or its subsidiaries. -all: buflint bufgen doc +all: buflint apilint bufgen doc doc: rm -rf ./google @@ -16,6 +16,10 @@ doc: rm -rf "${PWD}"/google +apilint: + curl -kL https://github.com/googleapis/googleapis/archive/master.tar.gz | tar --strip=1 -zxvf - googleapis-master/google/api + docker run --user=$(id -u):$(id -g) --rm --entrypoint=sh -v "${PWD}":/out -w /out ghcr.io/docker-multiarch/google-api-linter:1.56.1 -c "api-linter /out/*.proto --output-format github --set-exit-status" + rm -rf "${PWD}"/google buflint: docker run --rm -v "${PWD}/../opinetcommon":/opinnetcommon -v "${PWD}":/out -w /out bufbuild/buf lint diff --git a/network/opinetcommon/Makefile b/network/opinetcommon/Makefile index 46cf653c..1e5abb96 100644 --- a/network/opinetcommon/Makefile +++ b/network/opinetcommon/Makefile @@ -2,7 +2,12 @@ # Copyright (C) 2022 Intel Corporation # Copyright (c) 2022 Dell Inc, or its subsidiaries. -all: buflint bufgen doc +all: buflint apilint bufgen doc + +apilint: + curl -kL https://github.com/googleapis/googleapis/archive/master.tar.gz | tar --strip=1 -zxvf - googleapis-master/google/api + docker run --user=$(id -u):$(id -g) --rm --entrypoint=sh -v "${PWD}":/out -w /out ghcr.io/docker-multiarch/google-api-linter:1.56.1 -c "api-linter /out/*.proto --output-format github --set-exit-status" + rm -rf "${PWD}"/google buflint: docker run --rm -v "${PWD}":/out -w /out bufbuild/buf lint diff --git a/network/telco/Makefile b/network/telco/Makefile index 0eef99ef..d5481045 100644 --- a/network/telco/Makefile +++ b/network/telco/Makefile @@ -2,7 +2,7 @@ # Copyright (C) 2022 Intel Corporation # Copyright (c) 2022 Dell Inc, or its subsidiaries. -all: buflint bufgen doc +all: buflint apilint bufgen doc doc: rm -rf ./google @@ -16,6 +16,10 @@ doc: rm -rf "${PWD}"/google +apilint: + curl -kL https://github.com/googleapis/googleapis/archive/master.tar.gz | tar --strip=1 -zxvf - googleapis-master/google/api + docker run --user=$(id -u):$(id -g) --rm --entrypoint=sh -v "${PWD}":/out -w /out ghcr.io/docker-multiarch/google-api-linter:1.56.1 -c "api-linter /out/*.proto --output-format github --set-exit-status" + rm -rf "${PWD}"/google buflint: docker run --rm -v "${PWD}/../opinetcommon":/opinnetcommon -v "${PWD}":/out -w /out bufbuild/buf lint diff --git a/security/Makefile b/security/Makefile index 37c435e0..22c712fd 100644 --- a/security/Makefile +++ b/security/Makefile @@ -2,7 +2,7 @@ # Copyright (C) 2022 Intel Corporation # Copyright (c) 2022 Dell Inc, or its subsidiaries. -all: buflint bufgen doc +all: buflint apilint bufgen doc doc: rm -rf ./google @@ -16,6 +16,11 @@ doc: rm -rf "${PWD}"/google +apilint: + curl -kL https://github.com/googleapis/googleapis/archive/master.tar.gz | tar --strip=1 -zxvf - googleapis-master/google/api + docker run --user=$(id -u):$(id -g) --rm --entrypoint=sh -v "${PWD}":/out -w /out ghcr.io/docker-multiarch/google-api-linter:1.56.1 -c "api-linter -I /common /out/*.proto --output-format github --disable-rule=core::0192 --disable-rule=core::0191 --disable-rule=core::0140 --disable-rule=core::0123 --disable-rule=core::0142 --disable-rule=core::0126 --disable-rule=core::0127 --disable-rule=core::0141 --disable-rule=core::0203 --disable-rule=core::0216 --set-exit-status" + rm -rf "${PWD}"/google + buflint: docker run --rm -v "${PWD}":/out -w /out bufbuild/buf lint diff --git a/storage/Makefile b/storage/Makefile index ca36e0ff..e30a2024 100644 --- a/storage/Makefile +++ b/storage/Makefile @@ -2,7 +2,7 @@ # Copyright (C) 2022 Intel Corporation # Copyright (c) 2022 Dell Inc, or its subsidiaries. -all: buflint bufgen doc +all: buflint apilint bufgen doc doc: rm -rf ./google @@ -16,6 +16,11 @@ doc: rm -rf "${PWD}"/google +apilint: + curl -kL https://github.com/googleapis/googleapis/archive/master.tar.gz | tar --strip=1 -zxvf - googleapis-master/google/api + docker run --user=$(id -u):$(id -g) --rm --entrypoint=sh -v "${PWD}":/out -w /out ghcr.io/docker-multiarch/google-api-linter:1.56.1 -c "api-linter /out/*.proto --output-format github --set-exit-status" + rm -rf "${PWD}"/google + buflint: docker run --rm -v "${PWD}":/out -w /out bufbuild/buf lint