forked from google/go-licenses
-
Notifications
You must be signed in to change notification settings - Fork 8
138 lines (110 loc) · 3.33 KB
/
pipeline.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
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: 'app-pipeline'
on:
push:
pull_request:
types: [ opened, reopened ]
jobs:
test:
strategy:
matrix:
go-version: [1.14.x]
platform: [ubuntu-latest, macos-latest] # TODO: add 'windows-latest' support
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go-version }}
- uses: actions/checkout@v1
- name: Cache go dependencies
id: unit-cache-go-dependencies
uses: actions/cache@v1
with:
path: |
~/go/pkg/mod
.tmp/
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ matrix.go-version }}-
- name: Install go dependencies
if: steps.unit-cache-go-dependencies.outputs.cache-hit != 'true'
run: make bootstrap
- name: Run Static Analyses
run: make lint
- name: Run Tests
run: make test
build-artifacts:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v1
with:
go-version: '1.14.x'
- uses: actions/checkout@v1
- name: Cache go dependencies
id: package-cache-go-dependencies
uses: actions/cache@v1
with:
path: |
~/go/pkg/mod
.tmp/
key: ${{ runner.os }}-go-prod-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-prod-
- name: Install dependencies
if: steps.package-cache-go-dependencies.outputs.cache-hit != 'true'
run: make bootstrap
- name: Build snapshot artifacts
run: make snapshot
- uses: actions/upload-artifact@master
with:
name: artifacts
path: dist
test-linux-artifacts:
needs: [ build-artifacts ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/download-artifact@master
with:
name: artifacts
path: dist
- name: Test linux run
run: make ci-test-linux-run
- name: Test docker run
run: make ci-plugs-out-test
test-mac-artifacts:
needs: [ build-artifacts ]
runs-on: macos-latest
steps:
- uses: actions/checkout@master
- uses: actions/download-artifact@master
with:
name: artifacts
path: dist
- name: Test darwin run
run: make ci-test-mac-run
release:
needs: [ test, build-artifacts, test-linux-artifacts, test-mac-artifacts ] # TODO: add windows support
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/setup-go@v1
with:
go-version: '1.14.x'
- uses: actions/checkout@v1
- name: Cache go dependencies
id: release-cache-go-dependencies
uses: actions/cache@v1
with:
path: |
~/go/pkg/mod
.tmp/
key: ${{ runner.os }}-go-prod-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-prod-
- name: Install dependencies
if: steps.release-cache-go-dependencies.outputs.cache-hit != 'true'
run: make bootstrap
- name: Publish GitHub release
run: make ci-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}