forked from google/go-licenses
-
Notifications
You must be signed in to change notification settings - Fork 8
150 lines (124 loc) · 3.65 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
139
140
141
142
143
144
145
146
147
148
149
150
name: 'app-pipeline'
on:
push:
pull_request:
jobs:
test:
strategy:
matrix:
go-version: [1.18.x]
platform: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Cache Go dependencies
id: cache-go-dependencies
uses: actions/cache@v2
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.cache-go-dependencies.outputs.cache-hit != 'true'
run: make bootstrap
- name: Run Static Analysis
run: make lint
- name: Run Tests
run: make test
build-artifacts:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.18.x'
- name: Cache Go dependencies
id: package-cache-go-dependencies
uses: actions/cache@v2
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 ci-build-snapshot-packages
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: artifacts
path: dist
test-linux-artifacts:
needs: build-artifacts
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Download artifacts
uses: actions/download-artifact@v3
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:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.20' # Specify the Go version you need
- name: Download artifacts
uses: actions/download-artifact@v3
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]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.18.x'
- name: Cache Go dependencies
id: release-cache-go-dependencies
uses: actions/cache@v2
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 }}