-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (54 loc) · 1.55 KB
/
go.yaml
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
65
66
67
68
name: Go CI
on:
workflow_dispatch:
push:
branches: [main]
paths-ignore:
- '**/*.md'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Cache Go modules
uses: actions/cache@v2
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install dependencies
run: go mod download
working-directory: ./go-app
- name: Build
run: go build -v ./...
working-directory: ./go-app
- name: Test
run: go test ./...
working-directory: ./go-app
- name: running tidy
run: go mod init github.com/charan-happy/MyApp/go-app
- name: Install golangci-lint
run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
env:
GOBIN: /go/bin
PATH: /go/bin:${{ env.PATH }}
working-directory: ./go-app
- name: Run Linter
run: golangci-lint run
working-directory: ./go-app
- name: Dockerhub Login
uses: docker/[email protected]
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build Docker image
run: docker build -t ${{ vars.DOCKERHUB_USERNAME }}/go-app ./go-app
- name: Push Docker image
run: docker push ${{ vars.DOCKERHUB_USERNAME }}/go-app