Compare commits

..

5 Commits

Author SHA1 Message Date
vtolstov
7a79159c39 Apply Code Coverage Badge 2025-06-11 06:44:09 +00:00
c37081ec19 add missing outgoing key to ctx for subscribers (#224)
All checks were successful
coverage / build (push) Successful in 1m43s
test / test (push) Successful in 4m59s
2025-06-11 09:37:55 +03:00
3ab7c5cc29 update ci (#219) 2025-05-05 19:19:28 +03:00
13feeefa42 [v3] update ci (#217)
All checks were successful
coverage / build (push) Has been skipped
test / test (push) Successful in 5m50s
* update ci

* disable coverage job
2025-05-03 10:44:46 +03:00
ea3b2e5f4c [v3] rename .gitea to .github (#215)
All checks were successful
test / test (push) Successful in 3m50s
* rename .gitea to .github

* attempt to fix lint job

* attempt to fix test job

* attempt to fix lint/test job
2025-04-28 09:52:19 +03:00
14 changed files with 83 additions and 32 deletions

53
.github/workflows/job_coverage.yml vendored Normal file
View File

@@ -0,0 +1,53 @@
name: coverage
on:
push:
branches: [ main, v3, v4 ]
paths-ignore:
- '.github/**'
- '.gitea/**'
pull_request:
branches: [ main, v3, v4 ]
jobs:
build:
if: github.server_url != 'https://github.com'
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 ./... -covermode=count -coverprofile coverage.out -coverpkg ./...
go tool cover -func coverage.out -o coverage.out
- name: coverage badge
uses: tj-actions/coverage-badge-go@v2
with:
green: 80
filename: coverage.out
- uses: stefanzweifel/git-auto-commit-action@v4
name: autocommit
with:
commit_message: Apply Code Coverage Badge
skip_fetch: false
skip_checkout: false
file_pattern: ./README.md
- name: push
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

@@ -3,10 +3,10 @@ name: lint
on:
pull_request:
types: [opened, reopened, synchronize]
branches:
- master
- v3
- v4
branches: [ master, v3, v4 ]
paths-ignore:
- '.github/**'
- '.gitea/**'
jobs:
lint:
@@ -24,6 +24,6 @@ jobs:
- name: setup deps
run: go get -v ./...
- name: run lint
uses: https://github.com/golangci/golangci-lint-action@v6
uses: golangci/golangci-lint-action@v6
with:
version: 'latest'

View File

@@ -3,15 +3,12 @@ name: test
on:
pull_request:
types: [opened, reopened, synchronize]
branches:
- master
- v3
- v4
branches: [ master, v3, v4 ]
push:
branches:
- master
- v3
- v4
branches: [ master, v3, v4 ]
paths-ignore:
- '.github/**'
- '.gitea/**'
jobs:
test:

View File

@@ -3,15 +3,12 @@ name: test
on:
pull_request:
types: [opened, reopened, synchronize]
branches:
- master
- v3
- v4
branches: [ master, v3, v4 ]
push:
branches:
- master
- v3
- v4
branches: [ master, v3, v4 ]
paths-ignore:
- '.github/**'
- '.gitea/**'
jobs:
test:
@@ -35,19 +32,19 @@ jobs:
go-version: 'stable'
- name: setup go work
env:
GOWORK: /workspace/${{ github.repository_owner }}/go.work
GOWORK: ${{ github.workspace }}/go.work
run: |
go work init
go work use .
go work use micro-tests
- name: setup deps
env:
GOWORK: /workspace/${{ github.repository_owner }}/go.work
GOWORK: ${{ github.workspace }}/go.work
run: go get -v ./...
- name: run tests
env:
INTEGRATION_TESTS: yes
GOWORK: /workspace/${{ github.repository_owner }}/go.work
GOWORK: ${{ github.workspace }}/go.work
run: |
cd micro-tests
go test -mod readonly -v ./... || true

View File

@@ -1,5 +1,5 @@
run:
concurrency: 8
deadline: 5m
timeout: 5m
issues-exit-code: 1
tests: true

View File

@@ -1,4 +1,5 @@
# HTTP Server
![Coverage](https://img.shields.io/badge/Coverage-2.5%25-red)
The HTTP Server is a go-micro.Server. It's a partial implementation which strips out codecs, transports, etc but enables you
to create a HTTP Server that could potentially be used for REST based API services.

5
go.mod
View File

@@ -1,13 +1,14 @@
module go.unistack.org/micro-server-http/v3
go 1.22.0
go 1.22.2
toolchain go1.24.2
require (
go.unistack.org/micro-client-http/v3 v3.9.15
go.unistack.org/micro-codec-yaml/v3 v3.10.3
go.unistack.org/micro-proto/v3 v3.4.1
go.unistack.org/micro/v3 v3.11.30
go.unistack.org/micro/v3 v3.11.41
golang.org/x/net v0.33.0
)

4
go.sum
View File

@@ -878,8 +878,8 @@ go.unistack.org/micro-codec-yaml/v3 v3.10.3 h1:H0jM4wCSReHzEc1hnKYgXjzg171+tUE6I
go.unistack.org/micro-codec-yaml/v3 v3.10.3/go.mod h1:pruYGvCULoHa6Tfah1UnTrwCzQhy0KT6D4UXEMgf+tk=
go.unistack.org/micro-proto/v3 v3.4.1 h1:UTjLSRz2YZuaHk9iSlVqqsA50JQNAEK2ZFboGqtEa9Q=
go.unistack.org/micro-proto/v3 v3.4.1/go.mod h1:okx/cnOhzuCX0ggl/vToatbCupi0O44diiiLLsZ93Zo=
go.unistack.org/micro/v3 v3.11.30 h1:XTLgZubSGzQL85IUMp1pTJnS1lP4eFwTZyelV/SzOMc=
go.unistack.org/micro/v3 v3.11.30/go.mod h1:fvOkXKs3wKHToWH6Mxy+aovEiDl2q4UlOCdVfJdziBU=
go.unistack.org/micro/v3 v3.11.41 h1:dP4sBLIZpMo+MWGe5bbESewK8wBzYm4Yik/67x4dEtQ=
go.unistack.org/micro/v3 v3.11.41/go.mod h1:POGU5hstnAT9LH70m8FalyQSNi2GfIew71K75JenIZk=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=

View File

@@ -127,6 +127,7 @@ func (h *Server) HTTPHandlerFunc(handler interface{}) (http.HandlerFunc, error)
}
ctx = metadata.NewIncomingContext(ctx, md)
ctx = metadata.NewOutgoingContext(ctx, metadata.New(0))
path := r.URL.Path

View File

@@ -88,6 +88,7 @@ func (s *Server) createSubHandler(sb *httpSubscriber, opts server.Options) broke
hdr := metadata.Copy(msg.Header)
ctx := metadata.NewIncomingContext(context.Background(), hdr)
ctx = metadata.NewOutgoingContext(ctx, metadata.New(0))
results := make(chan error, len(sb.handlers))