2024-02-04 11:26:24 +00:00
|
|
|
# Workflow to validate the latest schema.
|
2022-10-25 05:24:08 +00:00
|
|
|
|
2024-02-04 11:26:24 +00:00
|
|
|
name: "validate schema"
|
2021-11-27 10:13:45 +00:00
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
pull_request:
|
2024-02-04 11:26:24 +00:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
paths:
|
|
|
|
- "schema/**"
|
|
|
|
- ".github/workflows/validate_schema.yml"
|
2021-11-27 10:13:45 +00:00
|
|
|
|
2022-10-25 05:24:08 +00:00
|
|
|
concurrency:
|
2023-01-06 02:42:41 +00:00
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
2022-11-02 05:29:41 +00:00
|
|
|
cancel-in-progress: ${{ github.event_name == 'pull_request' || github.repository != 'ClementTsang/bottom' }}
|
2022-10-25 05:24:08 +00:00
|
|
|
|
2021-11-27 10:13:45 +00:00
|
|
|
jobs:
|
2022-11-04 08:48:44 +00:00
|
|
|
pre-job:
|
2021-11-27 10:13:45 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
should_skip: ${{ steps.skip_check.outputs.should_skip }}
|
|
|
|
steps:
|
|
|
|
- id: skip_check
|
2024-01-28 11:11:42 +00:00
|
|
|
uses: fkirc/skip-duplicate-actions@f75f66ce1886f00957d99748a42c724f4330bdcf # v5.3.1
|
2021-11-27 10:13:45 +00:00
|
|
|
with:
|
|
|
|
skip_after_successful_duplicate: "true"
|
2024-02-04 11:26:24 +00:00
|
|
|
paths: '["schema/**", ".github/workflows/validate_schema.yml"]'
|
2021-11-27 10:13:45 +00:00
|
|
|
do_not_skip: '["workflow_dispatch"]'
|
|
|
|
|
|
|
|
test-build-documentation:
|
2024-02-04 11:26:24 +00:00
|
|
|
name: Test validating schema
|
2022-11-04 08:48:44 +00:00
|
|
|
needs: pre-job
|
|
|
|
if: ${{ needs.pre-job.outputs.should_skip != 'true' }}
|
2021-11-27 10:13:45 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-06-02 22:04:51 +00:00
|
|
|
- name: Checkout repository
|
2023-11-19 00:15:28 +00:00
|
|
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
2021-11-27 10:13:45 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
2024-01-28 11:11:42 +00:00
|
|
|
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
|
2021-11-27 10:13:45 +00:00
|
|
|
with:
|
2023-02-03 08:25:25 +00:00
|
|
|
python-version: 3.11
|
2021-11-27 10:13:45 +00:00
|
|
|
|
|
|
|
- name: Install Python dependencies
|
2024-02-04 11:26:24 +00:00
|
|
|
run: pip install -r scripts/schema/requirements.txt
|
2021-11-27 10:13:45 +00:00
|
|
|
|
2024-02-04 11:26:24 +00:00
|
|
|
- name: Test nightly validates on valid sample configs
|
2021-11-27 10:13:45 +00:00
|
|
|
run: |
|
2024-02-04 11:26:24 +00:00
|
|
|
python3 scripts/schema/validator.py -s ./schema/nightly/bottom.json -f ./sample_configs/default_config.toml
|
|
|
|
python3 scripts/schema/validator.py -s ./schema/nightly/bottom.json -f ./sample_configs/demo_config.toml
|
|
|
|
|
|
|
|
- name: Test nightly catches on a bad sample config
|
|
|
|
run: |
|
|
|
|
python3 scripts/schema/validator.py -s ./schema/nightly/bottom.json -f scripts/schema/bad_file.toml --should_fail
|