-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (86 loc) · 2.51 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
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
name: CI (Build, Lint, Test)
on:
# pull_request:
# paths:
# - '**'
# - '!readme.md'
# - '!stack.yml'
# - '!.idea/**'
push:
paths:
- '**'
- '!readme.md'
- '!stack.yml'
- '!.idea/**'
tags:
- '**'
- '!v*.*'
branches:
- '**'
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.13
uses: actions/setup-go@v1
with:
go-version: 1.13
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Get dependencies
run: |
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
- name: Build linux_amd64
run: GOOS=linux GOARCH=amd64 go build -o octopod_linux -v ./cmd/server
- name: Build windows_amd64
run: GOOS=windows GOARCH=amd64 go build -o octopod_win32nt.exe -v ./cmd/server
- name: Build darwin_amd64
run: GOOS=darwin GOARCH=amd64 go build -o octopod_darwin -v ./cmd/server
- name: Build freebsd_amd64
run: GOOS=freebsd GOARCH=amd64 go build -o octopod_freebsd -v ./cmd/server
- name: Docker Build
run: docker build -t octopod:1 .
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.13
- name: Check out code
uses: actions/checkout@v1
- name: Lint Go Code
run: |
export PATH=$PATH:$(go env GOPATH)/bin # temporary fix. See https://github.com/actions/setup-go/issues/14
go get -u golang.org/x/lint/golint
golint -set_exit_status ./...
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.13
- name: Check out code
uses: actions/checkout@v2
- name: get docker info
run: docker info
- name: Initialize Swarm
run: docker swarm init
- name: Deploy testing stack
run: docker stack deploy -c ./internal/testing.stack.yml testing
- name: Run Unit tests.
run: go test ./... -coverprofile=coverage.txt -covermode=atomic
- name: Upload Coverage report to CodeCov
uses: codecov/[email protected]
with:
token: ${{secrets.CODECOV_TOKEN}}
file: ./coverage.txt