@linked.archi/la-gram-git 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/NOTICE +2 -0
- package/README.md +214 -2
- package/assets/arch-decision/arch-decision-metamodel.ttl +44 -0
- package/assets/arch-decision/arch-decision-onto.ttl +1566 -0
- package/assets/arch-decision/arch-decision-shapes.ttl +582 -0
- package/assets/arch-decision/arch-decision-tax.ttl +129 -0
- package/assets/arch-processes/arch-processes-metamodel.ttl +42 -0
- package/assets/arch-processes/arch-processes-tax.ttl +136 -0
- package/assets/arch-processes/archProcesses-shapes.ttl +189 -0
- package/assets/arch-processes/archProcesses.ttl +953 -0
- package/assets/archimate3/archimate3.2-element-shapes.ttl +379 -0
- package/assets/archimate3/archimate3.2-metamodel.ttl +205 -0
- package/assets/archimate3/archimate3.2-notation.ttl +1503 -0
- package/assets/archimate3/archimate3.2-onto.ttl +1579 -0
- package/assets/archimate3/archimate3.2-presentation-contexts.ttl +90 -0
- package/assets/archimate3/archimate3.2-principle-shapes.ttl +923 -0
- package/assets/archimate3/archimate3.2-questions.ttl +1125 -0
- package/assets/archimate3/archimate3.2-reference-data.ttl +74 -0
- package/assets/archimate3/archimate3.2-relationship-shapes.ttl +30956 -0
- package/assets/archimate3/archimate3.2-relationship-tables.ttl +5992 -0
- package/assets/archimate3/archimate3.2-tax.ttl +724 -0
- package/assets/archimate3/archimate3.2-viewpoint-shapes.ttl +59 -0
- package/assets/archimate3/archimate3.2-viewpoints.ttl +793 -0
- package/assets/archimate3/icons/and-junction.svg +3 -0
- package/assets/archimate3/icons/application-collaboration.svg +22 -0
- package/assets/archimate3/icons/application-component.svg +18 -0
- package/assets/archimate3/icons/application-event.svg +15 -0
- package/assets/archimate3/icons/application-function.svg +14 -0
- package/assets/archimate3/icons/application-interaction.svg +17 -0
- package/assets/archimate3/icons/application-interface.svg +16 -0
- package/assets/archimate3/icons/application-process.svg +14 -0
- package/assets/archimate3/icons/application-service.svg +14 -0
- package/assets/archimate3/icons/artifact.svg +16 -0
- package/assets/archimate3/icons/assessment.svg +17 -0
- package/assets/archimate3/icons/business-actor.svg +22 -0
- package/assets/archimate3/icons/business-collaboration.svg +21 -0
- package/assets/archimate3/icons/business-event.svg +15 -0
- package/assets/archimate3/icons/business-function.svg +14 -0
- package/assets/archimate3/icons/business-interaction.svg +18 -0
- package/assets/archimate3/icons/business-interface.svg +16 -0
- package/assets/archimate3/icons/business-object.svg +14 -0
- package/assets/archimate3/icons/business-process.svg +15 -0
- package/assets/archimate3/icons/business-role.svg +16 -0
- package/assets/archimate3/icons/business-service.svg +14 -0
- package/assets/archimate3/icons/capability.svg +40 -0
- package/assets/archimate3/icons/communication-network.svg +18 -0
- package/assets/archimate3/icons/constraint.svg +18 -0
- package/assets/archimate3/icons/contract.svg +13 -0
- package/assets/archimate3/icons/course-of-action.svg +20 -0
- package/assets/archimate3/icons/data-object.svg +14 -0
- package/assets/archimate3/icons/deliverable.svg +11 -0
- package/assets/archimate3/icons/device.svg +18 -0
- package/assets/archimate3/icons/distribution-network.svg +19 -0
- package/assets/archimate3/icons/driver.svg +24 -0
- package/assets/archimate3/icons/equipment.svg +31 -0
- package/assets/archimate3/icons/facility.svg +16 -0
- package/assets/archimate3/icons/gap.svg +22 -0
- package/assets/archimate3/icons/glyphs/activity.svg +3 -0
- package/assets/archimate3/icons/glyphs/actor.svg +14 -0
- package/assets/archimate3/icons/glyphs/application-component.svg +12 -0
- package/assets/archimate3/icons/glyphs/artifact.svg +9 -0
- package/assets/archimate3/icons/glyphs/assessment.svg +9 -0
- package/assets/archimate3/icons/glyphs/capability.svg +32 -0
- package/assets/archimate3/icons/glyphs/cloud-gear.svg +3 -0
- package/assets/archimate3/icons/glyphs/collaboration.svg +15 -0
- package/assets/archimate3/icons/glyphs/communication-network.svg +12 -0
- package/assets/archimate3/icons/glyphs/constraint.svg +10 -0
- package/assets/archimate3/icons/glyphs/contract.svg +5 -0
- package/assets/archimate3/icons/glyphs/course-of-action.svg +12 -0
- package/assets/archimate3/icons/glyphs/data-object.svg +4 -0
- package/assets/archimate3/icons/glyphs/deliverable.svg +3 -0
- package/assets/archimate3/icons/glyphs/device.svg +10 -0
- package/assets/archimate3/icons/glyphs/distribution-network.svg +11 -0
- package/assets/archimate3/icons/glyphs/driver.svg +16 -0
- package/assets/archimate3/icons/glyphs/equipment.svg +22 -0
- package/assets/archimate3/icons/glyphs/event.svg +6 -0
- package/assets/archimate3/icons/glyphs/facility.svg +7 -0
- package/assets/archimate3/icons/glyphs/function.svg +6 -0
- package/assets/archimate3/icons/glyphs/gap.svg +14 -0
- package/assets/archimate3/icons/glyphs/goal.svg +10 -0
- package/assets/archimate3/icons/glyphs/grouping.svg +4 -0
- package/assets/archimate3/icons/glyphs/interaction.svg +10 -0
- package/assets/archimate3/icons/glyphs/interface.svg +8 -0
- package/assets/archimate3/icons/glyphs/location.svg +6 -0
- package/assets/archimate3/icons/glyphs/material.svg +12 -0
- package/assets/archimate3/icons/glyphs/meaning.svg +3 -0
- package/assets/archimate3/icons/glyphs/node.svg +8 -0
- package/assets/archimate3/icons/glyphs/object.svg +4 -0
- package/assets/archimate3/icons/glyphs/outcome.svg +16 -0
- package/assets/archimate3/icons/glyphs/path.svg +10 -0
- package/assets/archimate3/icons/glyphs/person-silhouette.svg +3 -0
- package/assets/archimate3/icons/glyphs/plateau.svg +8 -0
- package/assets/archimate3/icons/glyphs/principle.svg +12 -0
- package/assets/archimate3/icons/glyphs/process.svg +6 -0
- package/assets/archimate3/icons/glyphs/product.svg +4 -0
- package/assets/archimate3/icons/glyphs/representation.svg +4 -0
- package/assets/archimate3/icons/glyphs/requirement.svg +6 -0
- package/assets/archimate3/icons/glyphs/resource.svg +14 -0
- package/assets/archimate3/icons/glyphs/role.svg +6 -0
- package/assets/archimate3/icons/glyphs/service.svg +6 -0
- package/assets/archimate3/icons/glyphs/stakeholder.svg +6 -0
- package/assets/archimate3/icons/glyphs/system-software.svg +14 -0
- package/assets/archimate3/icons/glyphs/value-stream.svg +3 -0
- package/assets/archimate3/icons/glyphs/value.svg +3 -0
- package/assets/archimate3/icons/glyphs/work-package.svg +4 -0
- package/assets/archimate3/icons/goal.svg +18 -0
- package/assets/archimate3/icons/grouping.svg +12 -0
- package/assets/archimate3/icons/implementation-event.svg +15 -0
- package/assets/archimate3/icons/location.svg +14 -0
- package/assets/archimate3/icons/material.svg +21 -0
- package/assets/archimate3/icons/meaning.svg +11 -0
- package/assets/archimate3/icons/node.svg +14 -0
- package/assets/archimate3/icons/or-junction.svg +3 -0
- package/assets/archimate3/icons/outcome.svg +25 -0
- package/assets/archimate3/icons/path.svg +18 -0
- package/assets/archimate3/icons/plateau.svg +16 -0
- package/assets/archimate3/icons/principle.svg +21 -0
- package/assets/archimate3/icons/product.svg +12 -0
- package/assets/archimate3/icons/representation.svg +12 -0
- package/assets/archimate3/icons/requirement.svg +14 -0
- package/assets/archimate3/icons/resource.svg +23 -0
- package/assets/archimate3/icons/stakeholder.svg +15 -0
- package/assets/archimate3/icons/system-software.svg +22 -0
- package/assets/archimate3/icons/technology-collaboration.svg +22 -0
- package/assets/archimate3/icons/technology-event.svg +15 -0
- package/assets/archimate3/icons/technology-function.svg +14 -0
- package/assets/archimate3/icons/technology-interaction.svg +18 -0
- package/assets/archimate3/icons/technology-interface.svg +16 -0
- package/assets/archimate3/icons/technology-process.svg +14 -0
- package/assets/archimate3/icons/technology-service.svg +14 -0
- package/assets/archimate3/icons/value-stream.svg +11 -0
- package/assets/archimate3/icons/value.svg +11 -0
- package/assets/archimate3/icons/work-package.svg +12 -0
- package/assets/archimate4/archimate4-element-shapes.ttl +404 -0
- package/assets/archimate4/archimate4-metamodel.ttl +179 -0
- package/assets/archimate4/archimate4-notation.ttl +1147 -0
- package/assets/archimate4/archimate4-onto.ttl +1559 -0
- package/assets/archimate4/archimate4-presentation-contexts.ttl +60 -0
- package/assets/archimate4/archimate4-principle-shapes.ttl +893 -0
- package/assets/archimate4/archimate4-questions.ttl +1224 -0
- package/assets/archimate4/archimate4-reference-data.ttl +56 -0
- package/assets/archimate4/archimate4-relationship-shapes.ttl +16920 -0
- package/assets/archimate4/archimate4-relationship-tables.ttl +3200 -0
- package/assets/archimate4/archimate4-tax.ttl +749 -0
- package/assets/archimate4/archimate4-viewpoint-shapes.ttl +55 -0
- package/assets/archimate4/archimate4-viewpoints.ttl +777 -0
- package/assets/archimate4/icons/and-junction.svg +3 -0
- package/assets/archimate4/icons/application-component.svg +18 -0
- package/assets/archimate4/icons/application-interface.svg +16 -0
- package/assets/archimate4/icons/artifact.svg +16 -0
- package/assets/archimate4/icons/assessment.svg +17 -0
- package/assets/archimate4/icons/business-actor.svg +22 -0
- package/assets/archimate4/icons/business-interface.svg +16 -0
- package/assets/archimate4/icons/business-object.svg +14 -0
- package/assets/archimate4/icons/capability.svg +40 -0
- package/assets/archimate4/icons/collaboration.svg +21 -0
- package/assets/archimate4/icons/communication-network.svg +18 -0
- package/assets/archimate4/icons/course-of-action.svg +20 -0
- package/assets/archimate4/icons/data-object.svg +14 -0
- package/assets/archimate4/icons/deliverable.svg +11 -0
- package/assets/archimate4/icons/device.svg +18 -0
- package/assets/archimate4/icons/distribution-network.svg +19 -0
- package/assets/archimate4/icons/driver.svg +24 -0
- package/assets/archimate4/icons/equipment.svg +31 -0
- package/assets/archimate4/icons/event.svg +15 -0
- package/assets/archimate4/icons/facility.svg +16 -0
- package/assets/archimate4/icons/function.svg +13 -0
- package/assets/archimate4/icons/glyphs/activity.svg +3 -0
- package/assets/archimate4/icons/glyphs/actor.svg +14 -0
- package/assets/archimate4/icons/glyphs/application-component.svg +12 -0
- package/assets/archimate4/icons/glyphs/artifact.svg +9 -0
- package/assets/archimate4/icons/glyphs/assessment.svg +9 -0
- package/assets/archimate4/icons/glyphs/capability.svg +32 -0
- package/assets/archimate4/icons/glyphs/cloud-gear.svg +3 -0
- package/assets/archimate4/icons/glyphs/collaboration.svg +15 -0
- package/assets/archimate4/icons/glyphs/communication-network.svg +12 -0
- package/assets/archimate4/icons/glyphs/constraint.svg +10 -0
- package/assets/archimate4/icons/glyphs/contract.svg +5 -0
- package/assets/archimate4/icons/glyphs/course-of-action.svg +12 -0
- package/assets/archimate4/icons/glyphs/data-object.svg +4 -0
- package/assets/archimate4/icons/glyphs/deliverable.svg +3 -0
- package/assets/archimate4/icons/glyphs/device.svg +10 -0
- package/assets/archimate4/icons/glyphs/distribution-network.svg +11 -0
- package/assets/archimate4/icons/glyphs/driver.svg +16 -0
- package/assets/archimate4/icons/glyphs/equipment.svg +22 -0
- package/assets/archimate4/icons/glyphs/event.svg +6 -0
- package/assets/archimate4/icons/glyphs/facility.svg +7 -0
- package/assets/archimate4/icons/glyphs/function.svg +6 -0
- package/assets/archimate4/icons/glyphs/gap.svg +14 -0
- package/assets/archimate4/icons/glyphs/goal.svg +10 -0
- package/assets/archimate4/icons/glyphs/grouping.svg +4 -0
- package/assets/archimate4/icons/glyphs/interaction.svg +10 -0
- package/assets/archimate4/icons/glyphs/interface.svg +8 -0
- package/assets/archimate4/icons/glyphs/location.svg +6 -0
- package/assets/archimate4/icons/glyphs/material.svg +12 -0
- package/assets/archimate4/icons/glyphs/meaning.svg +3 -0
- package/assets/archimate4/icons/glyphs/node.svg +8 -0
- package/assets/archimate4/icons/glyphs/object.svg +4 -0
- package/assets/archimate4/icons/glyphs/outcome.svg +16 -0
- package/assets/archimate4/icons/glyphs/path.svg +10 -0
- package/assets/archimate4/icons/glyphs/person-silhouette.svg +3 -0
- package/assets/archimate4/icons/glyphs/plateau.svg +8 -0
- package/assets/archimate4/icons/glyphs/principle.svg +12 -0
- package/assets/archimate4/icons/glyphs/process.svg +6 -0
- package/assets/archimate4/icons/glyphs/product.svg +4 -0
- package/assets/archimate4/icons/glyphs/representation.svg +4 -0
- package/assets/archimate4/icons/glyphs/requirement.svg +6 -0
- package/assets/archimate4/icons/glyphs/resource.svg +14 -0
- package/assets/archimate4/icons/glyphs/role.svg +6 -0
- package/assets/archimate4/icons/glyphs/service.svg +6 -0
- package/assets/archimate4/icons/glyphs/stakeholder.svg +6 -0
- package/assets/archimate4/icons/glyphs/system-software.svg +14 -0
- package/assets/archimate4/icons/glyphs/value-stream.svg +3 -0
- package/assets/archimate4/icons/glyphs/value.svg +3 -0
- package/assets/archimate4/icons/glyphs/work-package.svg +4 -0
- package/assets/archimate4/icons/goal.svg +18 -0
- package/assets/archimate4/icons/grouping.svg +12 -0
- package/assets/archimate4/icons/location.svg +14 -0
- package/assets/archimate4/icons/material.svg +21 -0
- package/assets/archimate4/icons/meaning.svg +11 -0
- package/assets/archimate4/icons/node.svg +14 -0
- package/assets/archimate4/icons/or-junction.svg +3 -0
- package/assets/archimate4/icons/outcome.svg +25 -0
- package/assets/archimate4/icons/path.svg +18 -0
- package/assets/archimate4/icons/plateau.svg +16 -0
- package/assets/archimate4/icons/principle.svg +21 -0
- package/assets/archimate4/icons/process.svg +15 -0
- package/assets/archimate4/icons/product.svg +12 -0
- package/assets/archimate4/icons/requirement.svg +14 -0
- package/assets/archimate4/icons/resource.svg +23 -0
- package/assets/archimate4/icons/role.svg +16 -0
- package/assets/archimate4/icons/service.svg +13 -0
- package/assets/archimate4/icons/stakeholder.svg +15 -0
- package/assets/archimate4/icons/system-software.svg +22 -0
- package/assets/archimate4/icons/technology-interface.svg +16 -0
- package/assets/archimate4/icons/value-stream.svg +11 -0
- package/assets/archimate4/icons/value.svg +11 -0
- package/assets/archimate4/icons/work-package.svg +12 -0
- package/assets/basic/basic-metamodel.ttl +100 -0
- package/assets/basic/basic-notation-bubble.ttl +175 -0
- package/assets/basic/basic-notation.ttl +172 -0
- package/assets/basic/basic-onto.ttl +171 -0
- package/assets/basic/basic-presentation-contexts.ttl +70 -0
- package/assets/basic/basic-tax.ttl +130 -0
- package/assets/basic/icons/aggregation.svg +7 -0
- package/assets/basic/icons/association.svg +6 -0
- package/assets/basic/icons/element.svg +5 -0
- package/assets/basic/icons/glyphs/aggregation.svg +6 -0
- package/assets/basic/icons/glyphs/association.svg +5 -0
- package/assets/basic/icons/glyphs/element.svg +5 -0
- package/assets/basic/icons/glyphs/relationship.svg +5 -0
- package/assets/basic/icons/relationship.svg +7 -0
- package/assets/basic/notation-bubble/icons/aggregation.svg +7 -0
- package/assets/basic/notation-bubble/icons/association.svg +6 -0
- package/assets/basic/notation-bubble/icons/element.svg +5 -0
- package/assets/basic/notation-bubble/icons/glyphs/aggregation.svg +6 -0
- package/assets/basic/notation-bubble/icons/glyphs/association.svg +5 -0
- package/assets/basic/notation-bubble/icons/glyphs/element.svg +5 -0
- package/assets/basic/notation-bubble/icons/glyphs/relationship.svg +5 -0
- package/assets/basic/notation-bubble/icons/relationship.svg +7 -0
- package/assets/catalog.ttl +7302 -0
- package/assets/core/core-notation.ttl +131 -0
- package/assets/core/core-onto.ttl +2811 -0
- package/assets/core/core-questions.ttl +957 -0
- package/assets/core/core-shapes.ttl +915 -0
- package/assets/core/core-vis-onto.ttl +1408 -0
- package/assets/core/core-vis-shapes.ttl +840 -0
- package/assets/core-vis/markers/circle-dot.svg +3 -0
- package/assets/core-vis/markers/closed-arrowhead.svg +3 -0
- package/assets/core-vis/markers/filled-diamond.svg +3 -0
- package/assets/core-vis/markers/half-arrowhead.svg +3 -0
- package/assets/core-vis/markers/hollow-arrowhead.svg +3 -0
- package/assets/core-vis/markers/hollow-diamond.svg +3 -0
- package/assets/core-vis/markers/open-arrowhead.svg +3 -0
- package/ci/README.md +126 -0
- package/ci/github/la-gram-git.yml +30 -0
- package/ci/gitlab/la-gram-git.gitlab-ci.yml +20 -0
- package/dist/637.js +51 -0
- package/dist/637.js.map +1 -0
- package/dist/la-gram-git.js +22936 -0
- package/dist/la-gram-git.js.map +1 -0
- package/package.json +31 -4
package/ci/README.md
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# la-gram-git in CI
|
|
2
|
+
|
|
3
|
+
Two templates check the la-gram models a pull or merge request changes, and comment on the request with
|
|
4
|
+
its changes by element:
|
|
5
|
+
|
|
6
|
+
| File | For | Set up with |
|
|
7
|
+
|---|---|---|
|
|
8
|
+
| [`github/la-gram-git.yml`](github/la-gram-git.yml) | GitHub Actions | `npx @linked.archi/la-gram-git init github` |
|
|
9
|
+
| [`gitlab/la-gram-git.gitlab-ci.yml`](gitlab/la-gram-git.gitlab-ci.yml) | GitLab CI — gitlab.com and self-managed | `npx @linked.archi/la-gram-git init gitlab` |
|
|
10
|
+
|
|
11
|
+
`init` copies the template into the repository you run it in and overwrites nothing: on GitLab, a
|
|
12
|
+
repository that has a `.gitlab-ci.yml` gets `la-gram-git.gitlab-ci.yml` beside it, to include. You can copy
|
|
13
|
+
the files by hand as well. Commit the result, and open a request.
|
|
14
|
+
|
|
15
|
+
## What the job does
|
|
16
|
+
|
|
17
|
+
1. **`la-gram-git check --base <target branch>`** checks every model file in the repository: a file with a
|
|
18
|
+
model extension (`.ttl`, `.trig`, `.jsonld`, `.nq`, `.nt`, `.rdf`) and an `arch:Model` in it. Other RDF
|
|
19
|
+
files, such as vendored ontologies and shapes, are left alone. **The job fails** when a model file:
|
|
20
|
+
- does not parse;
|
|
21
|
+
- is not exactly as la-gram writes it (the output says which `la-gram-git fix` command rewrites it);
|
|
22
|
+
- refers to something it does not have — a relationship end, a view's node, a folder entry;
|
|
23
|
+
- has a SHACL violation that the change adds. Violations the file already had where the branch started
|
|
24
|
+
are listed, not failed, so an old model can be improved one request at a time.
|
|
25
|
+
|
|
26
|
+
Warnings and Info are counted, never failed. Findings of the shapes' SPARQL-based rules (ArchiMate's
|
|
27
|
+
principles, viewpoint conformance) are listed and do not fail the job for now. Each finding names the
|
|
28
|
+
IRI of its shape, which opens the shape's documentation. On GitHub each failure is also an annotation
|
|
29
|
+
on the file.
|
|
30
|
+
2. **`la-gram-git diff <target branch> --comment`** writes the request's model changes by element as
|
|
31
|
+
Markdown — the concepts added, changed and removed, as la-gram's History tab words them — into the job's
|
|
32
|
+
log, and posts them as a comment on the request. On a later push it updates the same comment. It runs
|
|
33
|
+
whether or not the check passed, and a comment that cannot be made never fails the job.
|
|
34
|
+
|
|
35
|
+
The checks use the metamodels bundled with la-gram-git: ArchiMate 4.0 and 3.2, la-gram's basic metamodel and
|
|
36
|
+
Linked.Archi's core. A model declaring a metamodel the tool does not have is validated without it, and the
|
|
37
|
+
output says so.
|
|
38
|
+
|
|
39
|
+
## GitHub Actions
|
|
40
|
+
|
|
41
|
+
The workflow runs on `pull_request`. It comments with the workflow's own `GITHUB_TOKEN`, which is why it
|
|
42
|
+
asks for `pull-requests: write`. A pull request from a fork gets a read-only token: its check runs, and its
|
|
43
|
+
diff goes to the job's log instead of a comment.
|
|
44
|
+
|
|
45
|
+
## GitLab CI
|
|
46
|
+
|
|
47
|
+
The job runs in merge request pipelines (`$CI_PIPELINE_SOURCE == "merge_request_event"`). If the rest of your
|
|
48
|
+
pipeline runs on branch pushes, GitLab then runs both a branch pipeline and a merge request pipeline for
|
|
49
|
+
each push to a branch with an open request; GitLab's documentation on `workflow:rules` describes how to keep
|
|
50
|
+
one.
|
|
51
|
+
|
|
52
|
+
**The comment needs a token.** The job's own `CI_JOB_TOKEN` cannot comment on a merge request, so
|
|
53
|
+
la-gram-git reads one from the CI/CD variable `LA_GRAM_GIT_TOKEN`:
|
|
54
|
+
|
|
55
|
+
1. Create a **project access token** (or a group access token, to share one across projects) with the role
|
|
56
|
+
**Reporter**, the scope **`api`**, and an expiry date.
|
|
57
|
+
2. Add it under *Settings › CI/CD › Variables* as `LA_GRAM_GIT_TOKEN`, **masked**. Leave it unprotected:
|
|
58
|
+
merge request pipelines run on the request's branch, which is not protected, and a protected variable is
|
|
59
|
+
not given to them. Anyone who can run a pipeline in the project can therefore use it — which is why it
|
|
60
|
+
should have no more than Reporter and `api`.
|
|
61
|
+
|
|
62
|
+
Without the variable the job still checks, and the diff goes to the job's log. The token is sent only to
|
|
63
|
+
your GitLab's API (`CI_API_V4_URL`), in a header, and never written to the log.
|
|
64
|
+
|
|
65
|
+
**Self-managed GitLab** works the same way: la-gram-git reads the instance's API address from the job.
|
|
66
|
+
The template uses the `node:22` image from Docker Hub. If your runners cannot reach it, use a mirror, or
|
|
67
|
+
la-gram-git's own image (below).
|
|
68
|
+
|
|
69
|
+
## Variations
|
|
70
|
+
|
|
71
|
+
- **Pin a version.** The templates run `@linked.archi/la-gram-git@0`, the newest 0.x release. Write
|
|
72
|
+
`@0.1.0` to pin one, and update it when you choose.
|
|
73
|
+
- **Your own shapes.** Add `--shapes <folder>` to the `check` line to validate against a folder of your
|
|
74
|
+
repository's or organisation's shapes (`.ttl`) as well as the metamodels'. Each file names its graph
|
|
75
|
+
with an `owl:Ontology`, as a shapes document does; one that does not is refused by name.
|
|
76
|
+
- **Only some files.** Name files or folders after the command: `check models/ --base …`.
|
|
77
|
+
- **The container image instead of npx.** It has la-gram-git installed, with Node.js and Git, so the job
|
|
78
|
+
downloads nothing more. On GitLab:
|
|
79
|
+
|
|
80
|
+
```yaml
|
|
81
|
+
la-gram-git:
|
|
82
|
+
image: ghcr.io/linked-archi/la-gram-git:0
|
|
83
|
+
rules:
|
|
84
|
+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
85
|
+
variables:
|
|
86
|
+
GIT_DEPTH: 0
|
|
87
|
+
script:
|
|
88
|
+
- git fetch --quiet origin "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"
|
|
89
|
+
- la-gram-git check --base "origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"
|
|
90
|
+
after_script:
|
|
91
|
+
- la-gram-git diff "origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" --comment
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
On GitHub Actions, as the job's container. Keep the template's `on:` and `permissions:`:
|
|
95
|
+
|
|
96
|
+
```yaml
|
|
97
|
+
jobs:
|
|
98
|
+
models:
|
|
99
|
+
runs-on: ubuntu-latest
|
|
100
|
+
container: ghcr.io/linked-archi/la-gram-git:0
|
|
101
|
+
steps:
|
|
102
|
+
- uses: actions/checkout@v4
|
|
103
|
+
with:
|
|
104
|
+
fetch-depth: 0
|
|
105
|
+
- name: Check the models
|
|
106
|
+
run: la-gram-git check --base "origin/${{ github.base_ref }}"
|
|
107
|
+
- name: Comment with their changes by element
|
|
108
|
+
if: always()
|
|
109
|
+
run: la-gram-git diff "origin/${{ github.base_ref }}" --comment
|
|
110
|
+
env:
|
|
111
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Tags: each version (`0.1.0`), its major version (`0`) and `latest`, each for `linux/amd64` and
|
|
115
|
+
`linux/arm64`, so x86 and ARM runners take the image for their platform. Its tags, platforms, local use
|
|
116
|
+
and copying it into your own registry are described in
|
|
117
|
+
[the package's README](https://github.com/linked-archi/la-gram/blob/main/packages/la-gram-git/README.md#the-container-image).
|
|
118
|
+
|
|
119
|
+
## Merging, not only checking
|
|
120
|
+
|
|
121
|
+
CI checks a merge; it does not do one. The host merges a request as text, and two changes to one model
|
|
122
|
+
file can conflict as text even when they changed different elements. la-gram itself merges by element
|
|
123
|
+
when it saves to Git, so most teams need nothing more. For people who merge with `git` on the command line,
|
|
124
|
+
`la-gram-git init merge-driver` sets up la-gram's merge in their clone. GitHub and gitlab.com cannot run a
|
|
125
|
+
merge driver when they merge a request; a self-managed GitLab can, configured by its administrator:
|
|
126
|
+
see [la-gram's merge driver on Gitaly](https://github.com/linked-archi/la-gram/blob/main/packages/la-gram-git/docs/gitaly.md).
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# la-gram-git on GitHub Actions: checks the la-gram models a pull request
|
|
2
|
+
# changes, and comments with their changes by element.
|
|
3
|
+
# https://github.com/linked-archi/la-gram/tree/main/ci
|
|
4
|
+
# Copy to .github/workflows/la-gram-git.yml (`npx @linked.archi/la-gram-git init github` does).
|
|
5
|
+
name: la-gram models
|
|
6
|
+
|
|
7
|
+
on:
|
|
8
|
+
pull_request:
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
pull-requests: write # for the comment; a pull request from a fork gets none, and goes without
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
models:
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
with:
|
|
20
|
+
fetch-depth: 0 # the branch the change goes into, to compare with
|
|
21
|
+
- uses: actions/setup-node@v4
|
|
22
|
+
with:
|
|
23
|
+
node-version: 22
|
|
24
|
+
- name: Check the models
|
|
25
|
+
run: npx --yes @linked.archi/la-gram-git@0 check --base "origin/${{ github.base_ref }}"
|
|
26
|
+
- name: Comment with their changes by element
|
|
27
|
+
if: always()
|
|
28
|
+
run: npx --yes @linked.archi/la-gram-git@0 diff "origin/${{ github.base_ref }}" --comment
|
|
29
|
+
env:
|
|
30
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# la-gram-git on GitLab CI (gitlab.com and self-managed): checks the la-gram
|
|
2
|
+
# models a merge request changes, and comments with their changes by element.
|
|
3
|
+
# https://github.com/linked-archi/la-gram/tree/main/ci
|
|
4
|
+
# Copy into .gitlab-ci.yml, or beside it and `include:` it
|
|
5
|
+
# (`npx @linked.archi/la-gram-git init gitlab` does).
|
|
6
|
+
#
|
|
7
|
+
# The comment needs a project or group access token (role Reporter, scope api)
|
|
8
|
+
# in a masked CI/CD variable named LA_GRAM_GIT_TOKEN: the job's own token cannot
|
|
9
|
+
# comment. Without it the changes are written to the job's log instead.
|
|
10
|
+
la-gram-git:
|
|
11
|
+
image: node:22
|
|
12
|
+
rules:
|
|
13
|
+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
14
|
+
variables:
|
|
15
|
+
GIT_DEPTH: 0 # the branch the change goes into, to compare with
|
|
16
|
+
script:
|
|
17
|
+
- git fetch --quiet origin "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"
|
|
18
|
+
- npx --yes @linked.archi/la-gram-git@0 check --base "origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"
|
|
19
|
+
after_script:
|
|
20
|
+
- npx --yes @linked.archi/la-gram-git@0 diff "origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" --comment
|
package/dist/637.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export const __webpack_esm_id__ = 637;
|
|
2
|
+
export const __webpack_esm_ids__ = [637];
|
|
3
|
+
export const __webpack_esm_modules__ = {
|
|
4
|
+
|
|
5
|
+
/***/ 637
|
|
6
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
7
|
+
|
|
8
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
9
|
+
/* harmony export */ ElectronPlatformService: () => (/* binding */ ElectronPlatformService)
|
|
10
|
+
/* harmony export */ });
|
|
11
|
+
/* harmony import */ var _desktop_bridge_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(971);
|
|
12
|
+
|
|
13
|
+
const TURTLE = [{ name: 'Turtle files', extensions: ['ttl'] }];
|
|
14
|
+
class ElectronPlatformService {
|
|
15
|
+
constructor(bridge) {
|
|
16
|
+
const found = bridge ?? (0,_desktop_bridge_js__WEBPACK_IMPORTED_MODULE_0__/* .desktopBridge */ .g)();
|
|
17
|
+
if (!found)
|
|
18
|
+
throw new Error('The desktop bridge (window.laGramDesktop) is not available');
|
|
19
|
+
this.bridge = found;
|
|
20
|
+
}
|
|
21
|
+
async readFile(path) {
|
|
22
|
+
const filePath = path ?? (await this.showOpenDialog());
|
|
23
|
+
if (!filePath) {
|
|
24
|
+
throw new Error('No file selected');
|
|
25
|
+
}
|
|
26
|
+
return this.bridge.readFile(filePath);
|
|
27
|
+
}
|
|
28
|
+
async writeFile(content, suggestedName) {
|
|
29
|
+
const filePath = await this.bridge.showSaveDialog(TURTLE, suggestedName);
|
|
30
|
+
if (!filePath) {
|
|
31
|
+
throw new Error('Save cancelled');
|
|
32
|
+
}
|
|
33
|
+
await this.bridge.writeFile(filePath, content);
|
|
34
|
+
}
|
|
35
|
+
async showOpenDialog(filters) {
|
|
36
|
+
return this.bridge.showOpenDialog(filters ?? TURTLE);
|
|
37
|
+
}
|
|
38
|
+
async showSaveDialog(filters) {
|
|
39
|
+
return this.bridge.showSaveDialog(filters ?? TURTLE);
|
|
40
|
+
}
|
|
41
|
+
isDesktop() {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
/***/ }
|
|
48
|
+
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=637.js.map
|
package/dist/637.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dist/637.js","mappings":";;;;;;;;;;;AAQwE;AAExE,MAAM,MAAM,GAAiB,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,UAAU,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAEtE,MAAM,uBAAuB;IAGlC,YAAY,MAAsB;QAChC,MAAM,KAAK,GAAG,MAAM,IAAI,0EAAa,EAAE,CAAC;QACxC,IAAI,CAAC,KAAK;YAAE,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;QAC1F,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,IAAa;QAC1B,MAAM,QAAQ,GAAG,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;QACvD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;QACtC,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,OAAe,EAAE,aAAsB;QACrD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;QACzE,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;QACpC,CAAC;QACD,MAAM,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACjD,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,OAAsB;QACzC,OAAO,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,OAAO,IAAI,MAAM,CAAC,CAAC;IACvD,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,OAAsB;QACzC,OAAO,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,OAAO,IAAI,MAAM,CAAC,CAAC;IACvD,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sources":["webpack://la-gram/./src/platform/electron-platform-service.ts"],"sourcesContent":["/**\n * Electron desktop implementation of PlatformService.\n *\n * The renderer has no Node and no Electron modules (`electron-main.ts`): native\n * file dialogs and file access go through the preload bridge,\n * `window.laGramDesktop` (`desktop-bridge.ts`), to the main process.\n */\nimport type { PlatformService, FileFilter } from './interfaces.js';\nimport { desktopBridge, type DesktopBridge } from './desktop-bridge.js';\n\nconst TURTLE: FileFilter[] = [{ name: 'Turtle files', extensions: ['ttl'] }];\n\nexport class ElectronPlatformService implements PlatformService {\n private readonly bridge: DesktopBridge;\n\n constructor(bridge?: DesktopBridge) {\n const found = bridge ?? desktopBridge();\n if (!found) throw new Error('The desktop bridge (window.laGramDesktop) is not available');\n this.bridge = found;\n }\n\n async readFile(path?: string): Promise<{ content: string; name: string }> {\n const filePath = path ?? (await this.showOpenDialog());\n if (!filePath) {\n throw new Error('No file selected');\n }\n return this.bridge.readFile(filePath);\n }\n\n async writeFile(content: string, suggestedName?: string): Promise<void> {\n const filePath = await this.bridge.showSaveDialog(TURTLE, suggestedName);\n if (!filePath) {\n throw new Error('Save cancelled');\n }\n await this.bridge.writeFile(filePath, content);\n }\n\n async showOpenDialog(filters?: FileFilter[]): Promise<string | null> {\n return this.bridge.showOpenDialog(filters ?? TURTLE);\n }\n\n async showSaveDialog(filters?: FileFilter[]): Promise<string | null> {\n return this.bridge.showSaveDialog(filters ?? TURTLE);\n }\n\n isDesktop(): boolean {\n return true;\n }\n}\n"],"names":[],"sourceRoot":""}
|