Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 7 additions & 45 deletions .github/workflows/main-pr-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,57 +8,19 @@ on:
- 'shapes/**/*.ttl'

jobs:
main-pr-validation:
validate:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0 # needed to compare with origin/main

- name: Set up Python
uses: actions/setup-python@v5
- name: Setup Node.js
uses: actions/setup-node@v4
with:
python-version: "3.11"
node-version-file: .nvmrc

- name: Install dependencies
run: |
pip install pyshacl rdflib rich

- name: Determine changed TTL files
id: changes
run: |
git fetch origin main:main || true
BASE=$(git merge-base HEAD main || echo "main")

changed_files=$(git diff --name-only "$BASE"...HEAD | grep '^shapes/.*\.ttl$' || true)

echo "Changed TTL files:"
echo "$changed_files"
# Output to GitHub Actions
echo "changed_files<<EOF" >> $GITHUB_OUTPUT
echo "$changed_files" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

- name: Validate SHACL shapes for changed files
if: steps.changes.outputs.changed_files != ''
run: |
echo "Validating changed TTL files:"
echo "${{ steps.changes.outputs.changed_files }}"
ok=true
for file in ${{ steps.changes.outputs.changed_files }}; do
echo "───────────────────────────────"
echo "Validating $file..."
python scripts/validate-shacl-shapes-file.py "$file" || ok=false
done
$ok || exit 1

- name: Metadata & immutability checks for changed files
if: steps.changes.outputs.changed_files != ''
run: |
python scripts/check-metadata-and-immutability-file.py ${{ steps.changes.outputs.changed_files }}
run: npm install

- name: Namespace & naming checks for changed files
if: steps.changes.outputs.changed_files != ''
run: |
python scripts/check-namespaces-and-names-file.py ${{ steps.changes.outputs.changed_files }}
- name: Run tests
run: npm test
26 changes: 8 additions & 18 deletions .github/workflows/main-push-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,29 @@ on:
- main
paths:
- 'shapes/**/*.ttl'
workflow_dispatch: # allows manual triggering
workflow_dispatch:

jobs:
main-push-validation:
validate:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0 # needed to compare with origin/main

- name: Skip validation for Dependabot
if: github.actor == 'dependabot[bot]'
run: echo "Skipping SHACL validation for Dependabot PR"

- name: Set up Python
- name: Setup Node.js
if: github.actor != 'dependabot[bot]'
uses: actions/setup-python@v5
uses: actions/setup-node@v4
with:
python-version: '3.11'
node-version-file: .nvmrc

- name: Install dependencies
if: github.actor != 'dependabot[bot]'
run: pip install pyshacl rdflib rich

- name: Validate all TTL files
if: github.actor != 'dependabot[bot]'
run: bash scripts/validate-shacl-shapes-dir.sh

- name: Metadata & immutability checks
if: github.actor != 'dependabot[bot]'
run: python scripts/check-metadata-and-immutability-dir.py
run: npm install

- name: Namespace & naming checks
- name: Run tests
if: github.actor != 'dependabot[bot]'
run: python scripts/check-namespaces-and-names-dir.py
run: npm test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
23 changes: 20 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ When contributing:
## Pull Request Process

* Create branch
* Ensure the shape validates before opening a PR
* [validation scripts](./scripts) are available
* Ensure the shape validates before opening a PR — run `npm test` locally (see [Validation](#validation) below)
* Open a PR and complete the questions in the PR template provided
* Respond to review feedback and iterate as needed

Expand Down Expand Up @@ -62,7 +61,7 @@ address-shape:AddressMinimalShape



Shape names should use PascalCase abd end with `Shape`, e.g.:
Shape names should use PascalCase and end with `Shape`, e.g.:

```
address-shape:AddressShape
Expand All @@ -71,6 +70,24 @@ address-shape:AddressShape



## Validation

Run validation locally before opening a PR:

```bash
npm install
npm test
```

This checks all shapes in the `shapes/` directory for:

- **Turtle syntax** — the file parses as valid RDF
- **Required metadata** — each `sh:NodeShape` must have `sh:name`, `dct:created` (ISO 8601 date), and `vs:term_status` (one of `unstable`, `testing`, `stable`, `archaic`)
- **Namespace conventions** — shape URIs must use `https://solidproject.org/shapes/` and end with `Shape` in PascalCase
- **Prefix conventions** — prefix labels must be lowercase and contain only `[a-z0-9-_]`

The same checks run automatically in CI on every PR and push to `main`.

## Validation Rules
A goal of solid/shapes is to support interoperability in the Solid ecosystem, and with this in mind, it is recommended that shapes should have constraints that maximise their potential reuse.

Expand Down
236 changes: 236 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading