Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add schema generation to GitHub Actions #5683

Merged
merged 4 commits into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ jobs:
runs-on: ubuntu-latest
needs:
- make-pr
- validate-schema
- integration-tests
- smoke-and-functional-tests
- docker-disabled
steps:
- 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'
Expand Down Expand Up @@ -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'
Expand Down
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# environment variable.
SAM_CLI_TELEMETRY ?= 0

.PHONY: schema

init:
SAM_CLI_DEV=1 pip install -e '.[dev]'

Expand Down Expand Up @@ -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
Expand Down