-
-
Notifications
You must be signed in to change notification settings - Fork 69
59 lines (51 loc) · 1.47 KB
/
Copy pathtest.yaml
File metadata and controls
59 lines (51 loc) · 1.47 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
---
name: Run Tests and Upload Coverage
on:
workflow_call:
workflow_dispatch:
pull_request:
paths:
- cmd/**
- internal/**
- pkg/**
- go.mod
- go.sum
- main.go
permissions:
contents: read # Set default read-only permissions
jobs:
test:
name: Run Tests and Upload Coverage Report
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform:
- macos-latest
- windows-2025
- ubuntu-latest
steps:
- name: Harden the Runner (Step Security)
uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0
with:
egress-policy: audit
- name: Checkout Repo
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: Setup Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
cache: true
cache-dependency-path: "**/go.sum"
go-version-file: go.mod
- name: Install Dependencies
run: go mod download
- name: Run Tests
run: |
go test -timeout 60s -v -coverprofile="coverage.out" -covermode atomic ./...
- name: Upload Coverage Report to Codecov
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}