Skip to content

Commit a9a9ae4

Browse files
authored
Add the workflow files for the sparql-conformance webapp (#1559)
With this commit, the first demo of a webapp that checks QLever's conformance with the official W3C SPARQL test suite will be activated for each pull request and commit to master.
1 parent 81a9350 commit a9a9ae4

File tree

2 files changed

+151
-0
lines changed

2 files changed

+151
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Upload conformance tests result
2+
3+
on:
4+
workflow_run:
5+
workflows: [sparql-conformance]
6+
types:
7+
- completed
8+
9+
jobs:
10+
upload:
11+
env:
12+
SERVER_URL: https://qlever.cs.uni-freiburg.de/sparql-conformance-uploader
13+
API_KEY: ${{ secrets.SPARQL_CONFORMANCE_TOKEN }}
14+
runs-on: ubuntu-latest
15+
if: github.event.workflow_run.conclusion == 'success'
16+
steps:
17+
- name: 'Download artifact'
18+
uses: actions/github-script@v6
19+
with:
20+
script: |
21+
var artifacts = await github.rest.actions.listWorkflowRunArtifacts({
22+
owner: context.repo.owner,
23+
repo: context.repo.repo,
24+
run_id: ${{github.event.workflow_run.id }},
25+
});
26+
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
27+
return artifact.name == "conformance-report"
28+
})[0];
29+
var download = await github.rest.actions.downloadArtifact({
30+
owner: context.repo.owner,
31+
repo: context.repo.repo,
32+
artifact_id: matchArtifact.id,
33+
archive_format: 'zip',
34+
});
35+
var fs = require('fs');
36+
fs.writeFileSync('${{github.workspace}}/conformance-report.zip', Buffer.from(download.data));
37+
- run: unzip conformance-report.zip
38+
# Read the metadata into environment variables.
39+
- name: "Read github event"
40+
run: echo "github_event=`cat event`" >> $GITHUB_ENV
41+
- name: "Read PR number"
42+
run: echo "pr_number=`cat pr`" >> $GITHUB_ENV
43+
- name: "Read Github Ref"
44+
run: echo "original_github_ref=`cat github_ref`" >> $GITHUB_ENV;
45+
- name: "Read Github SHA"
46+
run: echo "commit_sha=`cat sha`" >> $GITHUB_ENV;
47+
- name: "Read Github Repository"
48+
run: echo "original_github_repository=`cat github_repository`" >> $GITHUB_ENV;
49+
- name: "Submit data to server"
50+
run: |
51+
response=$(curl -s -o temp_response.txt -w "%{http_code}" \
52+
-H "x-api-key: $API_KEY" \
53+
-H "event: ${{ env.github_event }}" \
54+
-H "sha: ${{ env.commit_sha }}" \
55+
-H "pr-number: ${{ env.pr_number }}" \
56+
-F "file=@${{env.commit_sha}}.json.bz2" \
57+
$SERVER_URL/upload)
58+
59+
echo "Server response:"
60+
cat temp_response.txt
61+
echo "HTTP Status: $response"
62+
if [ "$response" -gt 200 ]; then
63+
echo "Server did not respond with status 200. Failing the workflow."
64+
exit 1
65+
fi
+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: sparql-conformance
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
merge_group:
9+
10+
jobs:
11+
build:
12+
env:
13+
compiler: clang
14+
compiler-version: 16
15+
build-type: Release
16+
cmake-flags: "-DCMAKE_C_COMPILER=clang-16 -DCMAKE_CXX_COMPILER=clang++-16"
17+
runs-on: ubuntu-22.04
18+
steps:
19+
- uses: actions/checkout@v3
20+
with:
21+
submodules: "recursive"
22+
path: qlever-code
23+
- name: Checkout sparql-test-suite-files
24+
uses: actions/checkout@v3
25+
with:
26+
repository: "w3c/rdf-tests"
27+
path: sparql-test-suite
28+
- name: Checkout qlever-test-suite
29+
uses: actions/checkout@v3
30+
with:
31+
repository: "ad-freiburg/sparql-conformance"
32+
path: qlever-test-suite
33+
- name: Set up Python
34+
uses: actions/setup-python@v4
35+
with:
36+
python-version: "3.10"
37+
- name: Install python dependencies
38+
run: |
39+
python -m pip install --upgrade pip
40+
pip install requests
41+
pip install rdflib
42+
- name: Install dependencies
43+
uses: ./qlever-code/.github/workflows/install-dependencies-ubuntu
44+
- name: Install compiler
45+
uses: ./qlever-code/.github/workflows/install-compiler-ubuntu
46+
with:
47+
compiler: "clang"
48+
compiler-version: "16"
49+
- name: Create build directory
50+
run: mkdir ${{github.workspace}}/qlever-code/build
51+
- name: Configure CMake
52+
run: cmake -S ${{github.workspace}}/qlever-code/ -B ${{github.workspace}}/qlever-code/build ${{env.cmake-flags}} -DCMAKE_BUILD_TYPE=${{env.build-type}} -DLOGLEVEL=INFO -DUSE_PARALLEL=false
53+
- name: Build IndexBuilderMain
54+
run: cmake --build ${{github.workspace}}/qlever-code/build --target IndexBuilderMain --config ${{env.build-type}} -- -j $(nproc)
55+
- name: Build ServerMain
56+
run: cmake --build ${{github.workspace}}/qlever-code/build --target ServerMain --config ${{env.build-type}} -- -j $(nproc)
57+
- name: Execute test suite
58+
run: |
59+
cd qlever-test-suite
60+
python testsuite.py config http://0.0.0.0 7001 ${{github.workspace}}/sparql-test-suite/sparql/sparql11/ ${{github.workspace}}/qlever-code/build/ localhost sparql sparql
61+
python testsuite.py extract
62+
python testsuite.py ${{ github.sha }}
63+
cd ..
64+
- name: Save workflow information
65+
# Note: If you change any of the filenames here, you also have to change them in `upload-conformance.yml`
66+
run : |
67+
mkdir -p conformance-report
68+
echo ${{ github.event_name }} > ./conformance-report/event
69+
echo ${{ github.event.number }} > ./conformance-report/pr
70+
echo ${{ github.repository }} > ./conformance-report/github_repository
71+
echo ${GITHUB_REF} > ./conformance-report/github_ref
72+
- name: Save SHA and conformance report if it is a master commit.
73+
if: github.event_name == 'push'
74+
run : |
75+
echo ${{github.sha}} > ./conformance-report/sha
76+
mv ${{ github.workspace}}/qlever-test-suite/results/${{ github.sha }}.json.bz2 conformance-report/${{ github.sha }}.json.bz2
77+
- name: Save SHA and conformance report if it is a PR.
78+
if: github.event_name == 'pull_request'
79+
run : |
80+
echo ${{github.event.pull_request.head.sha}} > ./conformance-report/sha
81+
mv ${{ github.workspace}}/qlever-test-suite/results/${{ github.sha }}.json.bz2 conformance-report/${{ github.event.pull_request.head.sha }}.json.bz2
82+
- name: Upload coverage artifact
83+
uses: actions/upload-artifact@v3
84+
with:
85+
name: conformance-report
86+
path: conformance-report/

0 commit comments

Comments
 (0)