From 47fe96c5acd53969ddfc08ce9c0398fd3c8380c6 Mon Sep 17 00:00:00 2001 From: William Banfield Date: Tue, 16 Nov 2021 18:16:19 -0500 Subject: [PATCH] wip --- scripts/clean-spec-protos.sh | 8 ++++++++ scripts/fetch-spec-protos.sh | 16 ++++++++++++++++ scripts/proto-check-breaking.sh | 12 ++++++++++++ 3 files changed, 36 insertions(+) create mode 100755 scripts/clean-spec-protos.sh create mode 100755 scripts/fetch-spec-protos.sh create mode 100755 scripts/proto-check-breaking.sh diff --git a/scripts/clean-spec-protos.sh b/scripts/clean-spec-protos.sh new file mode 100755 index 000000000..60724748c --- /dev/null +++ b/scripts/clean-spec-protos.sh @@ -0,0 +1,8 @@ +#!/bin/env bash +set -euo pipefail + +find ${OUTDIR}/proto/tendermint/ -name *.proto \ + | sed "s/$OUTDIR\/\(.*\)/\1/g" \ + | xargs -I {} rm {} + +rm -rf ${OUTDIR} diff --git a/scripts/fetch-spec-protos.sh b/scripts/fetch-spec-protos.sh new file mode 100755 index 000000000..98d2398c0 --- /dev/null +++ b/scripts/fetch-spec-protos.sh @@ -0,0 +1,16 @@ +#!/bin/env bash +set -euo pipefail +: ${VERS:=master} + +# Get shortened ref of commit +REF=$(curl -H "Accept: application/vnd.github.v3.sha" -qL \ + "https://api.github.com/repos/tendermint/spec/commits/${VERS}" \ + | cut -c -7) + +readonly OUTDIR="tendermint-spec-${REF}" +curl -qL "https://api.github.com/repos/tendermint/spec/tarball/${REF}" | tar -xzf - ${OUTDIR}/ + +cp -r ${OUTDIR}/proto/tendermint/* ./proto/tendermint +cp -r ${OUTDIR}/third_party/** ./third_party + +echo ${OUTDIR} diff --git a/scripts/proto-check-breaking.sh b/scripts/proto-check-breaking.sh new file mode 100755 index 000000000..13e8c9462 --- /dev/null +++ b/scripts/proto-check-breaking.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -euo pipefail + +: ${VERS:=master} +: ${AGAINST:='.git#branch=master'} + +echo "fetching proto files" +OUTDIR=$(VERS=$VERS sh ./scripts/fetch-spec-protos.sh) + +buf breaking --against $AGAINST + +OUTDIR=$OUTDIR sh ./scripts/clear-spec-protos.sh