Skip to content

Commit

Permalink
Separate tests with coverage and without coverage (#1953)
Browse files Browse the repository at this point in the history
Running code coverage slows down the run by ~20%.
The commit separates the tests into two different jobs
based on the operating system. The "Tests (Coverage)"
job runs the tests with coverage and is only triggered
on the "ubuntu-latest" OS, while the "Tests (No Coverage)"
job runs the tests without coverage on other OSes.
This change improves the test workflow and ensures that
coverage only runs on the os that does uploads the result
to Codecov.
  • Loading branch information
derrix060 authored Jul 17, 2024
1 parent 66153d8 commit 6e90f2e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/juno-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,15 @@ jobs:
- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: brew install jemalloc

- name: Tests

- name: Tests (Coverage)
if: matrix.os == 'ubuntu-latest'
run: make test-cover

- name: Tests (No Coverage)
if: matrix.os != 'ubuntu-latest'
run: make test

- name: Benchmark
run: make benchmarks

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ test-race: clean-testcache rustdeps
benchmarks: rustdeps ## benchmarking
go test $(GO_TAGS) ./... -run=^# -bench=. -benchmem

test-cover: rustdeps ## tests with coverage
test-cover: clean-testcache rustdeps ## tests with coverage
mkdir -p coverage
go test $(GO_TAGS) -coverpkg=./... -coverprofile=coverage/coverage.out -covermode=atomic ./...
go tool cover -html=coverage/coverage.out -o coverage/coverage.html
Expand Down

0 comments on commit 6e90f2e

Please sign in to comment.