summary refs log tree commit diff
path: root/.github/workflows/schema.yaml
blob: 41f3cd01be50a37fd881eb53a83c1a2f8372dada (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: Schema

on:
  pull_request:
    paths:
      - schema/**
      - docs/usage/configuration/config_documentation.md

jobs:
  validate-schema:
    name: Ensure Synapse config schema is valid
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
      - uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
        with:
          python-version: "3.x"
      - name: Install check-jsonschema
        run: pip install check-jsonschema==0.33.0

      - name: Validate meta schema
        run: check-jsonschema --check-metaschema schema/v*/meta.schema.json
      - name: Validate schema
        run: |-
          # Please bump on introduction of a new meta schema.
          LATEST_META_SCHEMA_VERSION=v1
          check-jsonschema \
            --schemafile="schema/$LATEST_META_SCHEMA_VERSION/meta.schema.json" \
            schema/synapse-config.schema.yaml
      - name: Validate default config
      # Populates the empty instance with default values and checks against the schema.
        run: |-
          echo "{}" | check-jsonschema \
            --fill-defaults --schemafile=schema/synapse-config.schema.yaml -

  check-doc-generation:
    name: Ensure generated documentation is up-to-date
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
      - uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
        with:
          python-version: "3.x"
      - name: Install PyYAML
        run: pip install PyYAML==6.0.2

      - name: Regenerate config documentation
        run: |
          scripts-dev/gen_config_documentation.py \
            schema/synapse-config.schema.yaml \
          > docs/usage/configuration/config_documentation.md
      - name: Error in case of any differences
      # Errors if there are now any modified files (untracked files are ignored).
        run: 'git diff || ! git status --porcelain=1 | grep "^ M"'