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