Repository navigation
99 lines (79 loc) · 2.73 KB
/
Copy pathcheck.yml
File metadata and controls
99 lines (79 loc) · 2.73 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# Based upon:
# https://github.com/actions/starter-workflows/blob/main/ci/go.yml
name: Build and Run Unit Tests
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
permissions: {}
jobs:
check:
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
strategy:
fail-fast: false
matrix:
# Test on the two latest Go releases, matching the Go release policy: https://go.dev/doc/devel/release
go-version: ['1.25', '1.26']
steps:
- uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2
with:
submodules: 'recursive'
persist-credentials: false
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@bfdd3570ce990073878bf10f6b2d79082de49492 # v2
with:
go-version: ${{ matrix.go-version }}
- name: Download Packages
run: go get -t -v ./...
- name: Format
run: if [ "$(gofmt -l . | wc -l)" -gt 0 ]; then exit 1; fi
- name: Vet
run: go vet ./...
- name: Ensure generated code is up-to-date
run: scripts/ci-generate.sh
- name: Install go-junit-report
run: go install github.com/jstemmer/go-junit-report@latest
- name: Unit Tests
run: |
set -o pipefail
go test -v -tags=unit ./... |& tee >(~/go/bin/go-junit-report > unit.junit)
- name: Upload test results
if: always()
uses: ably/test-observability-action@5b61d9c59f356b83426cab1b8243dd8bf03c1bea # v1
with:
server-url: 'https://test-observability.herokuapp.com'
server-auth: ${{ secrets.TEST_OBSERVABILITY_SERVER_AUTH_KEY }}
path: '.'
- name: View unit test results
uses: dorny/test-reporter@3eeb9fc888e82e8be2fb356bbeec2750231672bc # v1
if: success() || failure()
with:
name: Unit Test Results (Go ${{ matrix.go-version }})
path: unit.junit
reporter: java-junit
fail-on-error: true
only-summary: false
# The SDK supports the Go version in go.mod, which is older than the
# versions above. Build it there; the tests need a newer Go.
check-min-go:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2
with:
submodules: 'recursive'
persist-credentials: false
- name: Set up Go 1.18
uses: actions/setup-go@bfdd3570ce990073878bf10f6b2d79082de49492 # v2
with:
go-version: '1.18'
- name: Build
run: go build ./server/... ./device/... ./objects/...
- name: Vet
run: go vet ./server/... ./device/... ./objects/...