-
Notifications
You must be signed in to change notification settings - Fork 3
85 lines (70 loc) · 2 KB
/
test.yml
File metadata and controls
85 lines (70 loc) · 2 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
80
81
82
83
84
85
on:
push:
branches:
- main
pull_request:
name: run tests
jobs:
lint:
runs-on: ubuntu-latest
env:
GOLANGCI_LINT_VERSION: v2.11.3
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 }}
test:
strategy:
matrix:
go-version: [ "1.25", "1.26" ]
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: ${{ matrix.go-version }}
check-latest: true
- 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 --format pkgname -- -covermode=atomic -coverprofile=coverage.out -race ./...
- name: Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
files: coverage.out
format: golang
parallel: true
flag-name: go-${{ matrix.go-version }}
test-results:
needs: test
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
- name: Check matrix results
if: ${{ contains(needs.test.result, 'failure') || contains(needs.test.result, 'cancelled') }}
run: exit 1