generated from gogolcorp/go-yave
-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (44 loc) · 1.01 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
name: "CI"
on:
pull_request:
branches: [ main ]
push:
branches:
- '**'
- '!main'
paths:
- '**/*.go'
- '**/go.*'
jobs:
CI:
name: CI
runs-on: ubuntu-latest
steps:
# Checkout to current workspace
- name: 1 - CHECKOUT
uses: actions/checkout@v3
# Install golang with specific version
- name: 2 - SETUP GO
uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
cache: true
cache-dependency-path: 'go.sum'
# Cache go modules to make the build faster
- name: 3 - CACHE GO MODULES
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
# Lint files before build using gofmt
- name: 4 - LINT
run: |
gofmt -e -l -s -w .
# Build the project
- name: 5 - BUILD
run: |
go build -v ./...