Skip to content

Commit

Permalink
feat(ci): update coverage workflow
Browse files Browse the repository at this point in the history
This renames the workflow inputs to be more consistent with the rest of
the workflows. And adds the ability to pass Codecov token.
  • Loading branch information
aymanbagabas committed Sep 18, 2024
1 parent 117014e commit b5a977b
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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 }}

0 comments on commit b5a977b

Please sign in to comment.