-
Notifications
You must be signed in to change notification settings - Fork 21
84 lines (79 loc) · 2.07 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
name: CI
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.20'
- run: make test
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.20'
- uses: golangci/golangci-lint-action@v3
with:
version: v1.53
integration:
runs-on: ubuntu-latest
needs:
- test
- lint
steps:
- uses: engineerd/setup-kind@v0.5.0
with:
version: "v0.20.0"
image: 'kindest/node:v1.24.15'
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: Setup
run: |
kubectl create namespace nginx-operator-system
make install docker-build
kind load docker-image ${IMAGE}:${TAG}
(cd ./config/manager && kustomize edit set image controller=${IMAGE}:${TAG})
kind load docker-image ${IMAGE}:${TAG}
make deploy
env:
IMAGE: tsuru/nginx-operator
TAG: integration
- run: |
NGINX_OPERATOR_INTEGRATION=1 make test
docker-image:
runs-on: ubuntu-latest
needs:
- test
- lint
- integration
if: github.event_name != 'pull_request'
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- uses: actions/checkout@v3
- uses: Surgo/docker-smart-tag-action@v1
id: smarttag
with:
docker_image: tsuru/nginx-operator
default_branch: main
tag_with_sha: "true"
- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- uses: docker/build-push-action@v4
with:
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.smarttag.outputs.tag }}
build-args: |-
VERSION=${{ github.ref_name }}
GIT_COMMIT=${{ github.sha }}