Skip to content
Draft
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
fail-fast: false
matrix:
node-version: [18.x, 20.x, 22.x, 24.x, 26.x]
spec: [1-1-turtle, 1-1-ntriples, 1-1-nquads, 1-1-trig, 1-2-turtle, 1-2-ntriples, 1-2-nquads, 1-2-trig]
spec: [1-1-turtle, 1-1-ntriples, 1-1-nquads, 1-1-trig, 1-2-turtle, 1-2-ntriples, 1-2-nquads, 1-2-trig, n3-parser, n3-extended]
needs: build
steps:
- uses: actions/checkout@v7
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/refresh-spec-cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Refresh spec cache

on:
schedule:
# Weekly; the RDF 1.2 suites still evolve while the WG is in flight.
# Weekly; the RDF 1.2 and N3 suites are still evolving.
- cron: '0 4 * * 1'
workflow_dispatch:

Expand All @@ -16,7 +16,7 @@ jobs:
pull-requests: write
steps:
- uses: actions/checkout@v7
- name: Pin the upstream test-suite revision
- name: Pin the upstream test-suite revisions
env:
GH_TOKEN: ${{ github.token }}
run: |
Expand All @@ -25,6 +25,9 @@ jobs:
[[ "$sha" =~ ^[0-9a-f]{40}$ ]] || { echo "Bad SHA for $suite: '$sha'" >&2; exit 1; }
echo "$suite $sha"
done > spec/cache-key.txt
sha=$(gh api 'repos/w3c-cg/N3/commits?sha=master&path=tests/N3Tests&per_page=1' --jq '.[0].sha')
[[ "$sha" =~ ^[0-9a-f]{40}$ ]] || { echo "Bad SHA for n3: '$sha'" >&2; exit 1; }
echo "n3 $sha" >> spec/cache-key.txt
- uses: peter-evans/create-pull-request@v8
with:
add-paths: spec/cache-key.txt
Expand All @@ -33,7 +36,7 @@ jobs:
commit-message: 'chore(ci): refetch upstream spec suites'
title: 'chore(ci): refetch upstream spec suites'
body: >-
The w3c/rdf-tests suites changed upstream. Merging rotates the
spec jobs' fixture cache key so they refetch the suites cold.
The w3c/rdf-tests or w3c-cg/N3 suites changed upstream. Merging
updates their pinned revisions and refreshes the spec fixtures.
Note: CI does not run automatically on workflow-created PRs;
close and reopen (or push) to trigger it.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*.log
.nyc_output
.n3-tests
.rdf-test-suite-cache
/browser
docs
Expand Down
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"test": "jest",
"lint": "eslint src perf test spec",
"prepare": "npm run build",
"spec": "npm run spec-1-1 && npm run spec-1-2",
"spec": "npm run spec-1-1 && npm run spec-1-2 && npm run spec-n3",
"spec-1-1": "npm run spec-1-1-turtle && npm run spec-1-1-ntriples && npm run spec-1-1-nquads && npm run spec-1-1-trig",
"spec-1-1-earl": "npm run spec-1-1-earl-turtle && npm run spec-1-1-earl-ntriples && npm run spec-1-1-earl-nquads && npm run spec-1-1-earl-trig",
"spec-1-1-ntriples": "rdf-test-suite spec/parser.js https://w3c.github.io/rdf-tests/rdf/rdf11/rdf-n-triples/manifest.ttl -i '{ \"format\": \"n-triples\" }' -c .rdf-test-suite-cache/",
Expand All @@ -81,7 +81,11 @@
"spec-1-2-earl-nquads": "rdf-test-suite spec/parser.js https://w3c.github.io/rdf-tests/rdf/rdf12/rdf-n-quads/syntax/manifest.ttl -i '{ \"format\": \"n-quads\" }' -c .rdf-test-suite-cache/ -o earl -p spec/earl-meta.json > spec/earl-nquads.ttl",
"spec-1-2-earl-turtle": "rdf-test-suite spec/parser.js https://w3c.github.io/rdf-tests/rdf/rdf12/rdf-turtle/syntax/manifest.ttl -i '{ \"format\": \"turtle\" }' -c .rdf-test-suite-cache/ -o earl -p spec/earl-meta.json > spec/earl-turtle.ttl",
"spec-1-2-earl-trig": "rdf-test-suite spec/parser.js https://w3c.github.io/rdf-tests/rdf/rdf12/rdf-trig/syntax/manifest.ttl -i '{ \"format\": \"trig\" }' -c .rdf-test-suite-cache/ -o earl -p spec/earl-meta.json > spec/earl-trig.ttl",
"spec-clean": "rm -r .rdf-test-suite-cache/",
"spec-n3": "npm run spec-n3-parser && npm run spec-n3-extended",
"spec-n3-fetch": "sh scripts/fetch-n3-tests.sh",
"spec-n3-parser": "npm run spec-n3-fetch && rdf-test-suite spec/parser.js https://w3c-cg.github.io/N3/tests/N3Tests/manifest-parser.ttl -i '{ \"format\": \"text/n3\" }' -m 'https://w3c-cg.github.io/N3/tests/~.n3-tests/tests/'",
"spec-n3-extended": "npm run spec-n3-fetch && rdf-test-suite spec/parser.js https://w3c-cg.github.io/N3/tests/N3Tests/manifest-extended.ttl -i '{ \"format\": \"text/n3\" }' -m 'https://w3c-cg.github.io/N3/tests/~.n3-tests/tests/'",
"spec-clean": "rm -rf .rdf-test-suite-cache/ .n3-tests/",
"docs": "cd src && docco *.js -o ../docs && cd .."
},
"repository": {
Expand Down
22 changes: 22 additions & 0 deletions scripts/fetch-n3-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh
set -eu

checkout=.n3-tests
revision=$(awk '$1 == "n3" { print $2; exit }' spec/cache-key.txt)

if ! printf '%s\n' "$revision" | grep -Eq '^[0-9a-f]{40}$'; then
echo "Invalid N3 test-suite revision: '$revision'" >&2
exit 1
fi

if test -d "$checkout/.git"; then
test "$(git -C "$checkout" rev-parse HEAD)" = "$revision" && exit 0
else
rm -rf "$checkout"
git init --quiet "$checkout"
git -C "$checkout" remote add origin https://github.com/w3c-cg/N3.git
git -C "$checkout" sparse-checkout set --no-cone tests/N3Tests
fi

git -C "$checkout" fetch --quiet --depth 1 --filter=blob:none origin "$revision"
git -C "$checkout" checkout --quiet --detach FETCH_HEAD
1 change: 1 addition & 0 deletions spec/cache-key.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
rdf11 d7a2a463ec33da50de52c4ff6c1d14ce4bd65f09
rdf12 411d8cd27b20ccb3115c17c18c62cde9ac6960c1
n3 16309b7e5f2e26c426afdd7825f4cb693a7395ea
Loading