Skip to content

Commit 9a930a9

Browse files
committed
CI: Add obs-services JSON parser validator
1 parent e3765c0 commit 9a930a9

2 files changed

Lines changed: 56 additions & 0 deletions

File tree

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: obs-services JSON Parser Validator
2+
description: Runs quicktype againts obs-services JSON schemas and checks for any changes introduced by it
3+
inputs:
4+
failCondition:
5+
description: Controls whether failed checks also fail the workflow run
6+
required: false
7+
default: never
8+
workingDirectory:
9+
description: Working directory for checks
10+
required: false
11+
default: ${{ github.workspace }}
12+
runs:
13+
using: composite
14+
steps:
15+
- name: Check Runner Operating System 🏃‍♂️
16+
if: runner.os == 'Windows'
17+
shell: bash
18+
run: |
19+
: Check Runner Operating System 🏃‍♂️
20+
echo "::notice::obs-services-json-parser-validator action requires a macOS-based or Linux-based runner."
21+
exit 2
22+
23+
- name: Install Dependencies 🛍️
24+
if: runner.os == 'Linux'
25+
shell: bash
26+
run: |
27+
: Install Dependencies 🛍️
28+
echo ::group::Install Dependencies
29+
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
30+
echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH
31+
brew install --quiet zsh
32+
echo ::endgroup::
33+
34+
- name: Validate obs-services JSON Parser 🎛️
35+
id: result
36+
shell: zsh --no-rcs --errexit --pipefail {0}
37+
working-directory: ${{ github.workspace }}
38+
env:
39+
GITHUB_EVENT_FORCED: ${{ github.event.forced }}
40+
GITHUB_REF_BEFORE: ${{ github.event.before }}
41+
run: |
42+
: Validate obs-services JSON Parser 🎛️
43+
if (( ${+RUNNER_DEBUG} )) setopt XTRACE
44+
45+
print ::group::Install quicktype
46+
npm install -g quicktype@23.0.49
47+
print ::endgroup::
48+
49+
print ::group::Run Validation
50+
./build-aux/regen-obs-services-json-parser.zsh --fail-${{ inputs.failCondition }} --check
51+
print ::endgroup::

.github/workflows/main.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ jobs:
6565
python3 ./build-aux/format-manifest.py
6666
./CI/check-changes.sh
6767
68+
- name: 'Validate obs-services JSON Parser'
69+
uses: ./.github/actions/obs-services-json-parser-validator
70+
with:
71+
failCondition: error
72+
6873
config:
6974
name: '01 - Configure Build Jobs'
7075
runs-on: [ubuntu-22.04]

0 commit comments

Comments
 (0)