From 78bb5942bd90382e85f3c5ea9030a95a0cec4b7b Mon Sep 17 00:00:00 2001 From: Thomas Fossati Date: Mon, 22 Jan 2024 11:43:51 +0100 Subject: [PATCH] add environment identifier also add CI for automatically testing schema and examples Signed-off-by: Thomas Fossati --- .github/workflows/ci.yml | 19 +++++++++++++++++++ matcher-musings/Makefile | 9 ++++++++- matcher-musings/README.md | 6 +++--- matcher-musings/manifest.cddl | 6 +++--- 4 files changed, 33 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..5dfe0b8 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,19 @@ +name: CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: install CDDL and CBOR tooling + run: gem install --user-install cbor-diag cddl + - name: setup PATH + run: echo "$(gem env gempath | cut -d':' -f1)/bin" >> $GITHUB_PATH + - name: check schema and examples + run: make -C matcher-musings diff --git a/matcher-musings/Makefile b/matcher-musings/Makefile index 0865ba8..0e57474 100644 --- a/matcher-musings/Makefile +++ b/matcher-musings/Makefile @@ -1,7 +1,14 @@ Examples := $(wildcard *.json) Manifest := manifest.cddl -all: $(Manifest) $(Examples) +all: schema examples + +.PHONY: schema +schema: $(Manifest) + @cddl $< g 1 + +.PHONY: examples +examples: $(Manifest) $(Examples) @for f in $(Examples); do \ echo ">> validating $$f against $<" ; \ cddl $< validate $$f || exit 1 ; \ diff --git a/matcher-musings/README.md b/matcher-musings/README.md index 8203c02..4a3292c 100644 --- a/matcher-musings/README.md +++ b/matcher-musings/README.md @@ -32,7 +32,7 @@ claim-id = text / int ```cddl RV = { - ? desc: text + ? environment-id: any cond: { + claim-id => matcher } } ``` @@ -41,7 +41,7 @@ RV = { ```cddl xRV = { - ? desc: text + ? environment-id: any cond: { + claim-id => matcher } reason: $reason } @@ -54,7 +54,7 @@ $reason /= "insecure" ```cddl EV = { - ? desc: text + ? environment-id: any cond: { + claim-id => matcher } claims: named-claims } diff --git a/matcher-musings/manifest.cddl b/matcher-musings/manifest.cddl index 91a3883..b2dc931 100644 --- a/matcher-musings/manifest.cddl +++ b/matcher-musings/manifest.cddl @@ -32,18 +32,18 @@ named-claims = { } RV = { - ? desc: text + ? environment-id: any cond: { + claim-id => matcher } } EV = { - ? desc: text + ? environment-id: any cond: { + claim-id => matcher } claims: named-claims } xRV = { - ? desc: text + ? environment-id: any cond: { + claim-id => matcher } reason: $reason }