-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathupload-coverage.sh
More file actions
executable file
·37 lines (29 loc) · 958 Bytes
/
Copy pathupload-coverage.sh
File metadata and controls
executable file
·37 lines (29 loc) · 958 Bytes
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
34
35
36
37
#!/bin/bash
# Simple script to upload Clover XML coverage to Coveralls API
# Usage: ./upload-coverage.sh <clover-xml-path>
if [ -z "$COVERALLS_REPO_TOKEN" ]; then
echo "COVERALLS_REPO_TOKEN environment variable is required"
exit 1
fi
if [ ! -f "$1" ]; then
echo "Coverage file $1 not found"
exit 1
fi
# Convert Clover XML to a simple JSON format that Coveralls can accept
# This is a minimal implementation - we'll send the XML as-is in the API call
echo "Uploading coverage to Coveralls..."
# Create a temporary JSON payload
cat > /tmp/coveralls.json << EOF
{
"repo_token": "$COVERALLS_REPO_TOKEN",
"service_name": "circleci",
"source_files": []
}
EOF
# Upload using curl with form data (Coveralls accepts XML in coverage_file field)
curl -F "repo_token=$COVERALLS_REPO_TOKEN" \
-F "service_name=circleci" \
-F "coverage_file=@$1" \
https://coveralls.io/api/v1/jobs
echo ""
echo "Coverage upload completed"