@@ -26,13 +26,24 @@ jobs:
26
26
run : |
27
27
go version
28
28
go env
29
+ - name : Use msys2 on windows
30
+ if : ${{ matrix.os == 'windows' }}
31
+ shell : bash
32
+ # The executable for msys2 is also called bash.cmd
33
+ # https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md#shells
34
+ # If we prepend its location to the PATH
35
+ # subsequent 'shell: bash' steps will use msys2 instead of gitbash
36
+ run : echo "C:/msys64/usr/bin" >> $GITHUB_PATH
29
37
- name : Run repo-specific setup
30
38
uses : ./.github/actions/go-test-setup
31
39
if : hashFiles('./.github/actions/go-test-setup') != ''
32
40
- name : Run tests
33
41
uses : protocol/multiple-go-modules@v1.2
34
42
with :
35
- run : go test -v -coverprofile module-coverage.txt ./...
43
+ # Use -coverpkg=./..., so that we include cross-package coverage.
44
+ # If package ./A imports ./B, and ./A's tests also cover ./B,
45
+ # this means ./B's coverage will be significantly higher than 0%.
46
+ run : go test -v -coverprofile=module-coverage.txt -coverpkg=./... ./...
36
47
- name : Run tests (32 bit)
37
48
if : ${{ matrix.os != 'macos' }} # can't run 32 bit tests on OSX.
38
49
uses : protocol/multiple-go-modules@v1.2
49
60
shell : bash
50
61
run : echo "COVERAGES=$(find . -type f -name 'module-coverage.txt' | tr -s '\n' ',' | sed 's/,$//')" >> $GITHUB_ENV
51
62
- name : Upload coverage to Codecov
52
- uses : codecov/codecov-action@51d810878be5422784e86451c0e7c14e5860ec47 # v2.0.2
63
+ uses : codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0
53
64
with :
54
65
files : ' ${{ env.COVERAGES }}'
55
66
env_vars : OS=${{ matrix.os }}, GO=${{ matrix.go }}
0 commit comments