Skip to content

Commit d77e34b

Browse files
committed
ci: add GH tests
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
1 parent dac81a2 commit d77e34b

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: golangci-lint
2+
on:
3+
push:
4+
tags:
5+
- v*
6+
branches:
7+
- main
8+
pull_request:
9+
jobs:
10+
golangci:
11+
name: lint
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: golangci-lint
16+
uses: golangci/golangci-lint-action@v2
17+
with:
18+
version: v1.42.1

.github/workflows/test.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
pull_request:
6+
branches:
7+
- main
8+
name: Test
9+
jobs:
10+
test:
11+
strategy:
12+
matrix:
13+
go-version: [1.16.x, 1.17.x]
14+
os: [ubuntu-latest, macos-latest, windows-latest]
15+
runs-on: ${{ matrix.os }}
16+
steps:
17+
- name: Install Go
18+
uses: actions/setup-go@v2
19+
with:
20+
go-version: ${{ matrix.go-version }}
21+
- name: Checkout code
22+
uses: actions/checkout@v2
23+
- uses: actions/cache@v2
24+
with:
25+
path: |
26+
~/go/pkg/mod
27+
~/.cache/go-build
28+
~/Library/Caches/go-build
29+
%LocalAppData%\go-build
30+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
31+
restore-keys: |
32+
${{ runner.os }}-go-
33+
- name: Test CGO free
34+
run: make check-cgo-free
35+
- name: Test
36+
run: make test

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
GO_FLAGS=CGO_ENABLED=0
2+
3+
check-cgo-free:
4+
$(GO_FLAGS) go build ./...
5+
.PHONY: check-cgo-free
6+
7+
test:
8+
go test ./... -race
9+
.PHONY: test
10+

0 commit comments

Comments
 (0)