forked from ugorji/go
-
Notifications
You must be signed in to change notification settings - Fork 22
61 lines (57 loc) · 2.03 KB
/
test.yaml
File metadata and controls
61 lines (57 loc) · 2.03 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
name: Tests
on: [push, workflow_dispatch]
jobs:
get-go-version:
name: Determine Go toolchain version
runs-on: ubuntu-latest
outputs:
go-version: ${{ steps.get-go-version.outputs.go-version }}
steps:
- name: Checkout Code
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- name: Determine Go version
id: get-go-version
run: |
echo "Building with Go $(cat .go-version)"
echo "{go-version}={$(cat .go-version)}" >> $GITHUB_OUTPUT
fmtcheck:
name: format check
runs-on: ubuntu-latest
needs: [get-go-version]
steps:
- name: Chekout Code
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- name: Setup Go
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: ${{ needs.get-go-version.outputs.go-version }}
- name: Check formatting
run: "exit $(( $(gofmt -s -l . | wc -l) != 0 ))"
test:
name: codec test
runs-on: ubuntu-latest
needs: [get-go-version]
steps:
- name: Checkout Code
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- name: Setup Go
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: ${{ needs.get-go-version.outputs.go-version }}
- name: Run golangci-lint
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
with:
version: v2.5.0
- run: go test -v ./codec
- run: go test -tags codecgen.exec -v ./codec
- name: Generate coverage report
run: go test -v -coverprofile=coverage.out ./...
- name: Upload coverage report
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808
with:
path: coverage.out
name: Coverage-report
- name: Display coverage report
run: go tool cover -func=coverage.out
- name: Build Go
run: go build ./...