diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml new file mode 100644 index 00000000..b4aa16a2 --- /dev/null +++ b/.github/workflows/automerge.yml @@ -0,0 +1,38 @@ +# Auto-generated by Cimas: Do not edit it manually! +# See https://github.com/metanorma/cimas +# source: https://github.com/marketplace/actions/merge-pull-requests#usage +name: automerge +on: + pull_request: + types: + - labeled + - unlabeled + - synchronize + - opened + - edited + - ready_for_review + - reopened + - unlocked + pull_request_review: + types: + - submitted + check_suite: + types: + - completed + status: {} + +# Least-privilege: pascalgn/automerge-action merges PRs with GITHUB_TOKEN, +# which requires contents:write (merge) and pull-requests:write. +permissions: + contents: write + pull-requests: write + +jobs: + automerge: + runs-on: ubuntu-latest + steps: + - id: automerge + name: automerge + uses: pascalgn/automerge-action@v0.16.4 + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..5036c3b0 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,86 @@ +# Auto-generated by Cimas: Do not edit it manually! +# See https://github.com/metanorma/cimas +name: Build and Deploy Grammars + +# Iso-only "Build and Deploy Grammars" workflow, inherited from ex- +# metanorma-model-iso and adapted for the standoc-models monorepo layout. +# Runs the lutaml-xsd grammar-package build + SPA HTML generation + GitHub +# Pages deploy. Artefact names preserved from original (metanorma-model- +# iso.lxr / .html) for downstream consumer compatibility. All build steps +# run with working-directory: iso/ since the source files (scripts, +# build-config-small.yml, images, Gemfile) preserve their pre-monorepo +# repo-root paths under the iso/ subdirectory (git filter-repo +# --to-subdirectory-filter output). + +on: + push: + branches: [main] + pull_request: + branches: [main] + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v6 + with: + submodules: 'true' + + - name: Setup Ruby + # Ruby 4.0 preserved from original ex-model-iso deploy.yml. Per + # opoudjis 2026-08-10, 4.0 is no longer experimental in the + # metanorma stack. Deploy Ruby intentionally may differ from + # make.yml's default (3.3.5); if lutaml-xsd or a transitive dep + # breaks on 4.0, revisit here. + uses: ruby/setup-ruby@v1 + with: + ruby-version: '4.0' + bundler-cache: true + working-directory: iso + + - name: Fix include paths in rnc files + working-directory: iso + run: ruby scripts/flatten-include-files.rb + + - name: Build LXR package + working-directory: iso + run: bundle exec lutaml-xsd build from-config build-config-small.yml --output metanorma-model-iso.lxr + + - name: Generate SPA documentation + working-directory: iso + run: bundle exec lutaml-xsd spa metanorma-model-iso.lxr --mode inlined --output metanorma-model-iso.html + + - name: Prepare artifact + working-directory: iso + run: | + mkdir -p _site + cp metanorma-model-iso.html _site/index.html + cp -r images _site/ + + - name: Upload artifact + uses: actions/upload-pages-artifact@v4 + with: + path: iso/_site + + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + if: ${{ github.ref == 'refs/heads/main' }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.github/workflows/make.yml b/.github/workflows/make.yml new file mode 100644 index 00000000..d26b6aba --- /dev/null +++ b/.github/workflows/make.yml @@ -0,0 +1,13 @@ +# Auto-generated by Cimas: Do not edit it manually! +# See https://github.com/metanorma/cimas +name: make + +on: + push: + branches: [main] + tags: [v*] + pull_request: + +jobs: + make: + uses: metanorma/ci/.github/workflows/standoc-models-make.yml@v1 diff --git a/bipm/Makefile b/bipm/Makefile index d715d2cc..800a476d 100644 --- a/bipm/Makefile +++ b/bipm/Makefile @@ -17,7 +17,7 @@ endif PNG := $(patsubst views/%.lutaml,images/%.png,$(SRC)) -all: $(PNG) +all: $(PNG) verify-images images/%.png: views/%.lutaml lutaml lml generate $< -o $@ -t png @@ -28,7 +28,35 @@ views/%.lutaml: models/%.wsd | views views: mkdir views +# Defensive content-type check. The lutaml CLI happily writes Graphviz dot +# source into a .png output path when the wrong flag is passed (the bug +# fixed by metanorma/ci#303 — text content in files named *.png, with +# `make all` still exiting 0). This target asserts each generated PNG +# actually starts with the PNG magic bytes, so the same class of bug fails +# CI loudly instead of passing silently. See metanorma/ci#302 for the +# broader "make-exits-0-but-output-malformed" pattern. +ifeq ($(OS),Windows_NT) +verify-images: + @echo "verify-images: skipped on Windows (file(1) not standard)" +else +verify-images: $(PNG) + @count=0; bad=0; \ + for f in $(PNG); do \ + if [ -z "$$f" ]; then continue; fi; \ + count=$$((count+1)); \ + if ! file -b "$$f" | grep -q "^PNG image data"; then \ + echo "ERROR: $$f is not a valid PNG (file -b reports: $$(file -b "$$f"))" >&2; \ + bad=$$((bad+1)); \ + fi; \ + done; \ + if [ $$bad -gt 0 ]; then \ + echo "verify-images: $$bad of $$count file(s) failed PNG content check" >&2; \ + exit 1; \ + fi; \ + echo "verify-images: $$count PNG file(s) verified" +endif + clean: $(RM) images/*.png -.PHONY: clean +.PHONY: clean verify-images all diff --git a/bsi/Makefile b/bsi/Makefile index d715d2cc..800a476d 100644 --- a/bsi/Makefile +++ b/bsi/Makefile @@ -17,7 +17,7 @@ endif PNG := $(patsubst views/%.lutaml,images/%.png,$(SRC)) -all: $(PNG) +all: $(PNG) verify-images images/%.png: views/%.lutaml lutaml lml generate $< -o $@ -t png @@ -28,7 +28,35 @@ views/%.lutaml: models/%.wsd | views views: mkdir views +# Defensive content-type check. The lutaml CLI happily writes Graphviz dot +# source into a .png output path when the wrong flag is passed (the bug +# fixed by metanorma/ci#303 — text content in files named *.png, with +# `make all` still exiting 0). This target asserts each generated PNG +# actually starts with the PNG magic bytes, so the same class of bug fails +# CI loudly instead of passing silently. See metanorma/ci#302 for the +# broader "make-exits-0-but-output-malformed" pattern. +ifeq ($(OS),Windows_NT) +verify-images: + @echo "verify-images: skipped on Windows (file(1) not standard)" +else +verify-images: $(PNG) + @count=0; bad=0; \ + for f in $(PNG); do \ + if [ -z "$$f" ]; then continue; fi; \ + count=$$((count+1)); \ + if ! file -b "$$f" | grep -q "^PNG image data"; then \ + echo "ERROR: $$f is not a valid PNG (file -b reports: $$(file -b "$$f"))" >&2; \ + bad=$$((bad+1)); \ + fi; \ + done; \ + if [ $$bad -gt 0 ]; then \ + echo "verify-images: $$bad of $$count file(s) failed PNG content check" >&2; \ + exit 1; \ + fi; \ + echo "verify-images: $$count PNG file(s) verified" +endif + clean: $(RM) images/*.png -.PHONY: clean +.PHONY: clean verify-images all diff --git a/cc/Makefile b/cc/Makefile index d715d2cc..800a476d 100644 --- a/cc/Makefile +++ b/cc/Makefile @@ -17,7 +17,7 @@ endif PNG := $(patsubst views/%.lutaml,images/%.png,$(SRC)) -all: $(PNG) +all: $(PNG) verify-images images/%.png: views/%.lutaml lutaml lml generate $< -o $@ -t png @@ -28,7 +28,35 @@ views/%.lutaml: models/%.wsd | views views: mkdir views +# Defensive content-type check. The lutaml CLI happily writes Graphviz dot +# source into a .png output path when the wrong flag is passed (the bug +# fixed by metanorma/ci#303 — text content in files named *.png, with +# `make all` still exiting 0). This target asserts each generated PNG +# actually starts with the PNG magic bytes, so the same class of bug fails +# CI loudly instead of passing silently. See metanorma/ci#302 for the +# broader "make-exits-0-but-output-malformed" pattern. +ifeq ($(OS),Windows_NT) +verify-images: + @echo "verify-images: skipped on Windows (file(1) not standard)" +else +verify-images: $(PNG) + @count=0; bad=0; \ + for f in $(PNG); do \ + if [ -z "$$f" ]; then continue; fi; \ + count=$$((count+1)); \ + if ! file -b "$$f" | grep -q "^PNG image data"; then \ + echo "ERROR: $$f is not a valid PNG (file -b reports: $$(file -b "$$f"))" >&2; \ + bad=$$((bad+1)); \ + fi; \ + done; \ + if [ $$bad -gt 0 ]; then \ + echo "verify-images: $$bad of $$count file(s) failed PNG content check" >&2; \ + exit 1; \ + fi; \ + echo "verify-images: $$count PNG file(s) verified" +endif + clean: $(RM) images/*.png -.PHONY: clean +.PHONY: clean verify-images all diff --git a/csa/Makefile b/csa/Makefile index d715d2cc..800a476d 100644 --- a/csa/Makefile +++ b/csa/Makefile @@ -17,7 +17,7 @@ endif PNG := $(patsubst views/%.lutaml,images/%.png,$(SRC)) -all: $(PNG) +all: $(PNG) verify-images images/%.png: views/%.lutaml lutaml lml generate $< -o $@ -t png @@ -28,7 +28,35 @@ views/%.lutaml: models/%.wsd | views views: mkdir views +# Defensive content-type check. The lutaml CLI happily writes Graphviz dot +# source into a .png output path when the wrong flag is passed (the bug +# fixed by metanorma/ci#303 — text content in files named *.png, with +# `make all` still exiting 0). This target asserts each generated PNG +# actually starts with the PNG magic bytes, so the same class of bug fails +# CI loudly instead of passing silently. See metanorma/ci#302 for the +# broader "make-exits-0-but-output-malformed" pattern. +ifeq ($(OS),Windows_NT) +verify-images: + @echo "verify-images: skipped on Windows (file(1) not standard)" +else +verify-images: $(PNG) + @count=0; bad=0; \ + for f in $(PNG); do \ + if [ -z "$$f" ]; then continue; fi; \ + count=$$((count+1)); \ + if ! file -b "$$f" | grep -q "^PNG image data"; then \ + echo "ERROR: $$f is not a valid PNG (file -b reports: $$(file -b "$$f"))" >&2; \ + bad=$$((bad+1)); \ + fi; \ + done; \ + if [ $$bad -gt 0 ]; then \ + echo "verify-images: $$bad of $$count file(s) failed PNG content check" >&2; \ + exit 1; \ + fi; \ + echo "verify-images: $$count PNG file(s) verified" +endif + clean: $(RM) images/*.png -.PHONY: clean +.PHONY: clean verify-images all diff --git a/gb/Makefile b/gb/Makefile index d715d2cc..800a476d 100644 --- a/gb/Makefile +++ b/gb/Makefile @@ -17,7 +17,7 @@ endif PNG := $(patsubst views/%.lutaml,images/%.png,$(SRC)) -all: $(PNG) +all: $(PNG) verify-images images/%.png: views/%.lutaml lutaml lml generate $< -o $@ -t png @@ -28,7 +28,35 @@ views/%.lutaml: models/%.wsd | views views: mkdir views +# Defensive content-type check. The lutaml CLI happily writes Graphviz dot +# source into a .png output path when the wrong flag is passed (the bug +# fixed by metanorma/ci#303 — text content in files named *.png, with +# `make all` still exiting 0). This target asserts each generated PNG +# actually starts with the PNG magic bytes, so the same class of bug fails +# CI loudly instead of passing silently. See metanorma/ci#302 for the +# broader "make-exits-0-but-output-malformed" pattern. +ifeq ($(OS),Windows_NT) +verify-images: + @echo "verify-images: skipped on Windows (file(1) not standard)" +else +verify-images: $(PNG) + @count=0; bad=0; \ + for f in $(PNG); do \ + if [ -z "$$f" ]; then continue; fi; \ + count=$$((count+1)); \ + if ! file -b "$$f" | grep -q "^PNG image data"; then \ + echo "ERROR: $$f is not a valid PNG (file -b reports: $$(file -b "$$f"))" >&2; \ + bad=$$((bad+1)); \ + fi; \ + done; \ + if [ $$bad -gt 0 ]; then \ + echo "verify-images: $$bad of $$count file(s) failed PNG content check" >&2; \ + exit 1; \ + fi; \ + echo "verify-images: $$count PNG file(s) verified" +endif + clean: $(RM) images/*.png -.PHONY: clean +.PHONY: clean verify-images all diff --git a/grammars/Gemfile b/grammars/Gemfile index 3a8d2e86..8e773abd 100644 --- a/grammars/Gemfile +++ b/grammars/Gemfile @@ -1,7 +1,14 @@ -Encoding.default_external = Encoding::UTF_8 -Encoding.default_internal = Encoding::UTF_8 - +# Auto-generated by Cimas: Do not edit it manually! +# See https://github.com/metanorma/cimas source "https://rubygems.org" -git_source(:github) { |repo| "https://github.com/#{repo}" } -gem "ruby-jing" +gem "lutaml" +gem "lutaml-uml" +# lutaml-xsd is required by repos whose CI runs `bundle exec lutaml-xsd +# build` for grammar-package generation (currently metanorma-model-iso's +# "Build and Deploy Grammars" workflow). The lutaml-xsd executable +# dropped out of the lutaml gem's runtime dep chain in the early-July +# 2026 lutaml restructuring; before that, plain `gem "lutaml"` transitively +# provided it. Adding it explicitly here so the sync survives the next +# lutaml release without silently re-breaking the workflow. +gem "lutaml-xsd" diff --git a/ieee/Makefile b/ieee/Makefile index d715d2cc..800a476d 100644 --- a/ieee/Makefile +++ b/ieee/Makefile @@ -17,7 +17,7 @@ endif PNG := $(patsubst views/%.lutaml,images/%.png,$(SRC)) -all: $(PNG) +all: $(PNG) verify-images images/%.png: views/%.lutaml lutaml lml generate $< -o $@ -t png @@ -28,7 +28,35 @@ views/%.lutaml: models/%.wsd | views views: mkdir views +# Defensive content-type check. The lutaml CLI happily writes Graphviz dot +# source into a .png output path when the wrong flag is passed (the bug +# fixed by metanorma/ci#303 — text content in files named *.png, with +# `make all` still exiting 0). This target asserts each generated PNG +# actually starts with the PNG magic bytes, so the same class of bug fails +# CI loudly instead of passing silently. See metanorma/ci#302 for the +# broader "make-exits-0-but-output-malformed" pattern. +ifeq ($(OS),Windows_NT) +verify-images: + @echo "verify-images: skipped on Windows (file(1) not standard)" +else +verify-images: $(PNG) + @count=0; bad=0; \ + for f in $(PNG); do \ + if [ -z "$$f" ]; then continue; fi; \ + count=$$((count+1)); \ + if ! file -b "$$f" | grep -q "^PNG image data"; then \ + echo "ERROR: $$f is not a valid PNG (file -b reports: $$(file -b "$$f"))" >&2; \ + bad=$$((bad+1)); \ + fi; \ + done; \ + if [ $$bad -gt 0 ]; then \ + echo "verify-images: $$bad of $$count file(s) failed PNG content check" >&2; \ + exit 1; \ + fi; \ + echo "verify-images: $$count PNG file(s) verified" +endif + clean: $(RM) images/*.png -.PHONY: clean +.PHONY: clean verify-images all diff --git a/iho/Makefile b/iho/Makefile index d715d2cc..800a476d 100644 --- a/iho/Makefile +++ b/iho/Makefile @@ -17,7 +17,7 @@ endif PNG := $(patsubst views/%.lutaml,images/%.png,$(SRC)) -all: $(PNG) +all: $(PNG) verify-images images/%.png: views/%.lutaml lutaml lml generate $< -o $@ -t png @@ -28,7 +28,35 @@ views/%.lutaml: models/%.wsd | views views: mkdir views +# Defensive content-type check. The lutaml CLI happily writes Graphviz dot +# source into a .png output path when the wrong flag is passed (the bug +# fixed by metanorma/ci#303 — text content in files named *.png, with +# `make all` still exiting 0). This target asserts each generated PNG +# actually starts with the PNG magic bytes, so the same class of bug fails +# CI loudly instead of passing silently. See metanorma/ci#302 for the +# broader "make-exits-0-but-output-malformed" pattern. +ifeq ($(OS),Windows_NT) +verify-images: + @echo "verify-images: skipped on Windows (file(1) not standard)" +else +verify-images: $(PNG) + @count=0; bad=0; \ + for f in $(PNG); do \ + if [ -z "$$f" ]; then continue; fi; \ + count=$$((count+1)); \ + if ! file -b "$$f" | grep -q "^PNG image data"; then \ + echo "ERROR: $$f is not a valid PNG (file -b reports: $$(file -b "$$f"))" >&2; \ + bad=$$((bad+1)); \ + fi; \ + done; \ + if [ $$bad -gt 0 ]; then \ + echo "verify-images: $$bad of $$count file(s) failed PNG content check" >&2; \ + exit 1; \ + fi; \ + echo "verify-images: $$count PNG file(s) verified" +endif + clean: $(RM) images/*.png -.PHONY: clean +.PHONY: clean verify-images all diff --git a/iso/Gemfile b/iso/Gemfile index c0bd579c..a8124e97 100644 --- a/iso/Gemfile +++ b/iso/Gemfile @@ -4,4 +4,3 @@ source "https://rubygems.org" gem "lutaml" gem "lutaml-uml" -gem "lutaml-xsd" diff --git a/iso/Makefile b/iso/Makefile index d715d2cc..800a476d 100644 --- a/iso/Makefile +++ b/iso/Makefile @@ -17,7 +17,7 @@ endif PNG := $(patsubst views/%.lutaml,images/%.png,$(SRC)) -all: $(PNG) +all: $(PNG) verify-images images/%.png: views/%.lutaml lutaml lml generate $< -o $@ -t png @@ -28,7 +28,35 @@ views/%.lutaml: models/%.wsd | views views: mkdir views +# Defensive content-type check. The lutaml CLI happily writes Graphviz dot +# source into a .png output path when the wrong flag is passed (the bug +# fixed by metanorma/ci#303 — text content in files named *.png, with +# `make all` still exiting 0). This target asserts each generated PNG +# actually starts with the PNG magic bytes, so the same class of bug fails +# CI loudly instead of passing silently. See metanorma/ci#302 for the +# broader "make-exits-0-but-output-malformed" pattern. +ifeq ($(OS),Windows_NT) +verify-images: + @echo "verify-images: skipped on Windows (file(1) not standard)" +else +verify-images: $(PNG) + @count=0; bad=0; \ + for f in $(PNG); do \ + if [ -z "$$f" ]; then continue; fi; \ + count=$$((count+1)); \ + if ! file -b "$$f" | grep -q "^PNG image data"; then \ + echo "ERROR: $$f is not a valid PNG (file -b reports: $$(file -b "$$f"))" >&2; \ + bad=$$((bad+1)); \ + fi; \ + done; \ + if [ $$bad -gt 0 ]; then \ + echo "verify-images: $$bad of $$count file(s) failed PNG content check" >&2; \ + exit 1; \ + fi; \ + echo "verify-images: $$count PNG file(s) verified" +endif + clean: $(RM) images/*.png -.PHONY: clean +.PHONY: clean verify-images all diff --git a/itu/Makefile b/itu/Makefile index d715d2cc..800a476d 100644 --- a/itu/Makefile +++ b/itu/Makefile @@ -17,7 +17,7 @@ endif PNG := $(patsubst views/%.lutaml,images/%.png,$(SRC)) -all: $(PNG) +all: $(PNG) verify-images images/%.png: views/%.lutaml lutaml lml generate $< -o $@ -t png @@ -28,7 +28,35 @@ views/%.lutaml: models/%.wsd | views views: mkdir views +# Defensive content-type check. The lutaml CLI happily writes Graphviz dot +# source into a .png output path when the wrong flag is passed (the bug +# fixed by metanorma/ci#303 — text content in files named *.png, with +# `make all` still exiting 0). This target asserts each generated PNG +# actually starts with the PNG magic bytes, so the same class of bug fails +# CI loudly instead of passing silently. See metanorma/ci#302 for the +# broader "make-exits-0-but-output-malformed" pattern. +ifeq ($(OS),Windows_NT) +verify-images: + @echo "verify-images: skipped on Windows (file(1) not standard)" +else +verify-images: $(PNG) + @count=0; bad=0; \ + for f in $(PNG); do \ + if [ -z "$$f" ]; then continue; fi; \ + count=$$((count+1)); \ + if ! file -b "$$f" | grep -q "^PNG image data"; then \ + echo "ERROR: $$f is not a valid PNG (file -b reports: $$(file -b "$$f"))" >&2; \ + bad=$$((bad+1)); \ + fi; \ + done; \ + if [ $$bad -gt 0 ]; then \ + echo "verify-images: $$bad of $$count file(s) failed PNG content check" >&2; \ + exit 1; \ + fi; \ + echo "verify-images: $$count PNG file(s) verified" +endif + clean: $(RM) images/*.png -.PHONY: clean +.PHONY: clean verify-images all diff --git a/m3aawg/Makefile b/m3aawg/Makefile index d715d2cc..800a476d 100644 --- a/m3aawg/Makefile +++ b/m3aawg/Makefile @@ -17,7 +17,7 @@ endif PNG := $(patsubst views/%.lutaml,images/%.png,$(SRC)) -all: $(PNG) +all: $(PNG) verify-images images/%.png: views/%.lutaml lutaml lml generate $< -o $@ -t png @@ -28,7 +28,35 @@ views/%.lutaml: models/%.wsd | views views: mkdir views +# Defensive content-type check. The lutaml CLI happily writes Graphviz dot +# source into a .png output path when the wrong flag is passed (the bug +# fixed by metanorma/ci#303 — text content in files named *.png, with +# `make all` still exiting 0). This target asserts each generated PNG +# actually starts with the PNG magic bytes, so the same class of bug fails +# CI loudly instead of passing silently. See metanorma/ci#302 for the +# broader "make-exits-0-but-output-malformed" pattern. +ifeq ($(OS),Windows_NT) +verify-images: + @echo "verify-images: skipped on Windows (file(1) not standard)" +else +verify-images: $(PNG) + @count=0; bad=0; \ + for f in $(PNG); do \ + if [ -z "$$f" ]; then continue; fi; \ + count=$$((count+1)); \ + if ! file -b "$$f" | grep -q "^PNG image data"; then \ + echo "ERROR: $$f is not a valid PNG (file -b reports: $$(file -b "$$f"))" >&2; \ + bad=$$((bad+1)); \ + fi; \ + done; \ + if [ $$bad -gt 0 ]; then \ + echo "verify-images: $$bad of $$count file(s) failed PNG content check" >&2; \ + exit 1; \ + fi; \ + echo "verify-images: $$count PNG file(s) verified" +endif + clean: $(RM) images/*.png -.PHONY: clean +.PHONY: clean verify-images all diff --git a/mpfa/Makefile b/mpfa/Makefile index d715d2cc..800a476d 100644 --- a/mpfa/Makefile +++ b/mpfa/Makefile @@ -17,7 +17,7 @@ endif PNG := $(patsubst views/%.lutaml,images/%.png,$(SRC)) -all: $(PNG) +all: $(PNG) verify-images images/%.png: views/%.lutaml lutaml lml generate $< -o $@ -t png @@ -28,7 +28,35 @@ views/%.lutaml: models/%.wsd | views views: mkdir views +# Defensive content-type check. The lutaml CLI happily writes Graphviz dot +# source into a .png output path when the wrong flag is passed (the bug +# fixed by metanorma/ci#303 — text content in files named *.png, with +# `make all` still exiting 0). This target asserts each generated PNG +# actually starts with the PNG magic bytes, so the same class of bug fails +# CI loudly instead of passing silently. See metanorma/ci#302 for the +# broader "make-exits-0-but-output-malformed" pattern. +ifeq ($(OS),Windows_NT) +verify-images: + @echo "verify-images: skipped on Windows (file(1) not standard)" +else +verify-images: $(PNG) + @count=0; bad=0; \ + for f in $(PNG); do \ + if [ -z "$$f" ]; then continue; fi; \ + count=$$((count+1)); \ + if ! file -b "$$f" | grep -q "^PNG image data"; then \ + echo "ERROR: $$f is not a valid PNG (file -b reports: $$(file -b "$$f"))" >&2; \ + bad=$$((bad+1)); \ + fi; \ + done; \ + if [ $$bad -gt 0 ]; then \ + echo "verify-images: $$bad of $$count file(s) failed PNG content check" >&2; \ + exit 1; \ + fi; \ + echo "verify-images: $$count PNG file(s) verified" +endif + clean: $(RM) images/*.png -.PHONY: clean +.PHONY: clean verify-images all diff --git a/nist/Makefile b/nist/Makefile index d715d2cc..800a476d 100644 --- a/nist/Makefile +++ b/nist/Makefile @@ -17,7 +17,7 @@ endif PNG := $(patsubst views/%.lutaml,images/%.png,$(SRC)) -all: $(PNG) +all: $(PNG) verify-images images/%.png: views/%.lutaml lutaml lml generate $< -o $@ -t png @@ -28,7 +28,35 @@ views/%.lutaml: models/%.wsd | views views: mkdir views +# Defensive content-type check. The lutaml CLI happily writes Graphviz dot +# source into a .png output path when the wrong flag is passed (the bug +# fixed by metanorma/ci#303 — text content in files named *.png, with +# `make all` still exiting 0). This target asserts each generated PNG +# actually starts with the PNG magic bytes, so the same class of bug fails +# CI loudly instead of passing silently. See metanorma/ci#302 for the +# broader "make-exits-0-but-output-malformed" pattern. +ifeq ($(OS),Windows_NT) +verify-images: + @echo "verify-images: skipped on Windows (file(1) not standard)" +else +verify-images: $(PNG) + @count=0; bad=0; \ + for f in $(PNG); do \ + if [ -z "$$f" ]; then continue; fi; \ + count=$$((count+1)); \ + if ! file -b "$$f" | grep -q "^PNG image data"; then \ + echo "ERROR: $$f is not a valid PNG (file -b reports: $$(file -b "$$f"))" >&2; \ + bad=$$((bad+1)); \ + fi; \ + done; \ + if [ $$bad -gt 0 ]; then \ + echo "verify-images: $$bad of $$count file(s) failed PNG content check" >&2; \ + exit 1; \ + fi; \ + echo "verify-images: $$count PNG file(s) verified" +endif + clean: $(RM) images/*.png -.PHONY: clean +.PHONY: clean verify-images all diff --git a/ogc/Makefile b/ogc/Makefile index d715d2cc..800a476d 100644 --- a/ogc/Makefile +++ b/ogc/Makefile @@ -17,7 +17,7 @@ endif PNG := $(patsubst views/%.lutaml,images/%.png,$(SRC)) -all: $(PNG) +all: $(PNG) verify-images images/%.png: views/%.lutaml lutaml lml generate $< -o $@ -t png @@ -28,7 +28,35 @@ views/%.lutaml: models/%.wsd | views views: mkdir views +# Defensive content-type check. The lutaml CLI happily writes Graphviz dot +# source into a .png output path when the wrong flag is passed (the bug +# fixed by metanorma/ci#303 — text content in files named *.png, with +# `make all` still exiting 0). This target asserts each generated PNG +# actually starts with the PNG magic bytes, so the same class of bug fails +# CI loudly instead of passing silently. See metanorma/ci#302 for the +# broader "make-exits-0-but-output-malformed" pattern. +ifeq ($(OS),Windows_NT) +verify-images: + @echo "verify-images: skipped on Windows (file(1) not standard)" +else +verify-images: $(PNG) + @count=0; bad=0; \ + for f in $(PNG); do \ + if [ -z "$$f" ]; then continue; fi; \ + count=$$((count+1)); \ + if ! file -b "$$f" | grep -q "^PNG image data"; then \ + echo "ERROR: $$f is not a valid PNG (file -b reports: $$(file -b "$$f"))" >&2; \ + bad=$$((bad+1)); \ + fi; \ + done; \ + if [ $$bad -gt 0 ]; then \ + echo "verify-images: $$bad of $$count file(s) failed PNG content check" >&2; \ + exit 1; \ + fi; \ + echo "verify-images: $$count PNG file(s) verified" +endif + clean: $(RM) images/*.png -.PHONY: clean +.PHONY: clean verify-images all diff --git a/ribose/Makefile b/ribose/Makefile index d715d2cc..800a476d 100644 --- a/ribose/Makefile +++ b/ribose/Makefile @@ -17,7 +17,7 @@ endif PNG := $(patsubst views/%.lutaml,images/%.png,$(SRC)) -all: $(PNG) +all: $(PNG) verify-images images/%.png: views/%.lutaml lutaml lml generate $< -o $@ -t png @@ -28,7 +28,35 @@ views/%.lutaml: models/%.wsd | views views: mkdir views +# Defensive content-type check. The lutaml CLI happily writes Graphviz dot +# source into a .png output path when the wrong flag is passed (the bug +# fixed by metanorma/ci#303 — text content in files named *.png, with +# `make all` still exiting 0). This target asserts each generated PNG +# actually starts with the PNG magic bytes, so the same class of bug fails +# CI loudly instead of passing silently. See metanorma/ci#302 for the +# broader "make-exits-0-but-output-malformed" pattern. +ifeq ($(OS),Windows_NT) +verify-images: + @echo "verify-images: skipped on Windows (file(1) not standard)" +else +verify-images: $(PNG) + @count=0; bad=0; \ + for f in $(PNG); do \ + if [ -z "$$f" ]; then continue; fi; \ + count=$$((count+1)); \ + if ! file -b "$$f" | grep -q "^PNG image data"; then \ + echo "ERROR: $$f is not a valid PNG (file -b reports: $$(file -b "$$f"))" >&2; \ + bad=$$((bad+1)); \ + fi; \ + done; \ + if [ $$bad -gt 0 ]; then \ + echo "verify-images: $$bad of $$count file(s) failed PNG content check" >&2; \ + exit 1; \ + fi; \ + echo "verify-images: $$count PNG file(s) verified" +endif + clean: $(RM) images/*.png -.PHONY: clean +.PHONY: clean verify-images all diff --git a/standoc/Makefile b/standoc/Makefile index d715d2cc..800a476d 100644 --- a/standoc/Makefile +++ b/standoc/Makefile @@ -17,7 +17,7 @@ endif PNG := $(patsubst views/%.lutaml,images/%.png,$(SRC)) -all: $(PNG) +all: $(PNG) verify-images images/%.png: views/%.lutaml lutaml lml generate $< -o $@ -t png @@ -28,7 +28,35 @@ views/%.lutaml: models/%.wsd | views views: mkdir views +# Defensive content-type check. The lutaml CLI happily writes Graphviz dot +# source into a .png output path when the wrong flag is passed (the bug +# fixed by metanorma/ci#303 — text content in files named *.png, with +# `make all` still exiting 0). This target asserts each generated PNG +# actually starts with the PNG magic bytes, so the same class of bug fails +# CI loudly instead of passing silently. See metanorma/ci#302 for the +# broader "make-exits-0-but-output-malformed" pattern. +ifeq ($(OS),Windows_NT) +verify-images: + @echo "verify-images: skipped on Windows (file(1) not standard)" +else +verify-images: $(PNG) + @count=0; bad=0; \ + for f in $(PNG); do \ + if [ -z "$$f" ]; then continue; fi; \ + count=$$((count+1)); \ + if ! file -b "$$f" | grep -q "^PNG image data"; then \ + echo "ERROR: $$f is not a valid PNG (file -b reports: $$(file -b "$$f"))" >&2; \ + bad=$$((bad+1)); \ + fi; \ + done; \ + if [ $$bad -gt 0 ]; then \ + echo "verify-images: $$bad of $$count file(s) failed PNG content check" >&2; \ + exit 1; \ + fi; \ + echo "verify-images: $$count PNG file(s) verified" +endif + clean: $(RM) images/*.png -.PHONY: clean +.PHONY: clean verify-images all diff --git a/un/Makefile b/un/Makefile index d715d2cc..800a476d 100644 --- a/un/Makefile +++ b/un/Makefile @@ -17,7 +17,7 @@ endif PNG := $(patsubst views/%.lutaml,images/%.png,$(SRC)) -all: $(PNG) +all: $(PNG) verify-images images/%.png: views/%.lutaml lutaml lml generate $< -o $@ -t png @@ -28,7 +28,35 @@ views/%.lutaml: models/%.wsd | views views: mkdir views +# Defensive content-type check. The lutaml CLI happily writes Graphviz dot +# source into a .png output path when the wrong flag is passed (the bug +# fixed by metanorma/ci#303 — text content in files named *.png, with +# `make all` still exiting 0). This target asserts each generated PNG +# actually starts with the PNG magic bytes, so the same class of bug fails +# CI loudly instead of passing silently. See metanorma/ci#302 for the +# broader "make-exits-0-but-output-malformed" pattern. +ifeq ($(OS),Windows_NT) +verify-images: + @echo "verify-images: skipped on Windows (file(1) not standard)" +else +verify-images: $(PNG) + @count=0; bad=0; \ + for f in $(PNG); do \ + if [ -z "$$f" ]; then continue; fi; \ + count=$$((count+1)); \ + if ! file -b "$$f" | grep -q "^PNG image data"; then \ + echo "ERROR: $$f is not a valid PNG (file -b reports: $$(file -b "$$f"))" >&2; \ + bad=$$((bad+1)); \ + fi; \ + done; \ + if [ $$bad -gt 0 ]; then \ + echo "verify-images: $$bad of $$count file(s) failed PNG content check" >&2; \ + exit 1; \ + fi; \ + echo "verify-images: $$count PNG file(s) verified" +endif + clean: $(RM) images/*.png -.PHONY: clean +.PHONY: clean verify-images all