This repository has been archived by the owner on May 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 39
171 lines (169 loc) · 5.83 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
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
on:
push:
branches:
- master
- release-*
pull_request:
branches:
- master
release:
types:
- published
jobs:
E2E:
runs-on: ubuntu-latest
name: Install setup build e2e
steps:
- run: |
mkdir "$HOME/bin" && export PATH="$HOME/bin:$PATH"
shell: bash
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.15
- name: Install Kubectl
run: |
curl -L https://storage.googleapis.com/kubernetes-release/release/v1.17.2/bin/linux/amd64/kubectl > $HOME/bin/kubectl
chmod +x $HOME/bin/kubectl
shell: bash
- name: Install Kind
run: curl -Lo ./kind "https://kind.sigs.k8s.io/dl/v0.9.0/kind-$(uname)-amd64" &&
chmod +x ./kind && mv ./kind $HOME/bin/kind
shell: bash
- name: Install Kustomize
run: curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
shell: bash
- name: Setup clusters
run: ./hack/spin-local-kind.sh
shell: bash
- name: E2E
run: ./ci/build.sh && ./ci/e2e.sh
shell: bash
Verify:
runs-on: ubuntu-latest
name: Verify codegen
steps:
- name: Checkout code
uses: actions/checkout@v2
- run: TEST_FLAGS="-v" make verify-codegen
GolangCI-Lint:
runs-on: ubuntu-latest
name: GolangCI-Lint
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: golangci-lint pkg
uses: golangci/golangci-lint-action@v2
with:
version: v1.31.0
working-directory: ./pkg/
args: -v --config ../.golangci.yml
- name: golangci-lint cmd
uses: golangci/golangci-lint-action@v2
with:
version: v1.31.0
working-directory: ./cmd/
args: -v --config ../.golangci.yml
- name: golangci-lint test
uses: golangci/golangci-lint-action@v2
with:
version: v1.31.0
working-directory: ./test/
args: -v --config ../.golangci.yml
Tests:
runs-on: ubuntu-latest
name: Tests
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.15
- name: run tests
run: TEST_FLAGS="-v" make test
shell: bash
Publish:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
name: Publish
needs: [ Verify, GolangCI-Lint, E2E, Tests ]
steps:
- run: echo SOURCE_TAG=${GITHUB_REF#refs/tags/} >> $GITHUB_ENV
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.15
- name: Install Kustomize
run: curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
shell: bash
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build all
run: USE_IMAGE_NAME_WITH_SHA256= IMAGE_TAG=$SOURCE_TAG DOCKER_REGISTRY=docker.io make build-all
- name: Archive artifacts
uses: actions/upload-artifact@v2
with:
name: build
path: build/*
- name: Upload artifacts - sha256sums
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: build/sha256sums.txt
asset_name: sha256sums.txt
asset_content_type: application/index
- name: Upload artifacts - shipper.deployment
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: "build/shipper.deployment.${{ env.SOURCE_TAG }}.yaml"
asset_name: "shipper.deployment.${{ env.SOURCE_TAG }}.yaml"
asset_content_type: application/index
- name: Upload artifacts - shipper-state-metrics.deployment
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: "build/shipper-state-metrics.deployment.${{ env.SOURCE_TAG }}.yaml"
asset_name: "shipper-state-metrics.deployment.${{ env.SOURCE_TAG }}.yaml"
asset_content_type: application/index
- name: Upload artifacts - shipperctl.darwin
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: build/shipperctl.darwin-amd64.tar.gz
asset_name: shipperctl.darwin-amd64.tar.gz
asset_content_type: application/tar+gzip
- name: Upload artifacts - shipperctl.linux
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: build/shipperctl.linux-amd64.tar.gz
asset_name: shipperctl.linux-amd64.tar.gz
asset_content_type: application/tar+gzip
- name: Upload artifacts - shipperctl.windows
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: build/shipperctl.windows-amd64.tar.gz
asset_name: shipperctl.windows-amd64.tar.gz
asset_content_type: application/tar+gzip