Skip to content

Commit

Permalink
add config validation workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
afwillia committed Nov 16, 2023
1 parent f14d330 commit d189f5c
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/validate-dcc-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# ------------------------------------------------------------------------------
# Validate a dcc config file against the dca_config schema
# ------------------------------------------------------------------------------
name: validate dcc config
on:
push:
paths:
- 'dcc/*dca_config.json'
- 'test/*dca_config.json'
- 'schemas/dca_config.schema.json'
pull_request:
branches:
- 'main'
- 'staging'
- 'dev'
paths:
- 'dcc/*dca_config.json'
- 'test/*dca_config.json'
- 'schemas/dca_config.schema.json'

jobs:
validate-dcc-config:
runs-on: ubuntu-latest
steps:
- id: files
uses: masesgroup/retrieve-changed-files@v3
with:
format: 'csv'
- id: filter_files
name: Filter files to dca_config.json files
run: |
echo "configs=$(echo ${{ steps.files.outputs.added_modified }} | tr ',' '\n' | grep dca_config\\.json | tr '\n' ',' | sed 's/\(.*\),/\1 /')" >> "$GITHUB_OUTPUT"
- uses: actions/checkout@v4
- name: Validate JSON
if: ${{ steps.filter_files.outputs.configs != '' }}
uses: docker://orrosenblatt/validate-json-action:latest
env:
INPUT_SCHEMA: schemas/dca_config.schema.json
INPUT_JSONS: ${{ steps.filter_files.outputs.configs }}

39 changes: 39 additions & 0 deletions .github/workflows/validate-template-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# ------------------------------------------------------------------------------
# Validate a dca template config file against the dca template config schema
# ------------------------------------------------------------------------------
name: Validate Template Config
on:
push:
paths:
- 'dcc/*dca-template-config.json'
- 'test/*dca-template-config.json'
- 'schemas/dca_template_config.schema.json'
pull_request:
branches:
- 'main'
- 'staging'
- 'dev'
paths:
- 'dcc/*dca-template-config.json'
- 'test/*dca-template-config.json'
- 'schemas/dca_template_config.schema.json'

jobs:
validate-template-config:
runs-on: ubuntu-latest
steps:
- id: files
uses: masesgroup/retrieve-changed-files@v3
with:
format: 'csv'
- id: filter_files
name: Filter files to dca-template-config.json files
run: |
echo "configs=$(echo ${{ steps.files.outputs.added_modified }} | tr ',' '\n' | grep dca-template-config\\.json | tr '\n' ',' | sed 's/\(.*\),/\1 /')" >> "$GITHUB_OUTPUT"
- uses: actions/checkout@v4
- name: Validate JSON
if: ${{ steps.filter_files.outputs.configs != '' }}
uses: docker://orrosenblatt/validate-json-action:latest
env:
INPUT_SCHEMA: schemas/dca_template_config.schema.json
INPUT_JSONS: ${{ steps.filter_files.outputs.configs }}
28 changes: 28 additions & 0 deletions .github/workflows/validate-tenants-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# ------------------------------------------------------------------------------
# Validate the tenants.json file against the tenants.schema.json schema
# ------------------------------------------------------------------------------
name: validate tenants config
on:
push:
paths:
- 'tenants.json'
- 'schemas/tenants.schema.json'
pull_request:
branches:
- 'main'
- 'staging'
- 'dev'
paths:
- 'tenants.json'
- 'schemas/tenants.schema.json'

jobs:
validate-tenants-config:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Validate JSON
uses: docker://orrosenblatt/validate-json-action:latest
env:
INPUT_SCHEMA: schemas/tenants.schema.json
INPUT_JSONS: tenants.json

0 comments on commit d189f5c

Please sign in to comment.