7070 uses : actions/checkout@v2
7171 with :
7272 path : " go-agent"
73+
74+ - name : Create a directory for code coverage reports
75+ run : mkdir -p ${{ github.workspace }}/coverage-reports
76+
7377 - name : Set up Codecov environment variables
7478 run : ci_env=`bash <(curl -s https://codecov.io/env)`
79+
7580 - name : Build Docker Image
7681 run : docker build -f ${{ github.workspace }}/go-agent/Dockerfile ${{ github.workspace }} --build-arg GO_VERSION=${{ matrix.go-version || env.INTEGRATION_TESTS_GO_VERSION }} -t go-agent-tests-amd64
7782
@@ -80,17 +85,23 @@ jobs:
8085 IFS=',' read -ra DIRS <<< "${{ matrix.dirs }}"
8186 for dir in "${DIRS[@]}"; do
8287 if [ -d "go-agent/$dir" ]; then
88+ coverage_dir="${{ github.workspace }}/coverage-reports/"
89+ mkdir -p "$coverage_dir"
8390 if [[ "$dir" == *"nrnats"* ]]; then
84- docker run $ci_env -e CI=true -e GOPROXY=direct go-agent-tests-amd64 ./go-agent/run-tests.sh "$dir"
91+ docker run $ci_env -e CI=true -e GOPROXY=direct -v "$coverage_dir:/coverage" go-agent-tests-amd64 ./go-agent/run-tests.sh "$dir"
8592 else
86- docker run $ci_env -e CI=true go-agent-tests-amd64 ./go-agent/run-tests.sh "$dir"
93+ docker run $ci_env -e CI=true -v "$coverage_dir:/coverage" go-agent-tests-amd64 ./go-agent/run-tests.sh "$dir"
8794 fi
8895 else
8996 echo "Directory /app/$dir does not exist."
9097 fi
9198 done
99+
92100 - name : Upload coverage to Codecov
93101 uses : codecov/codecov-action@v3
102+ with :
103+ files : ${{ github.workspace }}/coverage-reports/*
104+
94105
95106 # Arm64 tests
96107 go-agent-v3-arm64 :
@@ -132,7 +143,4 @@ jobs:
132143 else
133144 echo "Directory /app/$dir does not exist."
134145 fi
135- done
136-
137- - name : Upload coverage to Codecov
138- uses : codecov/codecov-action@v3
146+ done
0 commit comments