forked from panjf2000/gnet
-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (61 loc) · 1.77 KB
/
ci.yml
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
name: Tests
on:
push:
branches:
- master
paths-ignore:
- '**.md'
pull_request:
branches:
- master
paths-ignore:
- '**.md'
env:
GO111MODULE: on
GOPROXY: "https://proxy.golang.org"
jobs:
test:
name: Go-Test
strategy:
fail-fast: false
matrix:
go: [1.16.x]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os}}
steps:
- name: Installing Go
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go }}
- name: Checkout code
uses: actions/checkout@v2
- name: Run unit tests for utils
run: go test $(go list ./... | tail -n +2)
- name: Run unit tests for server
run: go test -v -race -coverprofile=coverage -covermode=atomic -timeout 60s
- name: Upload code coverage report to Codecov
uses: codecov/[email protected]
with:
file: ./coverage
flags: unittests
verbose: true
name: codecov-gnet
- name: Print Go environment
id: vars
run: |
printf "Using go at: $(which go)\n"
printf "Go version: $(go version)\n"
printf "\n\nGo environment:\n\n"
go env
printf "\n\nSystem environment:\n\n"
env
# Calculate the short SHA1 hash of the git commit
echo "::set-output name=short_sha::$(git rev-parse --short HEAD)"
echo "::set-output name=go_cache::$(go env GOCACHE)"
- name: Cache go modules
uses: actions/cache@v2
with:
path: ${{ steps.vars.outputs.go_cache }}
key: ${{ runner.os }}-${{ matrix.go }}-go-ci-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-${{ matrix.go }}-go-ci