From af5a7f4df8414deb5ffc707184d9db82b7d2b3ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Tue, 25 Aug 2020 19:00:08 +0200 Subject: [PATCH] ci: run make codegen validation in workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fail if a PR is submitted and has not run "make codegen" Signed-off-by: Sébastien Han --- .github/workflows/codegen.yml | 20 ++++++++++++++++++++ hack/validate-codegen.sh | 10 ++++++++++ 2 files changed, 30 insertions(+) create mode 100644 .github/workflows/codegen.yml create mode 100755 hack/validate-codegen.sh diff --git a/.github/workflows/codegen.yml b/.github/workflows/codegen.yml new file mode 100644 index 000000000..740ed0f3d --- /dev/null +++ b/.github/workflows/codegen.yml @@ -0,0 +1,20 @@ +name: Codegen +on: [pull_request] + +jobs: + codegen: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v1 + + - uses: actions/setup-go@v2 + with: + go-version: 1.13 + + - name: run codegen + run: GOPATH=$(go env GOPATH) make codegen + + - name: validate codegen + run: hack/validate-codegen.sh + diff --git a/hack/validate-codegen.sh b/hack/validate-codegen.sh new file mode 100755 index 000000000..e7b1e7bab --- /dev/null +++ b/hack/validate-codegen.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -ex + +for file in $(git status --porcelain); do + if [[ "$file" =~ "zz" ]]; then + echo "found codegen files!" + echo "please run 'make codegen' and update your PR" + exit 1 + fi +done