-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (63 loc) · 1.81 KB
/
Copy pathtest.yml
File metadata and controls
79 lines (63 loc) · 1.81 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Run tests
permissions:
contents: read
id-token: write
on:
push:
branches:
- main
pull_request:
env:
GOTESTSUM_VERSION: v1.13.0
GOLANGCI_LINT_VERSION: v2.11.4
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install Go
id: install-go
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
- name: Cache Go test cache
uses: actions/cache@v5
with:
path: /home/runner/.cache/go-test-cache
key: ${{ runner.os }}-go-testcache-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-testcache-
- name: Download dependencies
run: go mod download
if: steps.install-go.outputs.cache-hit != 'true'
- name: Setup gotestsum
uses: gertd/action-gotestsum@v3.0.0
with:
gotestsum_version: v1.13.0
- name: Run Tests
run: gotestsum --junitfile tests.xml --format pkgname -- -covermode=atomic -coverprofile=coverage.out -race ./...
env:
GOCACHE: /home/runner/.cache/go-test-cache
- name: Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
files: coverage.out
format: golang
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install Go
id: install-go
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
- name: Download dependencies
run: go mod download
if: steps.install-go.outputs.cache-hit != 'true'
- name: Run linter
uses: golangci/golangci-lint-action@v9
with:
version: ${{ env.GOLANGCI_LINT_VERSION }}