From b5a977b929f24609ac9644c2e148b5963142dee4 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Wed, 18 Sep 2024 11:00:47 -0400 Subject: [PATCH] feat(ci): update coverage workflow This renames the workflow inputs to be more consistent with the rest of the workflows. And adds the ability to pass Codecov token. --- .github/workflows/coverage.yml | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 12750d9..9ded6ff 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -1,19 +1,27 @@ -name: build +name: coverage on: workflow_call: inputs: - go_version: + go-version: required: false type: string default: stable - test_timeout: + go-version-file: + required: false + type: string + working-directory: + required: false + type: string + test-timeout: required: false type: string default: 5m secrets: gh_pat: required: false + codecov_token: + required: false jobs: coverage: @@ -30,10 +38,17 @@ jobs: - name: Install Go uses: actions/setup-go@v5 with: - go-version: ${{ inputs.go_version }} + go-version: ${{ inputs.go-version }} + go-version-file: ${{ inputs.go-version-file }} cache: true + - name: Download Go modules + run: go mod download + working-directory: ${{ inputs.working-directory }} - name: Test - run: go test -failfast -race -coverpkg=./... -covermode=atomic -coverprofile=coverage.txt ./... -timeout ${{ inputs.test_timeout }} + run: go test -failfast -race -coverpkg=./... -covermode=atomic -coverprofile=coverage.txt ./... -timeout ${{ inputs.test-timeout }} + working-directory: ${{ inputs.working-directory }} - uses: codecov/codecov-action@v4 with: file: ./coverage.txt + token: ${{ secrets.codecov_token }} + working-directory: ${{ inputs.working-directory }}