Skip to content

Commit 2708cdc

Browse files
committed
set up github actions
1 parent e6752c7 commit 2708cdc

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

.github/workflows/test.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: CI test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
test:
13+
name: Go ${{ matrix.go-version }} Test
14+
15+
strategy:
16+
matrix:
17+
go-version: [1.16.x, 1.17.x]
18+
# platform: [ubuntu-latest, macos-latest, windows-latest]
19+
platform: [ubuntu-latest, macos-latest]
20+
21+
runs-on: ${{ matrix.platform }}
22+
23+
steps:
24+
- name: Set up Go ${{ matrix.go-version }}
25+
uses: actions/setup-go@v2
26+
with:
27+
go-version: ${{ matrix.go-version }}
28+
id: go
29+
30+
- name: Check out codes
31+
uses: actions/checkout@v2
32+
33+
- name: Cache modules
34+
uses: actions/cache@v2
35+
with:
36+
# In order:
37+
# * Module download cache
38+
# * Build cache (Linux)
39+
# * Build cache (Mac)
40+
# * Build cache (Windows)
41+
path: |
42+
~/go/pkg/mod
43+
~/.cache/go-build
44+
~/Library/Caches/go-build
45+
%LocalAppData%\go-build
46+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
47+
restore-keys: |
48+
${{ runner.os }}-go-
49+
50+
- name: Run lint
51+
uses: golangci/golangci-lint-action@v2
52+
with:
53+
version: v1.42
54+
55+
- name: Run tests
56+
run: go test ./...

0 commit comments

Comments
 (0)