-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (41 loc) · 1.37 KB
/
main-operator-ci-cd.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
name: main-instaclustr-operator-ci-cd
on:
push:
branches:
- main
jobs:
main-operator-build-and-push:
name: MAIN Build and push the Instaclustr Operator
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Lint Go code
run: |
go install github.com/golangci/golangci-lint/cmd/[email protected]
golangci-lint run --timeout 5m --skip-dirs=pkg/instaclustr/mock
- name: Make goimports
run: |
go install golang.org/x/tools/cmd/[email protected]
files_to_be_goimported=$(find . -type f -name '*.go' -not -path "./vendor/*")
goimports -v -w -local ./ -l $files_to_be_goimported
- name: Test Go code
run: |
sudo apt update
sudo apt-get install -y make
make test
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push the Operator image
uses: docker/build-push-action@v3
with:
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/instaclustr-operator:latest