forked from brancz/kube-rbac-proxy
-
Notifications
You must be signed in to change notification settings - Fork 1
105 lines (102 loc) · 2.76 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
name: Go
on: [push, pull_request]
env:
QUAY_PATH: quay.io/brancz/kube-rbac-proxy
go-version: '1.21.3'
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: ubuntu-latest
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
- e2e-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: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Build images and push
run: ./scripts/publish.sh