Skip to content

Commit

Permalink
badges: added coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
mysiar committed May 22, 2024
1 parent 09b2287 commit dd93731
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 3 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Coverage

on:
push:
branches: [ "**" ]
pull_request:
branches: [ "main" ]

jobs:
coverage:

runs-on: self-hosted

steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version: "1"
check-latest: true

- name: Dependencies
run: make get

- name: Run tests with coverage report output
run: make coverage

- uses: k1LoW/octocov-action@v1
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# 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: tests
name: Tests

on:
push:
Expand Down
22 changes: 22 additions & 0 deletions .octocov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
coverage:
if: true
acceptable: 80%
badge:
path: docs/coverage.svg
diff:
datastores:
- artifact://${GITHUB_REPOSITORY}
comment:
if: is_pull_request
summary:
if: true
report:
if: is_default_branch
datastores:
- artifact://${GITHUB_REPOSITORY}
codeToTestRatio:
badge:
path: docs/ratio.svg
testExecutionTime:
badge:
path: docs/time.svg
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,9 @@ get::


tests::
rm -rf tests/test.db
rm -f tests/test.db
go test -count=1 -modfile=go_test.mod ./... -v

coverage::
rm -f tests/test.db
go test -count=1 -modfile=go_test.mod -cover -coverpkg=./... -coverprofile=coverage.out ./...
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# go-sql-raw
![tests](https://github.com/mysiar-org/go_sql_raw/actions/workflows/tests.yml/badge.svg)
![Tests](https://github.com/mysiar-org/go_sql_raw/actions/workflows/tests.yml/badge.svg)
[![Go Reference](https://pkg.go.dev/badge/github.com/mysiar-org/go_sql_raw.svg)](https://pkg.go.dev/github.com/mysiar-org/go-sql-raw)
[![Gosec](https://github.com/mysiar-org/go_sql_raw/actions/workflows/gosec.yml/badge.svg)](https://github.com/mysiar-org/go_sql_raw/actions/workflows/gosec.yml)
![Coverage](https://raw.githubusercontent.com/nao1215/octocovs-central-repo/main/badges/nao1215/markdown/coverage.svg)

The main reason that this module has been created was generic querying database without knowing table structure.

Expand Down

0 comments on commit dd93731

Please sign in to comment.