diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d9af2f5e4a..50de9abd7e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,6 +25,7 @@ jobs: runs-on: ubuntu-latest needs: - make-pr + - validate-schema - integration-tests - smoke-and-functional-tests - docker-disabled @@ -32,6 +33,7 @@ jobs: - name: report-failure if : | needs.make-pr.result != 'success' || + needs.validate-schema.result != 'success' || needs.integration-tests.result != 'success' || needs.smoke-and-functional-tests.result != 'success' || needs.docker-disabled.result != 'success' @@ -64,6 +66,27 @@ jobs: - run: make init - run: make pr + validate-schema: + name: Validate JSON schema + if: github.repository_owner == 'aws' + permissions: + pull-requests: write + contents: write + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + name: Install Python 3.11 + with: + python-version: 3.11 + - run: make init + - run: | + diff <( cat schema/samcli.json ) <( python schema/make_schema.py; cat schema/samcli.json ) && exit 0 # exit if schema is unchanged + echo "The generated schema differs from that in the PR. Please run 'make schema'." + exit 1 + name: Generate and compare the schema + shell: bash + integration-tests: name: Integration Tests / ${{ matrix.os }} / ${{ matrix.python }} / ${{ matrix.tests_folder }} if: github.repository_owner == 'aws' diff --git a/Makefile b/Makefile index 23e1bf8217..f12f34df84 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,8 @@ # environment variable. SAM_CLI_TELEMETRY ?= 0 +.PHONY: schema + init: SAM_CLI_DEV=1 pip install -e '.[dev]' @@ -50,8 +52,11 @@ black-check: format: black ruff samcli --fix +schema: + python schema/make_schema.py + # Verifications to run before sending a pull request -pr: init dev black-check +pr: init dev schema black-check # (jfuss) We updated to have two requirement files, one for mac and one for linux. This # is meant to be a short term fix when upgrading the Linux installer to be python3.11 from