summaryrefslogtreecommitdiffstats
path: root/.github/workflows/check-cmdline-ref.yml
blob: 48b1e65ebf28daccd80020196e782e532687b3d9 (plain)
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: Check Command Line Reference (comment /regenerate-cmdline-ref to auto-fix)

on:
  pull_request:
    branches: [master]

jobs:
  check-cmdline-ref:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          submodules: "recursive"

      - name: Install dependencies
        run: |
          sudo apt-get update
          sudo apt-get install -y libx11-dev

      - name: Setup
        uses: ./.github/actions/common-setup
        with:
          os: linux
          compiler: gcc
          platform: x86_64
          config: release
          build-llvm: false

      - name: Build Slang
        run: |
          cmake --preset default --fresh \
            -DSLANG_SLANG_LLVM_FLAVOR=DISABLE \
            -DSLANG_ENABLE_TESTS=OFF \
            -DSLANG_ENABLE_EXAMPLES=OFF \
            -DSLANG_ENABLE_GFX=OFF \
            -DSLANG_ENABLE_SLANGD=OFF \
            -DSLANG_EXCLUDE_DAWN=ON \
            -DSLANG_EXCLUDE_TINT=ON
          cmake --workflow --preset release

      - name: Generate command line reference
        run: |
          mkdir -p temp
          "$bin_dir/slangc" -help-style markdown -h > temp/command-line-slangc-reference.md

      - name: Compare with existing reference
        id: compare
        run: |
          if ! diff -q temp/command-line-slangc-reference.md docs/command-line-slangc-reference.md > /dev/null; then
            echo "Command line reference is out of date. Diff:"
            diff -u docs/command-line-slangc-reference.md temp/command-line-slangc-reference.md
            echo "Please run 'slangc -help-style markdown -h > docs/command-line-slangc-reference.md' or comment '/regenerate-cmdline-ref' on your PR."
            exit 1
          fi