Skip to content

Commit

Permalink
Badges (#7)
Browse files Browse the repository at this point in the history
* badges: LICENSE

* badges: update

* badges: update

* badges: update

* badges: update

* badges: added gosec

* badges: gosec on update

* badges: jobs name

* badges: added coverage

* badges: update

* badges: update

* badges: update

* badges: update
  • Loading branch information
mysiar authored May 22, 2024
1 parent 82711d4 commit c98f9f4
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 5 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
20 changes: 20 additions & 0 deletions .github/workflows/gosec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Gosec

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

jobs:
gosec_tests:
runs-on: self-hosted
env:
GO111MODULE: on
steps:
- name: Checkout Source
uses: actions/checkout@v4
- name: Run Gosec Security Scanner
uses: securego/gosec@master
with:
args: --exclude-dir=examples --exclude-dir=aws ./...
5 changes: 2 additions & 3 deletions .github/workflows/go.yml → .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: go_sql_raw
name: Tests

on:
push:
Expand All @@ -10,8 +10,7 @@ on:
branches: [ "main" ]

jobs:

test:
unit_test:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
Expand Down
28 changes: 28 additions & 0 deletions .octocov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
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:
codeToTestRatio:
code:
- '**/*.go'
- '!**/*_test.go'
test:
- '**/*_test.go'
badge:
path: docs/ratio.svg
testExecutionTime:
badge:
path: docs/time.svg
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Piotr Synowiec

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
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,5 +1,7 @@
# go-sql-raw
![tests](https://github.com/mysiar-org/go_sql_raw/actions/workflows/go.yml/badge.svg)
![Tests](https://github.com/mysiar-org/go_sql_raw/actions/workflows/tests.yml/badge.svg)
[![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)
[![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)

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

Expand Down

0 comments on commit c98f9f4

Please sign in to comment.