forked from brancz/kube-rbac-proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (105 loc) · 2.82 KB
/
build.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
name: Go
on: [push, pull_request]
env:
QUAY_PATH: docker.io/tetrate/kube-rbac-proxy
go-version: '1.21.5'
kind-version: 'v0.20.0'
jobs:
check-license:
runs-on: ubuntu-latest
name: Check license
steps:
- uses: actions/checkout@v2
- run: make check-license
generate:
runs-on: ubuntu-latest
name: Generate
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: ${{ env.go-version }}
- run: make generate && git diff --exit-code
lint:
runs-on: ubuntu-latest
name: Lint
steps:
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: latest
args: --timeout=5m
build:
runs-on: ubuntu-latest
name: Build
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: ${{ env.go-version }}
- run: make build
unit-tests:
runs-on: ubuntu-latest
name: Unit tests
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: ${{ env.go-version }}
- run: make test-unit
e2e-tests:
runs-on:
- linux
- arc
- x64
- self-hosted
name: E2E tests
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Start kind & create cluster
uses: engineerd/[email protected]
with:
version: ${{ env.kind-version }}
config: test/e2e/kind-config/kind-config.yaml
wait: 300s
- name: Wait for cluster to finish bootstraping
run: kubectl wait --for=condition=Ready pods --all --all-namespaces --timeout=300s
- name: Setup golang for make test-e2e
uses: actions/setup-go@v2
with:
go-version: ${{ env.go-version }}
- name: Create container & run tests
run: |
VERSION=local VERSION_SEMVER=$(cat ./VERSION) make container
kind load docker-image ${QUAY_PATH}:local
until docker exec $(kind get nodes) crictl images | grep "${QUAY_PATH}"; do
echo "no kube-rbac-proxy image"
sleep 1
done
make test-e2e
publish:
runs-on: ubuntu-latest
name: Publish container image to Quay
if: github.event_name == 'push'
needs:
- check-license
- generate
- build
- unit-tests
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup golang for building
uses: actions/setup-go@v2
with:
go-version: ${{ env.go-version }}
- name: Login to Quay.io
uses: docker/login-action@v1
with:
registry: docker.io
username: ${{ secrets.TETRATE_CI_DOCKERHUB_USERNAME }}
password: ${{ secrets.TETRATE_CI_DOCKERHUB_PASSWORD }}
- name: Build images and push
run: ./scripts/publish.sh