Skip to content

Commit

Permalink
Add coverage report
Browse files Browse the repository at this point in the history
Signed-off-by: Piotr Piotrowski <[email protected]>
  • Loading branch information
piotrpio committed Apr 30, 2024
1 parent 4c9d085 commit 4412580
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 5 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.22
go-version: 'stable'

- name: Install deps
shell: bash --noprofile --norc -x -eo pipefail {0}
Expand Down Expand Up @@ -44,17 +44,25 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}

- name: Install deps
shell: bash --noprofile --norc -x -eo pipefail {0}
run: |
go install github.com/mattn/goveralls@latest
go install github.com/wadey/gocovmerge@latest
- name: Test and coverage
shell: bash --noprofile --norc -x -eo pipefail {0}
run: |
go test -modfile=go_test.mod -v -run=TestNoRace -p=1 ./... --failfast -vet=off
if [ "${{ matrix.go }}" = "1.21" ]; then
if [ "${{ matrix.go }}" = "1.22" ]; then
./scripts/cov.sh CI
elif [ "${{ matrix.go }}" = "1.22" ]; then
else
go test -modfile=go_test.mod -race -v -p=1 ./... --failfast -vet=off -tags=internal_testing
fi
fi
- name: Coveralls
if: matrix.go == '1.22'
uses: coverallsapp/github-action@v2
with:
file: acc.out
27 changes: 27 additions & 0 deletions .github/workflows/latest-server.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Test nats-server@main
on:
schedule:
- cron: "30 8 * * *"

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 'stable'

- name: Get latest server
shell: bash --noprofile --norc -x -eo pipefail {0}
run: |
go get -modfile go_test.mod github.com/nats-io/nats-server/v2@main
- name: Test
shell: bash --noprofile --norc -x -eo pipefail {0}
run: |
go test -modfile=go_test.mod -v -run=TestNoRace -p=1 ./... --failfast -vet=off
go test -modfile=go_test.mod -race -v -p=1 ./... --failfast -vet=off -tags=internal_testing
3 changes: 2 additions & 1 deletion scripts/cov.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ rm -rf ./cov
mkdir cov
go test -modfile=go_test.mod --failfast -vet=off -v -covermode=atomic -coverprofile=./cov/nats.out . -tags=skip_no_race_tests
go test -modfile=go_test.mod --failfast -vet=off -v -covermode=atomic -coverprofile=./cov/test.out -coverpkg=github.com/nats-io/nats.go ./test -tags=skip_no_race_tests,internal_testing
go test -modfile=go_test.mod --failfast -vet=off -v -covermode=atomic -coverprofile=./cov/jetstream.out -coverpkg=github.com/nats-io/nats.go/jetstream ./jetstream/test -tags=skip_no_race_tests
go test -modfile=go_test.mod --failfast -vet=off -v -covermode=atomic -coverprofile=./cov/jetstream.out -coverpkg=github.com/nats-io/nats.go/jetstream ./jetstream/...
go test -modfile=go_test.mod --failfast -vet=off -v -covermode=atomic -coverprofile=./cov/service.out -coverpkg=github.com/nats-io/nats.go/micro ./micro/...
go test -modfile=go_test.mod --failfast -vet=off -v -covermode=atomic -coverprofile=./cov/builtin.out -coverpkg=github.com/nats-io/nats.go/encoders/builtin ./test -run EncBuiltin -tags=skip_no_race_tests
go test -modfile=go_test.mod --failfast -vet=off -v -covermode=atomic -coverprofile=./cov/protobuf.out -coverpkg=github.com/nats-io/nats.go/encoders/protobuf ./test -run EncProto -tags=skip_no_race_tests
gocovmerge ./cov/*.out > acc.out
Expand Down

0 comments on commit 4412580

Please sign in to comment.