From 905b9e3325c35ac112dd52ad587571ae6ae5f2c4 Mon Sep 17 00:00:00 2001 From: kyuff Date: Sun, 16 Feb 2025 21:56:58 +0100 Subject: [PATCH 1/2] docs: add badges to README.md --- .github/workflows/ci.yml | 19 ------------------- .github/workflows/go.yml | 36 ++++++++++++++++++++++++++++++++++++ .gitignore | 1 + Makefile | 22 ++++++++++++++++++++++ README.md | 5 +++++ 5 files changed, 64 insertions(+), 19 deletions(-) delete mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/go.yml create mode 100644 Makefile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 27de2e9..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Go -on: [push] - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - name: Setup Go - uses: actions/setup-go@v4 - with: - go-version: '1.22.x' - - name: Install dependencies - run: go get . - - name: Build - run: go build -v ./... - - name: Test with Make - run: go test ./... -count 1 -race diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..7a70f0a --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,36 @@ +# 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: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + + - name: Install dependencies + run: go mod download + + - name: Vet + run: make vet + + - name: Test with Coverage + run: make test-coverage + + - name: Upload results to Codecov + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.gitignore b/.gitignore index 02ac895..2a5168a 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ go.work .idea +/coverage.txt diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..425863f --- /dev/null +++ b/Makefile @@ -0,0 +1,22 @@ + +test: + go test ./... -count 1 -race + +test-coverage: + go test -coverprofile=coverage.txt ./... -count 1 -race + +vet: + go vet ./... + +cover: + go test ./... -count 1 -race -cover + +gen: + go generate ./... + +plantuml-docker: + docker run -v $(shell pwd)/docs:/docs -w /docs ghcr.io/plantuml/plantuml *.pu + +plantuml: + plantuml docs/*.pu + diff --git a/README.md b/README.md index 6aab57b..01a5356 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,10 @@ # Testdata generator for Go +[![Build Status](https://github.com/kyuff/testdata/actions/workflows/go.yml/badge.svg?branch=main)](https://github.com/kyuff/testdata/actions/workflows/go.yml) +[![Report Card](https://goreportcard.com/badge/github.com/kyuff/testdata)](https://goreportcard.com/report/github.com/kyuff/testdata/) +[![Go Reference](https://pkg.go.dev/badge/github.com/kyuff/testdata.svg)](https://pkg.go.dev/github.com/kyuff/testdata) +[![codecov](https://codecov.io/gh/kyuff/testdata/graph/badge.svg?token=GA4GSQCLZE)](https://codecov.io/gh/kyuff/testdata) + Library to generate random and typed data for tests. ## Use case From e59d6edcd176cb61abf085febb2a0f459ca268c5 Mon Sep 17 00:00:00 2001 From: kyuff Date: Sun, 16 Feb 2025 22:00:40 +0100 Subject: [PATCH 2/2] Set correct token for codecov --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 01a5356..ea7d365 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Build Status](https://github.com/kyuff/testdata/actions/workflows/go.yml/badge.svg?branch=main)](https://github.com/kyuff/testdata/actions/workflows/go.yml) [![Report Card](https://goreportcard.com/badge/github.com/kyuff/testdata)](https://goreportcard.com/report/github.com/kyuff/testdata/) [![Go Reference](https://pkg.go.dev/badge/github.com/kyuff/testdata.svg)](https://pkg.go.dev/github.com/kyuff/testdata) -[![codecov](https://codecov.io/gh/kyuff/testdata/graph/badge.svg?token=GA4GSQCLZE)](https://codecov.io/gh/kyuff/testdata) +[![codecov](https://codecov.io/gh/kyuff/testdata/graph/badge.svg?token=HRK7MBJHFN)](https://codecov.io/gh/kyuff/testdata) Library to generate random and typed data for tests.