From 5af54412fe274d918e19922d5620ba20a3abad88 Mon Sep 17 00:00:00 2001 From: Kenny Leung Date: Tue, 1 Mar 2022 16:57:06 -0800 Subject: [PATCH] Add codecov as github action, set permissions to read content only (#1530) Signed-off-by: Kenny Leung --- .github/workflows/tests.yaml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index fbe480bfc143..afdfa4ed78cc 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -28,10 +28,14 @@ env: jobs: unit-tests: name: Run unit tests + permissions: + contents: read runs-on: ${{ matrix.os }} strategy: matrix: os: [macos-latest, ubuntu-latest, windows-latest] + env: + OS: ${{ matrix.os }} steps: - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 #v2.4.0 @@ -55,7 +59,11 @@ jobs: with: go-version: ${{ env.GO_VERSION }} - name: Run Go tests - run: go test ./... + run: go test -covermode atomic -coverprofile coverage.txt ./... + - name: Upload Coverage Report + uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0 + with: + env_vars: OS - name: Run Go tests w/ `-race` if: ${{ runner.os == 'Linux' }} run: go test -race ./...