Skip to content

Commit 7e2e790

Browse files
namedgraphclaude
andcommitted
Run the versioning http-tests in CI when the test token is configured
A VERSIONING_TEST_TOKEN repo secret + VERSIONING_TEST_REPO repo variable activate versioning for the CI stack: credentials.trig is generated, the versioning config is appended to the test system.trig with a per-run path prefix (isolates concurrent runs), and a compose overlay enables the credentials secret. Forks get no secrets, so the stack boots as before and the suite's skip-guards make the scripts no-ops. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 0c5cf56 commit 7e2e790

6 files changed

Lines changed: 44 additions & 5 deletions

File tree

.github/workflows/http-tests.yml

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ jobs:
1010
ASF_ARCHIVE: https://archive.apache.org/dist/
1111
JENA_VERSION: 6.1.0
1212
BASE_URI: https://localhost:4443/
13+
VERSIONING_TEST_TOKEN: ${{ secrets.VERSIONING_TEST_TOKEN }} # absent on forks - the versioning suite then skips
14+
VERSIONING_TEST_REPO: ${{ vars.VERSIONING_TEST_REPO }}
1315
steps:
1416
- name: Install Linux packages
1517
run: sudo apt-get update && sudo apt-get install -qq raptor2-utils libxml2-utils && sudo apt-get install curl
@@ -42,8 +44,35 @@ jobs:
4244
printf "%s" "${{ secrets.HTTP_TEST_SECRETARY_CERT_PASSWORD }}" > ./secrets/secretary_cert_password.txt
4345
printf "%s" "${{ secrets.HTTP_TEST_SECRETARY_CERT_PASSWORD }}" > ./secrets/client_truststore_password.txt
4446
shell: bash
47+
- name: Enable graph versioning
48+
if: env.VERSIONING_TEST_TOKEN != ''
49+
run: |
50+
printf '@prefix a:\t<https://w3id.org/atomgraph/core#> .\n\n<urn:linkeddatahub:versioning/end-user>\n{\n <urn:linkeddatahub:versioning/end-user> a:authToken "%s" .\n}\n' "$VERSIONING_TEST_TOKEN" > ./secrets/credentials.trig
51+
cat >> ./http-tests/config/system.trig <<EOF
52+
53+
# GitHub-backed graph versioning (appended by CI; per-run path prefix isolates concurrent runs)
54+
55+
@prefix doap: <http://usefulinc.com/ns/doap#> .
56+
@prefix github: <https://w3id.org/atomgraph/linkeddatahub/services/github#> .
57+
58+
<urn:linkeddatahub:apps/end-user>
59+
{
60+
<urn:linkeddatahub:apps/end-user> lapp:versioningRepository <urn:linkeddatahub:versioning/end-user> .
61+
}
62+
63+
<urn:linkeddatahub:versioning/end-user>
64+
{
65+
<urn:linkeddatahub:versioning/end-user> a doap:GitRepository ;
66+
doap:location <https://github.com/$VERSIONING_TEST_REPO> ;
67+
github:branch "main" ;
68+
github:pathPrefix "graphs-${{ github.run_id }}" .
69+
}
70+
EOF
71+
echo "COMPOSE_VERSIONING=-f ./http-tests/docker-compose.versioning.yml" >> "$GITHUB_ENV"
72+
echo "VERSIONING_PATH_PREFIX=graphs-${{ github.run_id }}" >> "$GITHUB_ENV"
73+
shell: bash
4574
- name: Build Docker image & Run Docker containers
46-
run: docker compose -f docker-compose.yml -f ./http-tests/docker-compose.http-tests.yml --env-file ./http-tests/.env up --build -d
75+
run: docker compose -f docker-compose.yml -f ./http-tests/docker-compose.http-tests.yml ${COMPOSE_VERSIONING:-} --env-file ./http-tests/.env up --build -d
4776
- name: Wait for the server to start...
4877
run: while ! (status=$(curl -k -s -w "%{http_code}\n" https://localhost:4443 -o /dev/null) && echo "$status" && echo "$status" | grep "403") ; do sleep 1 ; done # wait for the webapp to start (returns 403 by default)
4978
- name: Fix certificate permissions on the host
@@ -54,6 +83,8 @@ jobs:
5483
run: ./run.sh "$PWD/ssl/owner/cert.pem" "${{ secrets.HTTP_TEST_OWNER_CERT_PASSWORD }}" "$PWD/ssl/secretary/cert.pem" "${{ secrets.HTTP_TEST_SECRETARY_CERT_PASSWORD }}"
5584
shell: bash
5685
working-directory: http-tests
86+
env:
87+
GITHUB_TOKEN: ${{ secrets.VERSIONING_TEST_TOKEN }} # the versioning suite (and its gh api calls) authenticate with this; empty = suite skips
5788
- name: Generate test summary
5889
if: always()
5990
run: python3 scripts/generate_test_summary.py http-tests/out http-tests/out/report.md
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# enables the credentials secret for the graph versioning http-tests; added by CI only when the test token is configured
2+
secrets:
3+
credentials:
4+
file: ../secrets/credentials.trig
5+
services:
6+
linkeddatahub:
7+
secrets:
8+
- credentials

http-tests/versioning/DELETE-removes-file.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ add-agent-to-group.sh \
2525

2626
slug=$(uuidgen | tr '[:upper:]' '[:lower:]')
2727
doc_url="${END_USER_BASE_URL}${slug}/"
28-
path="graphs/${slug}.nt"
28+
path="${VERSIONING_PATH_PREFIX:-graphs}/${slug}.nt"
2929

3030
# create a document and wait for its file to appear
3131

http-tests/versioning/GET-timemap.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ add-agent-to-group.sh \
2525

2626
slug=$(uuidgen | tr '[:upper:]' '[:lower:]')
2727
doc_url="${END_USER_BASE_URL}${slug}/"
28-
path="graphs/${slug}.nt"
28+
path="${VERSIONING_PATH_PREFIX:-graphs}/${slug}.nt"
2929

3030
# create a document and wait for its versioning commit
3131

http-tests/versioning/GET-version.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ add-agent-to-group.sh \
2525

2626
slug=$(uuidgen | tr '[:upper:]' '[:lower:]')
2727
doc_url="${END_USER_BASE_URL}${slug}/"
28-
path="graphs/${slug}.nt"
28+
path="${VERSIONING_PATH_PREFIX:-graphs}/${slug}.nt"
2929

3030
put_document()
3131
{

http-tests/versioning/PUT-creates-commit.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ echo "<${doc_url}> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://ww
3838

3939
# wait for the async versioning commit to appear in the repository
4040

41-
path="graphs/${slug}.nt"
41+
path="${VERSIONING_PATH_PREFIX:-graphs}/${slug}.nt"
4242

4343
for i in $(seq 1 30); do
4444
if gh api "repos/${VERSIONING_TEST_REPO}/contents/${path}?ref=main" > /dev/null 2>&1; then

0 commit comments

Comments
 (0)