Skip to content

Commit

Permalink
Add Makefile to simplify the build process
Browse files Browse the repository at this point in the history
  • Loading branch information
mbasaglia committed Feb 7, 2024
1 parent 8096331 commit 734c38b
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 9 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ jobs:
pip install -r tools/requirements.txt
-
name: Docs
run: |
./tools/schema-merge.py
./tools/mkdocs build -d site
run: make
-
name: Setup Pages
uses: actions/configure-pages@v4
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/test-schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,7 @@ jobs:
sudo apt update -q
sudo apt install -yy python3 python3-pip graphviz
pip install -r tools/requirements.txt
-
name: Build
run: |
./tools/schema-merge.py
./tools/mkdocs build -d site
-
name: Validate
run: |
./tools/schema-validate.py --html site/specs
make validate_full
40 changes: 40 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Executable names
PIP ?= pip
PYTHON ?= python
MKDOCS ?= PYTHONPATH="$(SOURCE_DIR)/tools" mkdocs

# Paths
SOURCE_DIR = $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
OUTPUT_DIR ?= $(CURDIR)/site

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


all: docs

lottie.schema.json:$(SOURCE_DIR)/docs/lottie.schema.json

$(SOURCE_DIR)/docs/lottie.schema.json: $(wildcard $(SOURCE_DIR)/schema/**/*.json)
$(SOURCE_DIR)/docs/lottie.schema.json: $(SOURCE_DIR)/tools/schema-merge.py
$(SOURCE_DIR)/tools/schema-merge.py

docs:$(OUTPUT_DIR)/index.html

$(OUTPUT_DIR)/index.html:$(wildcard $(SOURCE_DIR)/docs/**/*)
$(OUTPUT_DIR)/index.html:$(SOURCE_DIR)/docs/lottie.schema.json
$(OUTPUT_DIR)/index.html:$(SOURCE_DIR)/tools/lottie_markdown.py
$(MKDOCS) build -f $(SOURCE_DIR)/mkdocs.yml -d $(OUTPUT_DIR)

docs_serve:$(SOURCE_DIR)/docs/lottie.schema.json
$(MKDOCS) serve -f $(SOURCE_DIR)/mkdocs.yml

install_dependencies:
$(PIP) install -r $(SOURCE_DIR)/tools/requirements.txt

validate: $(SOURCE_DIR)/docs/lottie.schema.json
$(SOURCE_DIR)/tools/schema-validate.py


validate_full:$(OUTPUT_DIR)/index.html
$(SOURCE_DIR)/tools/schema-validate.py --html $(OUTPUT_DIR)/specs
28 changes: 28 additions & 0 deletions docs/editing/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,34 @@ To build a static HTML site run the following:

The output will be in `/site`.

### Makefile

To simplify the build process, there is a makefile that allows you to
run all the commands above with a single `make` invocation`.

Follows a list of useful `make` targets:

```bash
# Installs Python packages
make install_dependencies

# Builds the schema and docs into HTML
make

# Equivalent to mkdocs serve
make docs_serve

# Builds only the combined schema
make lottie.schema.json

# Runs basic schema validation (without rebuilding the HTML)
make validate

# Runs the full validation, including building the HTML pages
make validate_full
```


### Schema Validation

You can validate schema syntax and internal references using
Expand Down

0 comments on commit 734c38b

Please sign in to comment.