-
Notifications
You must be signed in to change notification settings - Fork 2
/
pi-report.sh
executable file
·33 lines (26 loc) · 1020 Bytes
/
pi-report.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
set -Euo pipefail
PROJECT="github.com/leeonky/$(basename $(pwd))"
VERSION=master
cd build
# Whenever something goes wrong, clean up the temporary file
trap "rm mutation-testing-report.json" ERR
# Find the report.js file
reportJsLocation=$(find ./reports/pitest -name "report.js")
echo Found report.js at ${reportJsLocation}
# Read the file
reportJsContent=$(<${reportJsLocation})
# Strip off the first 60 characters - yes, this is brittle :-)
report="${reportJsContent:60}"
# Store the data in a temporary file
echo "${report}" > mutation-testing-report.json
BASE_URL="https://dashboard.stryker-mutator.io"
# Finally, upload the data using the API key that we got
echo Uploading mutation-testing-report.json to ${BASE_URL}/api/reports/${PROJECT}/${VERSION}
curl -X PUT \
${BASE_URL}/api/reports/${PROJECT}/${VERSION} \
-H "Content-Type: application/json" \
-H "Host: dashboard.stryker-mutator.io" \
-H "X-Api-Key: ${PI_KEY}" \
-d @mutation-testing-report.json
rm mutation-testing-report.json