Upload conformance tests result #626
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |