Skip to content

Commit

Permalink
CI: Add obs-services JSON parser validator
Browse files Browse the repository at this point in the history
  • Loading branch information
tytan652 committed Jul 8, 2023
1 parent 9517eb3 commit e20a219
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/actions/obs-services-json-parser-validator/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: obs-services JSON Parser Validator
description: Runs quicktype againts obs-services JSON schemas and checks for any changes introduced by it
inputs:
failCondition:
description: Controls whether failed checks also fail the workflow run
required: false
default: never
workingDirectory:
description: Working directory for checks
required: false
default: ${{ github.workspace }}
runs:
using: composite
steps:
- name: Check Runner Operating System 🏃‍♂️
if: runner.os == 'Windows'
shell: bash
run: |
: Check Runner Operating System 🏃‍♂️
echo "::notice::obs-services-json-parser-validator action requires a macOS-based or Linux-based runner."
exit 2
- name: Install Dependencies 🛍️
if: runner.os == 'Linux'
shell: bash
run: |
: Install Dependencies 🛍️
echo ::group::Install Dependencies
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH
brew install --quiet zsh
echo ::endgroup::
- name: Validate obs-services JSON Parser 🎛️
id: result
shell: zsh --no-rcs --errexit --pipefail {0}
working-directory: ${{ github.workspace }}
env:
GITHUB_EVENT_FORCED: ${{ github.event.forced }}
GITHUB_REF_BEFORE: ${{ github.event.before }}
run: |
: Validate obs-services JSON Parser 🎛️
if (( ${+RUNNER_DEBUG} )) setopt XTRACE
print ::group::Install quicktype
npm install -g quicktype@23
print ::endgroup::
print ::group::Run Validation
./build-aux/regen-obs-services-json-parser.zsh --fail-${{ inputs.failCondition }} --check
print ::endgroup::
5 changes: 5 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ jobs:
python3 ./build-aux/format-manifest.py
./CI/check-changes.sh
- name: 'Validate obs-services JSON Parser'
uses: ./.github/actions/obs-services-json-parser-validator
with:
failCondition: error

config:
name: '01 - Configure Build Jobs'
runs-on: [ubuntu-22.04]
Expand Down

0 comments on commit e20a219

Please sign in to comment.