Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the workflow files for the sparql-conformance webapp #1559

Merged
merged 2 commits into from
Oct 16, 2024
Merged
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
65 changes: 65 additions & 0 deletions .github/workflows/sparql-conformance-uploader.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Upload conformance tests result

on:
workflow_run:
workflows: [sparql-conformance]
types:
- completed

jobs:
upload:
env:
SERVER_URL: https://qlever.cs.uni-freiburg.de/sparql-conformance-uploader
API_KEY: ${{ secrets.SPARQL_CONFORMANCE_TOKEN }}
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success'
steps:
- name: 'Download artifact'
uses: actions/github-script@v6
with:
script: |
var artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }},
});
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "conformance-report"
})[0];
var download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
var fs = require('fs');
fs.writeFileSync('${{github.workspace}}/conformance-report.zip', Buffer.from(download.data));
- run: unzip conformance-report.zip
# Read the metadata into environment variables.
- name: "Read github event"
run: echo "github_event=`cat event`" >> $GITHUB_ENV
- name: "Read PR number"
run: echo "pr_number=`cat pr`" >> $GITHUB_ENV
- name: "Read Github Ref"
run: echo "original_github_ref=`cat github_ref`" >> $GITHUB_ENV;
- name: "Read Github SHA"
run: echo "commit_sha=`cat sha`" >> $GITHUB_ENV;
- name: "Read Github Repository"
run: echo "original_github_repository=`cat github_repository`" >> $GITHUB_ENV;
- name: "Submit data to server"
run: |
response=$(curl -s -o temp_response.txt -w "%{http_code}" \
-H "x-api-key: $API_KEY" \
-H "event: ${{ env.github_event }}" \
-H "sha: ${{ env.commit_sha }}" \
-H "pr-number: ${{ env.pr_number }}" \
-F "file=@${{env.commit_sha}}.json.bz2" \
$SERVER_URL/upload)

echo "Server response:"
cat temp_response.txt
echo "HTTP Status: $response"
if [ "$response" -gt 200 ]; then
echo "Server did not respond with status 200. Failing the workflow."
exit 1
fi
86 changes: 86 additions & 0 deletions .github/workflows/sparql-conformance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: sparql-conformance

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
merge_group:

jobs:
build:
env:
compiler: clang
compiler-version: 16
build-type: Release
cmake-flags: "-DCMAKE_C_COMPILER=clang-16 -DCMAKE_CXX_COMPILER=clang++-16"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
submodules: "recursive"
path: qlever-code
- name: Checkout sparql-test-suite-files
uses: actions/checkout@v3
with:
repository: "w3c/rdf-tests"
path: sparql-test-suite
- name: Checkout qlever-test-suite
uses: actions/checkout@v3
with:
repository: "ad-freiburg/sparql-conformance"
path: qlever-test-suite
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip install requests
pip install rdflib
- name: Install dependencies
uses: ./qlever-code/.github/workflows/install-dependencies-ubuntu
- name: Install compiler
uses: ./qlever-code/.github/workflows/install-compiler-ubuntu
with:
compiler: "clang"
compiler-version: "16"
- name: Create build directory
run: mkdir ${{github.workspace}}/qlever-code/build
- name: Configure CMake
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
- name: Build IndexBuilderMain
run: cmake --build ${{github.workspace}}/qlever-code/build --target IndexBuilderMain --config ${{env.build-type}} -- -j $(nproc)
- name: Build ServerMain
run: cmake --build ${{github.workspace}}/qlever-code/build --target ServerMain --config ${{env.build-type}} -- -j $(nproc)
- name: Execute test suite
run: |
cd qlever-test-suite
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
python testsuite.py extract
python testsuite.py ${{ github.sha }}
cd ..
- name: Save workflow information
# Note: If you change any of the filenames here, you also have to change them in `upload-conformance.yml`
run : |
mkdir -p conformance-report
echo ${{ github.event_name }} > ./conformance-report/event
echo ${{ github.event.number }} > ./conformance-report/pr
echo ${{ github.repository }} > ./conformance-report/github_repository
echo ${GITHUB_REF} > ./conformance-report/github_ref
- name: Save SHA and conformance report if it is a master commit.
if: github.event_name == 'push'
run : |
echo ${{github.sha}} > ./conformance-report/sha
mv ${{ github.workspace}}/qlever-test-suite/results/${{ github.sha }}.json.bz2 conformance-report/${{ github.sha }}.json.bz2
- name: Save SHA and conformance report if it is a PR.
if: github.event_name == 'pull_request'
run : |
echo ${{github.event.pull_request.head.sha}} > ./conformance-report/sha
mv ${{ github.workspace}}/qlever-test-suite/results/${{ github.sha }}.json.bz2 conformance-report/${{ github.event.pull_request.head.sha }}.json.bz2
- name: Upload coverage artifact
uses: actions/upload-artifact@v3
with:
name: conformance-report
path: conformance-report/
Loading