forked from camptocamp/bivac
-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (87 loc) · 2.47 KB
/
main.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: Binary
on:
workflow_dispatch: {}
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/bivac
DOCKER_CLI_EXPERIMENTAL: enabled
jobs:
linting:
name: Linting
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.14
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Run Go Vet
run: make vet
- name: Lint code
run: make lint
tests:
name: Unit testing
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.14
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Run unit tests
run: make test
- name: Send coverage
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: coverage
build-binary:
name: Build Binary
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.14
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Build binary
run: make bivac
build-docker-image:
name: Build Docker Image
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.14
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Build docker image
run: docker build --build-arg GO_VERSION=1.14 --build-arg GOOS=linux --build-arg GOARCH=amd64 .
publish-docker-image-latest:
name: Publish docker image tagged latest
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
steps:
- name: Check out the repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Login to Github Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
- name: Build and push docker images
run: |
IMAGE_NAME=${{ env.IMAGE_NAME }} IMAGE_VERSION=latest KEEP_IMAGES=yes make docker-images