diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 847b05e..d59c7e5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,6 +53,37 @@ jobs: - run: | make all + test-validate-repo: + needs: test-build + name: Check validate-repo + runs-on: ubuntu-22.04 + timeout-minutes: 5 + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: 1.21.x + + - name: Set env + shell: bash + run: | + echo "${{ github.workspace }}/bin" >> $GITHUB_PATH + + - name: Install protoc and plugins + run: | + sudo make install-protoc + make install-protoc-dependencies install-ttrpc-plugin + + - name: Force regeneration of protobuf files + run: | + touch pkg/api/api.proto + make all + + - name: Validate files in git have not been changed + run: | + make validate-repo + linters: name: Linters runs-on: ${{ matrix.os }} diff --git a/Makefile b/Makefile index 9e2a87f..d13efa3 100644 --- a/Makefile +++ b/Makefile @@ -166,6 +166,13 @@ vet: golangci-lint: $(Q)$(GOLANG_CILINT) run +validate-repo: + $(Q)test -z "$$(git status --short | tee /dev/stderr)" || { \ + echo "Repository is in invalid state."; \ + echo "Please make sure to commit all changes, including generated files."; \ + exit 1; \ + } + # # proto generation targets #