Skip to content

Commit ea64ce0

Browse files
authored
[v3] update ci (#151)
* update ci * cleanup
1 parent b89246b commit ea64ce0

File tree

5 files changed

+117
-70
lines changed

5 files changed

+117
-70
lines changed

.github/workflows/job_coverage.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: coverage
2+
3+
on:
4+
push:
5+
branches: [ main, v3, v4 ]
6+
paths-ignore:
7+
- '.github/**'
8+
- '.gitea/**'
9+
pull_request:
10+
branches: [ main, v3, v4 ]
11+
12+
jobs:
13+
14+
build:
15+
if: github.server_url != 'https://github.com'
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: checkout code
19+
uses: actions/checkout@v4
20+
with:
21+
filter: 'blob:none'
22+
23+
- name: setup go
24+
uses: actions/setup-go@v5
25+
with:
26+
cache-dependency-path: "**/*.sum"
27+
go-version: 'stable'
28+
29+
- name: test coverage
30+
run: |
31+
go test -v -cover ./... -covermode=count -coverprofile coverage.out -coverpkg ./...
32+
go tool cover -func coverage.out -o coverage.out
33+
34+
- name: coverage badge
35+
uses: tj-actions/coverage-badge-go@v2
36+
with:
37+
green: 80
38+
filename: coverage.out
39+
40+
- uses: stefanzweifel/git-auto-commit-action@v4
41+
name: autocommit
42+
with:
43+
commit_message: Apply Code Coverage Badge
44+
skip_fetch: false
45+
skip_checkout: false
46+
file_pattern: ./README.md
47+
48+
- name: push
49+
if: steps.auto-commit-action.outputs.changes_detected == 'true'
50+
uses: ad-m/github-push-action@master
51+
with:
52+
github_token: ${{ github.token }}
53+
branch: ${{ github.ref }}

.github/workflows/job_lint.yml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,27 @@ name: lint
33
on:
44
pull_request:
55
types: [opened, reopened, synchronize]
6-
branches:
7-
- master
8-
- v3
9-
- v4
6+
branches: [ master, v3, v4 ]
7+
paths-ignore:
8+
- '.github/**'
9+
- '.gitea/**'
1010

1111
jobs:
1212
lint:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- name: checkout code
16-
uses: actions/checkout@v4
17-
with:
18-
filter: 'blob:none'
19-
- name: setup go
20-
uses: actions/setup-go@v5
21-
with:
22-
cache-dependency-path: "**/*.sum"
23-
go-version: 'stable'
24-
- name: setup deps
25-
run: go get -v ./...
26-
- name: run lint
27-
uses: golangci/golangci-lint-action@v6
28-
with:
29-
version: 'latest'
15+
- name: checkout code
16+
uses: actions/checkout@v4
17+
with:
18+
filter: 'blob:none'
19+
- name: setup go
20+
uses: actions/setup-go@v5
21+
with:
22+
cache-dependency-path: "**/*.sum"
23+
go-version: 'stable'
24+
- name: setup deps
25+
run: go get -v ./...
26+
- name: run lint
27+
uses: golangci/golangci-lint-action@v6
28+
with:
29+
version: 'latest'

.github/workflows/job_test.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,12 @@ name: test
33
on:
44
pull_request:
55
types: [opened, reopened, synchronize]
6-
branches:
7-
- master
8-
- v3
9-
- v4
6+
branches: [ master, v3, v4 ]
107
push:
11-
branches:
12-
- master
13-
- v3
14-
- v4
8+
branches: [ master, v3, v4 ]
9+
paths-ignore:
10+
- '.github/**'
11+
- '.gitea/**'
1512

1613
jobs:
1714
test:

.github/workflows/job_tests.yml

Lines changed: 39 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -3,51 +3,48 @@ name: test
33
on:
44
pull_request:
55
types: [opened, reopened, synchronize]
6-
branches:
7-
- master
8-
- v3
9-
- v4
6+
branches: [ master, v3, v4 ]
107
push:
11-
branches:
12-
- master
13-
- v3
14-
- v4
8+
branches: [ master, v3, v4 ]
9+
paths-ignore:
10+
- '.github/**'
11+
- '.gitea/**'
1512

1613
jobs:
1714
test:
1815
runs-on: ubuntu-latest
1916
steps:
20-
- name: checkout code
21-
uses: actions/checkout@v4
22-
with:
23-
filter: 'blob:none'
24-
- name: checkout tests
25-
uses: actions/checkout@v4
26-
with:
27-
ref: master
28-
filter: 'blob:none'
29-
repository: unistack-org/micro-tests
30-
path: micro-tests
31-
- name: setup go
32-
uses: actions/setup-go@v5
33-
with:
34-
cache-dependency-path: "**/*.sum"
35-
go-version: 'stable'
36-
- name: setup go work
37-
env:
38-
GOWORK: ${{ github.workspace }}/go.work
39-
run: |
40-
go work init
41-
go work use .
42-
go work use micro-tests
43-
- name: setup deps
44-
env:
45-
GOWORK: ${{ github.workspace }}/go.work
46-
run: go get -v ./...
47-
- name: run tests
48-
env:
49-
INTEGRATION_TESTS: yes
50-
GOWORK: ${{ github.workspace }}/go.work
51-
run: |
52-
cd micro-tests
53-
go test -mod readonly -v ./... || true
17+
- name: checkout code
18+
uses: actions/checkout@v4
19+
with:
20+
filter: 'blob:none'
21+
- name: checkout tests
22+
uses: actions/checkout@v4
23+
with:
24+
ref: master
25+
filter: 'blob:none'
26+
repository: unistack-org/micro-tests
27+
path: micro-tests
28+
- name: setup go
29+
uses: actions/setup-go@v5
30+
with:
31+
cache-dependency-path: "**/*.sum"
32+
go-version: 'stable'
33+
- name: setup go work
34+
env:
35+
GOWORK: ${{ github.workspace }}/go.work
36+
run: |
37+
go work init
38+
go work use .
39+
go work use micro-tests
40+
- name: setup deps
41+
env:
42+
GOWORK: ${{ github.workspace }}/go.work
43+
run: go get -v ./...
44+
- name: run tests
45+
env:
46+
INTEGRATION_TESTS: yes
47+
GOWORK: ${{ github.workspace }}/go.work
48+
run: |
49+
cd micro-tests
50+
go test -mod readonly -v ./... || true

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# HTTP Client
2+
![Coverage](https://img.shields.io/badge/Coverage-22.6%25-red)
23

34
This plugin is a http client for micro.
45

@@ -59,4 +60,3 @@ Json with content-type application/json
5960
```go
6061
client.NewJsonRequest("service", "/path", jsonRequest{})
6162
```
62-

0 commit comments

Comments
 (0)