generated from permafrost-dev/go-project-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
41 lines (35 loc) · 916 Bytes
/
run-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
name: run-tests
on:
push:
branches:
- main
tags:
- v*
pull_request:
pull_request_target:
types: [opened, edited]
jobs:
run-tests:
runs-on: ubuntu-latest
env:
GO_VERSION: "~1.23"
GO111MODULE: "on"
USE_CODECOV: true
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Checkout code
uses: actions/checkout@v4
- name: Download and tidy Go modules
run: go mod download && go mod tidy
- name: Run Tests with Coverage
if: ${{success()}}
run: go test -cover -coverprofile coverage.out -v ./cmd/**
- name: Upload coverage reports to Codecov
if: ${{ success() && env.USE_CODECOV }}
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.out