Compare commits

..

6 Commits
v3.11.23 ... v3

Author SHA1 Message Date
vtolstov
daf19f031a Apply Code Coverage Badge 2024-12-23 08:01:49 +00:00
5989fd54ca Merge pull request 'util/id: add uuid helper func' (#385) from uuid into v3
Some checks failed
coverage / build (push) Successful in 9m9s
test / test (push) Failing after 12m2s
Reviewed-on: #385
2024-12-23 11:00:04 +03:00
ed30c26324 util/id: add uuid helper func
Some checks failed
lint / lint (pull_request) Successful in 1m26s
test / test (pull_request) Successful in 4m2s
coverage / build (pull_request) Failing after 9m29s
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2024-12-23 10:59:29 +03:00
0f8f93d09a Обновить README.md
Some checks failed
coverage / build (push) Failing after 1m1s
test / test (push) Successful in 3m46s
2024-12-22 23:42:47 +03:00
vtolstov
f460e2f8dd Apply Code Coverage Badge 2024-12-22 20:39:05 +00:00
70d6a79274 add coverage badge (#383)
Some checks failed
test / test (push) Successful in 3m37s
coverage / build (push) Has been cancelled
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
Reviewed-on: #383
Co-authored-by: Vasiliy Tolstov <v.tolstov@unistack.org>
Co-committed-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2024-12-22 23:38:28 +03:00
4 changed files with 68 additions and 2 deletions

View File

@ -0,0 +1,51 @@
name: coverage
on:
push:
branches: [ main, v3, v4 ]
pull_request:
branches: [ main, v3, v4 ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v4
with:
filter: 'blob:none'
- name: setup go
uses: actions/setup-go@v5
with:
cache-dependency-path: "**/*.sum"
go-version: 'stable'
- name: test coverage
run: |
go test -v -cover ./... -coverprofile coverage.out -coverpkg ./...
go tool cover -func coverage.out -o coverage.out
- name: coverage badge
uses: tj-actions/coverage-badge-go@v1
with:
green: 80
filename: coverage.out
- uses: stefanzweifel/git-auto-commit-action@v4
id: auto-commit-action
with:
commit_message: Apply Code Coverage Badge
skip_fetch: true
skip_checkout: true
file_pattern: ./README.md
- name: Push Changes
if: steps.auto-commit-action.outputs.changes_detected == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ github.token }}
branch: ${{ github.ref }}

View File

@ -1,4 +1,5 @@
# Micro [![License](https://img.shields.io/:license-apache-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![Doc](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/unistack-org/micro/v3?tab=overview) [![Status](https://git.unistack.org/unistack-org/micro/actions/workflows/job_tests.yml/badge.svg?branch=v3)](https://git.unistack.org/unistack-org/micro/actions?query=workflow%3Abuild+branch%3Av3+event%3Apush) [![Lint](https://goreportcard.com/badge/go.unistack.org/micro/v3)](https://goreportcard.com/report/go.unistack.org/micro/v3)
# Micro
![Coverage](https://img.shields.io/badge/Coverage-44.9%25-yellow)
Micro is a standard library for microservices.

View File

@ -8,6 +8,7 @@ import (
"time"
uuidv8 "github.com/ash3in/uuidv8"
"github.com/google/uuid"
nanoid "github.com/matoous/go-nanoid"
)
@ -96,6 +97,10 @@ func New(opts ...Option) (string, error) {
return "", errors.New("invalid option, Type unspecified")
}
func ToUUID(s string) uuid.UUID {
return uuid.MustParse(s)
}
// Must is the same as New but fatals on error
func MustNew(opts ...Option) string {
id, err := New(opts...)

View File

@ -7,5 +7,14 @@ func TestUUIDv8(t *testing.T) {
if err != nil {
t.Fatal(err)
}
t.Logf("xxx %s\n", id)
_ = id
}
func TestToUUID(t *testing.T) {
id, err := New()
if err != nil {
t.Fatal(err)
}
u := ToUUID(id)
_ = u
}