Skip to content

Commit

Permalink
migrate
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Kowalleck <[email protected]>
  • Loading branch information
jkowalleck committed Nov 6, 2024
1 parent 5beb76f commit a28e496
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 67 deletions.
10 changes: 1 addition & 9 deletions tools/src/test/proto/buf_breaking-remote.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
# This is the config for "Buf" - a ProtocolBuffer linter/checker/more
# see https://buf.build/docs/configuration/v2/buf-yaml
version: v2
lint: # https://buf.build/docs/configuration/v2/buf-yaml#lint
except:
- FIELD_NOT_REQUIRED
- PACKAGE_NO_IMPORT_CYCLE
disallow_comment_ignores: true
breaking: # https://buf.build/docs/configuration/v2/buf-yaml#breaking
use: # see https://buf.build/docs/breaking/overview#rules-and-categories
- WIRE
except:
- EXTENSION_NO_DELETE
- FIELD_SAME_DEFAULT
- WIRE
10 changes: 2 additions & 8 deletions tools/src/test/proto/buf_breaking-version.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
# This is the config for "Buf" - a ProtocolBuffer linter/checker/more
# see https://buf.build/docs/configuration/v2/buf-yaml
version: v2
lint: # https://buf.build/docs/configuration/v2/buf-yaml#lint
except:
- FIELD_NOT_REQUIRED
- PACKAGE_NO_IMPORT_CYCLE
disallow_comment_ignores: true
breaking: # https://buf.build/docs/configuration/v2/buf-yaml#breaking
use: # see https://buf.build/docs/breaking/overview#rules-and-categories
- WIRE
except:
- EXTENSION_NO_DELETE
- FIELD_SAME_DEFAULT
- FILE_SAME_PACKAGE
# scope is to detect changes from one version to the other -> so ignore "FILE_SAME_PACKAGE"
- FILE_SAME_PACKAGE
37 changes: 20 additions & 17 deletions tools/src/test/proto/buf_lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,25 @@
# see https://buf.build/docs/configuration/v2/buf-yaml
version: v2
lint: # https://buf.build/docs/configuration/v2/buf-yaml#lint
use: # see https://buf.build/docs/breaking/overview#rules-and-categories
- DEFAULT
use: # see https://buf.build/docs/lint/rules
- STANDARD # https://buf.build/docs/lint/rules/#standard
# - COMMENTS # https://buf.build/docs/lint/rules/#comments
except:
- DIRECTORY_SAME_PACKAGE
- FIELD_LOWER_SNAKE_CASE
- FIELD_NOT_REQUIRED
- FILE_LOWER_SNAKE_CASE
- PACKAGE_DIRECTORY_MATCH
- PACKAGE_NO_IMPORT_CYCLE
- PACKAGE_VERSION_SUFFIX
# directory/file layout does not match the recommendation/framework of the tool
- DIRECTORY_SAME_PACKAGE # https://buf.build/docs/lint/rules#directory_same_package
- PACKAGE_DIRECTORY_MATCH # https://buf.build/docs/lint/rules#package_lower_snake_case
- FILE_LOWER_SNAKE_CASE # https://buf.build/docs/lint/rules#file_lower_snake_case
# we do not stick to the following best-practices and recommendations:
# (shall be fixed with v2.0 of this very schema)
- PACKAGE_VERSION_SUFFIX # https://buf.build/docs/lint/rules#package_version_suffix
- FIELD_LOWER_SNAKE_CASE # https://buf.build/docs/lint/rules#field_lower_snake_case
ignore_only:
DEFAULT:
- schema/bom-1.3.proto
- schema/bom-1.4.proto
- schema/bom-1.5.proto
breaking: # https://buf.build/docs/configuration/v2/buf-yaml#breaking
except:
- EXTENSION_NO_DELETE
- FIELD_SAME_DEFAULT
# legacy schema files may NOT stick to the rules -- this is acknowledged.
STANDARD:
- "schema/bom-1.5.proto"
- "schema/bom-1.4.proto"
- "schema/bom-1.3.proto"
COMMENTS:
- "schema/bom-1.5.proto"
- "schema/bom-1.4.proto"
- "schema/bom-1.3.proto"
21 changes: 0 additions & 21 deletions tools/src/test/proto/mig/buf.yaml

This file was deleted.

21 changes: 9 additions & 12 deletions tools/src/test/proto/test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
set -ue
set -uex

THIS_PATH="$(realpath "$(dirname "$0")")"
ROOT_PATH="$(realpath "${THIS_PATH}/../../../..")"
Expand Down Expand Up @@ -32,7 +32,6 @@ function schema-lint () {
--workdir '/workspace' \
bufbuild/buf:"$BUF_IMAGE_VERSION" \
lint --path "$SCHEMA_DIR" \
--config 'buf.yaml' \
--error-format "$LOG_FORMAT"

echo '>> OK.' >&2
Expand All @@ -57,14 +56,13 @@ function schema-breaking-version () {
echo ">> compare new:${NEW} -VS- old:${OLD}" >&2
# stick with the original path of "$NEW", so the reporting makes sense...
docker run --rm \
--volume "${ROOT_PATH}/${SCHEMA_DIR}/${NEW}:/workspace/${SCHEMA_DIR}/${NEW}:ro" \
--volume "${ROOT_PATH}/${SCHEMA_DIR}/${OLD}:/workspace/${SCHEMA_DIR_OLD}/${NEW}:ro" \
--volume "${THIS_PATH}/buf_breaking-version.yaml:/workspace/buf.yaml:ro" \
--workdir '/workspace' \
--volume "${ROOT_PATH}/${SCHEMA_DIR}/${OLD}:/workspaces/old/${NEW}:ro" \
--volume "${ROOT_PATH}/${SCHEMA_DIR}/${NEW}:/workspaces/new/${NEW}:ro" \
--volume "${THIS_PATH}/buf_breaking-version.yaml:/workspaces/new/buf.yaml:ro" \
--workdir '/workspaces' \
bufbuild/buf:"$BUF_IMAGE_VERSION" \
breaking "$SCHEMA_DIR" \
--against "$SCHEMA_DIR_OLD" \
--config 'buf.yaml' \
breaking new \
--against old \
--error-format "$LOG_FORMAT"
}

Expand All @@ -90,9 +88,8 @@ function schema-breaking-remote () {
--volume "${THIS_PATH}/buf_breaking-remote.yaml:/workspace/buf.yaml:ro" \
--workdir '/workspace' \
bufbuild/buf:"$BUF_IMAGE_VERSION" \
breaking "$SCHEMA_DIR" \
--against "${REMOTE}#subdir=${SCHEMA_DIR}" \
--config 'buf.yaml' \
breaking --path "$SCHEMA_DIR" \
--against "${REMOTE}" \
--error-format "$LOG_FORMAT"

echo '>> OK.' >&2
Expand Down

0 comments on commit a28e496

Please sign in to comment.