Skip to content

Commit

Permalink
Move example schema validation to its own job (#318)
Browse files Browse the repository at this point in the history
Move the validation of the examples' JSON schema from a step in the
`example` job into its own job.

In its previous location the examples were having their schema validated
in each job in the matrix (pg version x public/non_public schema),
making each job in the matrix take ~15s longer.

---------

Co-authored-by: Carlos Pérez-Aradros Herce <[email protected]>
  • Loading branch information
andrew-farries and exekias authored Mar 12, 2024
1 parent 631d642 commit f5d09d5
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,16 @@ jobs:
curl -s https://raw.githubusercontent.com/lluissm/license-header-checker/master/install.sh | bash
./bin/license-header-checker -a -r .github/license-header.txt . go && [[ -z `git status -s` ]]
examples-schema-validation:
name: validate examples JSON
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Validate example migrations against JSON schema
run: |
npx -y ajv-cli --spec=draft2020 validate -s schema.json -d "./examples/*.json"
examples:
name: 'examples (pg: ${{ matrix.pgVersion }}, schema: ${{ matrix.testSchema }})'
runs-on: ubuntu-latest
Expand Down Expand Up @@ -142,10 +152,6 @@ jobs:
with:
go-version-file: 'go.mod'

- name: Validate examples against JSON schema
run: |
npx -y ajv-cli --spec=draft2020 validate -s schema.json -d "./examples/*.json"
- name: Run example migrations
run: |
if [ "$PGROLL_SCHEMA" != "public" ]; then
Expand All @@ -166,7 +172,7 @@ jobs:

release:
runs-on: ubuntu-latest
needs: [test, lint, examples, license-check, type-generation, dead-code-check]
needs: [test, lint, examples-schema-validation, examples, license-check, type-generation, dead-code-check]
if: startsWith(github.ref, 'refs/tags/')
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
Expand Down

0 comments on commit f5d09d5

Please sign in to comment.