From e6714c9f963b906d3e89482a6e7db31ffba94e08 Mon Sep 17 00:00:00 2001 From: Andrew Farries Date: Wed, 10 Jan 2024 13:27:25 +0000 Subject: [PATCH] Add a CI job to ensure generated types are updated Ensure that type generation from `schema.json` is up-to-date. * Check out the repo * Run `make generate` * Ensure that there is no diff --- .github/workflows/build.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bda86b15d..995e4e87e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -57,6 +57,24 @@ jobs: fi done + type-generation: + name: type generation + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Generate types + run: | + make generate + + - name: Ensure generated types are up-to-date + run: | + if ! git diff --quiet; then + echo "generated types are out of date!" + echo "run `make generate` to regenerate type definitions from `schema.json`" + exit 1 + fi + license-check: name: License check runs-on: ubuntu-latest @@ -106,7 +124,7 @@ jobs: release: runs-on: ubuntu-latest - needs: [test, lint, examples, license-check] + needs: [test, lint, examples, license-check, type-generation] if: startsWith(github.ref, 'refs/tags/') env: DOCKER_CLI_EXPERIMENTAL: "enabled"