From e77e7a8d54525910e61eab3caf7b7fc25f7efa63 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Tue, 2 Jul 2024 09:37:15 +1200 Subject: [PATCH] Add workflow to ensure generated code is up to date (#1061) Signed-off-by: Thomas Farr --- .github/workflows/code-generation.yml | 34 +++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/code-generation.yml diff --git a/.github/workflows/code-generation.yml b/.github/workflows/code-generation.yml new file mode 100644 index 0000000000..a7eeaa0fd0 --- /dev/null +++ b/.github/workflows/code-generation.yml @@ -0,0 +1,34 @@ +name: Code Generation + +on: [pull_request] + +jobs: + up_to_date: + name: Ensure Generated Code Up To Date + runs-on: ubuntu-latest + steps: + - name: Checkout Java Client + uses: actions/checkout@v4 + + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: 11 + distribution: 'temurin' + cache: 'gradle' + + - name: Run Code Generator + run: ./gradlew clean :java-codegen:run + + - name: Check Has No Changes + shell: bash -eo pipefail {0} + run: | + output=$(git status --porcelain) + if [ -z "$output" ]; then + echo "Clean working directory" + exit 0 + else + echo "Dirty working directory" + echo "$output" + exit 1 + fi \ No newline at end of file