Add test coverage reporting and Codecov badge #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Go | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
redis: | |
image: redis/redis-stack-server:edge | |
options: >- | |
--health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5 | |
ports: | |
- 6379:6379 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
- name: Install dependencies | |
run: go mod download | |
- name: Run tests | |
run: go test -coverprofile=coverage.out ./... | |
- name: Upload to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
files: coverage.out | |
token: ${{ secrets.CODECOV_TOKEN }} |