-
Notifications
You must be signed in to change notification settings - Fork 45
98 lines (86 loc) · 3.22 KB
/
ci.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
name: Build-Test
on:
push:
branches:
- master
pull_request:
branches:
- master
release:
types:
- published
jobs:
build:
name: CI # Lint, Test, Codecov, Docker build & Push
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.53.2
args: --timeout 3m
- name: Get kubebuilder
env:
version: 1.0.8 # latest stable version
arch: amd64
run: |
# download the release
curl -L -O "https://github.com/kubernetes-sigs/kubebuilder/releases/download/v${version}/kubebuilder_${version}_linux_${arch}.tar.gz"
# extract the archive
tar -zxvf kubebuilder_${version}_linux_${arch}.tar.gz
mv kubebuilder_${version}_linux_${arch} kubebuilder && sudo mv kubebuilder /usr/local/
# update your PATH to include /usr/local/kubebuilder/bin
export PATH=$PATH:/usr/local/kubebuilder/bin
- name: Run Tests
run: make test
- name: Codecov
uses: codecov/codecov-action@v1
with:
file: ./coverage.txt # optional
flags: unittests # optional
name: codecov-umbrella # optional
fail_ci_if_error: true # optional (default = false)
- name: Docker build
if: github.event_name == 'pull_request' || (github.repository != 'keikoproj/upgrade-manager' && github.event_name == 'push')
run: make docker-build
- name: Set up Docker Buildx
if: (github.event_name == 'push' || github.event_name == 'release') && github.repository == 'keikoproj/upgrade-manager'
id: buildx
uses: docker/setup-buildx-action@v2
with:
install: true
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image with tag master # only on pushes to keikoproj/upgrade-manager
if: github.event_name == 'push' && github.repository == 'keikoproj/upgrade-manager'
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm/v7,linux/arm64
push: true
tags: master
- name: Build and push Docker image with tag latest # only on releases of keikoproj/upgrade-manager
if: github.event_name == 'release' && github.repository == 'keikoproj/upgrade-manager'
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm/v7,linux/arm64
push: true
tags: latest
- name: Build and push Docker image with tag git-tag # only on releases of keikoproj/upgrade-manager
if: github.event_name == 'release' && github.repository == 'keikoproj/upgrade-manager'
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm/v7,linux/arm64
push: true
tag_with_ref: true