mirror of
https://github.com/ncruces/go-sqlite3.git
synced 2026-01-12 05:59:14 +00:00
Coverage action.
This commit is contained in:
1667
.github/coverage.html
vendored
1667
.github/coverage.html
vendored
File diff suppressed because it is too large
Load Diff
20
.github/coverage.sh
vendored
20
.github/coverage.sh
vendored
@@ -1,20 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(dirname -- "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||
|
||||
go test ./... -coverprofile "$SCRIPT_DIR/coverage.out"
|
||||
go tool cover -html="$SCRIPT_DIR/coverage.out" -o "$SCRIPT_DIR/coverage.html"
|
||||
COVERAGE=$(go tool cover -func="$SCRIPT_DIR/coverage.out" | tail -1 | grep -Eo '\d+\.\d')
|
||||
|
||||
echo "coverage: $COVERAGE% of statements"
|
||||
|
||||
COLOR=orange
|
||||
if awk "BEGIN {exit !($COVERAGE <= 50)}"; then
|
||||
COLOR=red
|
||||
elif awk "BEGIN {exit !($COVERAGE > 80)}"; then
|
||||
COLOR=green
|
||||
fi
|
||||
curl -s "https://img.shields.io/badge/coverage-$COVERAGE%25-$COLOR" > "$SCRIPT_DIR/coverage.svg"
|
||||
|
||||
git add "$SCRIPT_DIR/coverage.html" "$SCRIPT_DIR/coverage.svg"
|
||||
1
.github/coverage.svg
vendored
1
.github/coverage.svg
vendored
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108" height="20" role="img" aria-label="coverage: 71.4%"><title>coverage: 71.4%</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="108" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="61" height="20" fill="#555"/><rect x="61" width="47" height="20" fill="#fe7d37"/><rect width="108" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="315" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="510">coverage</text><text x="315" y="140" transform="scale(.1)" fill="#fff" textLength="510">coverage</text><text aria-hidden="true" x="835" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="370">71.4%</text><text x="835" y="140" transform="scale(.1)" fill="#fff" textLength="370">71.4%</text></g></svg>
|
||||
|
Before Width: | Height: | Size: 1.1 KiB |
9
.github/workflows/go.yml
vendored
9
.github/workflows/go.yml
vendored
@@ -1,6 +1,3 @@
|
||||
# This workflow will build a golang project
|
||||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
|
||||
|
||||
name: Go
|
||||
|
||||
on:
|
||||
@@ -22,10 +19,14 @@ jobs:
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.19
|
||||
go-version: stable
|
||||
|
||||
- name: Build
|
||||
run: go build -v ./...
|
||||
|
||||
- name: Test
|
||||
run: go test -v ./...
|
||||
|
||||
- if: matrix.os == 'ubuntu-latest'
|
||||
name: Update coverage report
|
||||
uses: ncruces/go-coverage-report@main
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
[](https://pkg.go.dev/github.com/ncruces/go-sqlite3)
|
||||
[](https://goreportcard.com/report/github.com/ncruces/go-sqlite3)
|
||||
[](https://raw.githack.com/ncruces/go-sqlite3/main/.github/coverage.html)
|
||||
[](https://raw.githack.com/wiki/ncruces/go-sqlite3/coverage.html)
|
||||
|
||||
⚠️ CAUTION ⚠️
|
||||
|
||||
|
||||
Reference in New Issue
Block a user