Go Test #7
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 Test | |
on: | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.22 | |
- name: chmod | |
run: chmod +x ./setup-test.sh | |
- name: setup tests | |
run: ./setup-test.sh | |
- name: Run tests and generate coverage report | |
run: | | |
go test -coverprofile=coverage.out ./... | |
go tool cover -func=coverage.out -o coverage.txt | |
go tool cover -html=coverage.out -o coverage.html | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
verbose: true | |
name: codecov-umbrella | |
file: coverage.txt | |
fail_ci_if_error: true | |
slug: knbr13/gitcs | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |