Skip to content

Commit b4fcc92

Browse files
committed
chore(ci) : setup test and lint workflows
Signed-off-by: Matthieu MOREL <mmorel-35@users.noreply.github.com>
1 parent c15f76a commit b4fcc92

File tree

3 files changed

+53
-23
lines changed

3 files changed

+53
-23
lines changed

.github/dependabot.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,8 @@ updates:
33
- package-ecosystem: gomod
44
directory: /
55
schedule:
6-
interval: daily
6+
interval: weekly
7+
- package-ecosystem: github-actions
8+
directory: /
9+
schedule:
10+
interval: weekly

.github/workflows/main.yml

+38-22
Original file line numberDiff line numberDiff line change
@@ -9,44 +9,60 @@ on:
99
pull_request:
1010

1111
jobs:
12+
lint:
13+
name: Lint
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Check out code into the Go module directory
17+
uses: actions/checkout@v2
18+
- name: Set up Go
19+
uses: actions/setup-go@v2
20+
with:
21+
go-version: 1.16
22+
- name: Lint
23+
uses: golangci/golangci-lint-action@v2
24+
with:
25+
version: v1.42
26+
args: --verbose
1227
unit-tests:
1328
strategy:
1429
matrix:
15-
go-version: [ 1.16 ]
16-
os: [ ubuntu-latest, macos-latest, windows-latest ]
30+
go-version: [1.16]
31+
os: [ubuntu-latest, macos-latest, windows-latest]
1732
runs-on: ${{ matrix.os }}
1833
steps:
19-
-
20-
name: Checkout
34+
- name: Checkout
2135
uses: actions/checkout@v2
2236
with:
2337
fetch-depth: 0
24-
-
25-
name: Set up Go
38+
- name: Set up Go
2639
uses: actions/setup-go@v2
2740
with:
2841
go-version: ${{ matrix.go-version }}
29-
-
30-
name: Cache Go modules
31-
uses: actions/cache@v1
42+
- name: Cache Go modules
43+
uses: actions/cache@v2
3244
with:
33-
path: ~/go/pkg/mod
45+
path: |
46+
~/.cache/go-build
47+
~/go/pkg/mod
3448
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
3549
restore-keys: |
3650
${{ runner.os }}-go-
37-
-
38-
name: Setup
51+
- name: Setup
3952
run: make setup
40-
-
41-
name: Make Unit Tests
53+
- name: Make Unit Tests
4254
run: make test
43-
-
44-
name: Diff
55+
- name: Upload Code Coverage
56+
uses: codecov/codecov-action@v2
57+
with:
58+
flags: unit-tests,${{ matrix.os }}
59+
token: ${{ secrets.CODECOV_TOKEN }}
60+
- name: Diff
4561
run: git diff
4662
goreleaser:
4763
strategy:
4864
matrix:
49-
go-version: [ 1.16 ]
65+
go-version: [1.16]
5066
runs-on: ubuntu-latest
5167
if: startsWith(github.ref, 'refs/tags/')
5268
needs:
@@ -61,17 +77,18 @@ jobs:
6177
with:
6278
go-version: ${{ matrix.go-version }}
6379
- name: Cache Go modules
64-
uses: actions/cache@v1
80+
uses: actions/cache@v2
6581
with:
66-
path: ~/go/pkg/mod
82+
path: |
83+
~/.cache/go-build
84+
~/go/pkg/mod
6785
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
6886
restore-keys: |
6987
${{ runner.os }}-go-
7088
- name: Setup
7189
run: make setup
7290
- name: Make build
73-
run: make build
74-
91+
run: make build
7592
- name: Run GoReleaser
7693
uses: goreleaser/goreleaser-action@v2
7794
if: success()
@@ -80,4 +97,3 @@ jobs:
8097
args: release --rm-dist
8198
env:
8299
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
83-

.golangci.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
linters:
2+
enable:
3+
- gofumpt
4+
disable:
5+
- deadcode
6+
- errcheck
7+
- gosimple
8+
- govet
9+
- staticcheck
10+
- unused

0 commit comments

Comments
 (0)