Skip to content

Commit

Permalink
update ci
Browse files Browse the repository at this point in the history
  • Loading branch information
cornelk committed Jun 26, 2024
1 parent 5cfeb2e commit 579805b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/codecov.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ jobs:
codecov:
timeout-minutes: 15

services:
pulsar:
image: apachepulsar/pulsar-standalone:2.8.4
ports:
- 6650:6650
- 8080:8080

name: Coverage
runs-on: ubuntu-latest
steps:
Expand All @@ -32,8 +39,9 @@ jobs:
- name: Get dependencies
run: go version && go mod download

# sleep to make sure that pulsar container is ready
- name: Run tests with coverage
run: make test-coverage
run: sleep 20 && make test-integration-coverage

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
Expand Down
10 changes: 1 addition & 9 deletions .github/workflows/go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@ jobs:
matrix:
go: ['1.21']

services:
pulsar:
image: apachepulsar/pulsar-standalone:2.8.4
ports:
- 6650:6650
- 8080:8080

steps:
- name: Set up Go 1.x
uses: actions/setup-go@v3
Expand All @@ -40,9 +33,8 @@ jobs:
- name: Get dependencies
run: go mod download

# sleep to make sure that pulsar container is ready
- name: Run tests
run: sleep 20 && make test-integration
run: make test

- name: Run linter
run: make lint
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@ test: ## run tests
test-integration: ## run integration tests
go test -tags integration -race -p 1 ./...

test-integration-coverage: ## run integration tests with coverage
go test -tags integration -race -p 1 ./... -coverprofile .testCoverage -covermode=atomic -coverpkg=./...
go tool cover -func .testCoverage | grep total | awk '{print "Total coverage: "$$3}'

test-coverage: ## run unit tests and create test coverage
go test ./... -coverprofile .testCoverage -covermode=atomic -coverpkg=./...
CGO_ENABLED=0 go test ./... -coverprofile .testCoverage -covermode=atomic -coverpkg=./...
go tool cover -func .testCoverage | grep total | awk '{print "Total coverage: "$$3}'

test-coverage-web: test-coverage ## run unit tests and show test coverage in browser
go tool cover -func .testCoverage | grep total | awk '{print "Total coverage: "$$3}'
Expand Down

0 comments on commit 579805b

Please sign in to comment.