Skip to content

Commit

Permalink
Add automated validation of animations (#45)
Browse files Browse the repository at this point in the history
* Add automated validation of animations

This runs ajv js validation library using the generated schema and any
lottie animations in directories. This will help ensure the schema
definition is consistent with what we expect.

Monitored directories are-
* tests/animations/valid
* tests/animations/invalid
* docs/static/examples

Only including a few test files in initial commit, more can be added
as needed/wanted.
  • Loading branch information
b-wils committed May 30, 2024
1 parent 04f09a5 commit 694e43e
Show file tree
Hide file tree
Showing 8 changed files with 6,008 additions and 1 deletion.
22 changes: 22 additions & 0 deletions .github/workflows/test-animations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Test Animations
on:
- push
- pull_request
jobs:
schema:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Setup
run: |
sudo apt update -q
sudo apt install -yy python3 python3-pip graphviz
pip install -r tools/requirements.txt
npm install
-
name: Validate Animations
run: |
make validate_animations
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
docs/lottie.schema.json
site/
__pycache__
node_modules

# Operating system
.DS_Store
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ SOURCE_DIR = $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
OUTPUT_DIR ?= $(CURDIR)/site

.SUFFIXES:
.PHONY: all install_dependencies docs docs_serve lottie.schema.json validate validate_full
.PHONY: all install_dependencies docs docs_serve lottie.schema.json validate validate_full validate_animations


all: docs
Expand Down Expand Up @@ -38,3 +38,9 @@ validate: $(SOURCE_DIR)/docs/lottie.schema.json

validate_full:$(OUTPUT_DIR)/index.html
$(SOURCE_DIR)/tools/schema-validate.py --html $(OUTPUT_DIR)/specs

validate_animations: $(SOURCE_DIR)/docs/lottie.schema.json
validate_animations: $(SOURCE_DIR)/tests/validate_animations.test.js
validate_animations: $(wildcard $(SOURCE_DIR)/tests/**/*.json)
validate_animations: $(wildcard $(SOURCE_DIR)/docs/static/examples/**/*.json)
npm test
Loading

0 comments on commit 694e43e

Please sign in to comment.