@@ -3,13 +3,47 @@ name: Go
3
3
on : [push, pull_request]
4
4
5
5
env :
6
- VERSION : 1.15.x
7
6
QUAY_PATH : quay.io/brancz/kube-rbac-proxy
7
+ go-version : ' 1.15'
8
8
kind-version : ' v0.9.0'
9
9
10
10
jobs :
11
- create-cluster :
11
+ check-license :
12
12
runs-on : ubuntu-latest
13
+ name : Check license
14
+ steps :
15
+ - uses : actions/checkout@v2
16
+ - run : make check-license
17
+ generate :
18
+ runs-on : ubuntu-latest
19
+ name : Generate
20
+ steps :
21
+ - uses : actions/checkout@v2
22
+ - uses : actions/setup-go@v2
23
+ with :
24
+ go-version : ${{ env.go-version }}
25
+ - run : make generate && git diff --exit-code
26
+ build :
27
+ runs-on : ubuntu-latest
28
+ name : Build
29
+ steps :
30
+ - uses : actions/checkout@v2
31
+ - uses : actions/setup-go@v2
32
+ with :
33
+ go-version : ${{ env.go-version }}
34
+ - run : make build
35
+ unit-tests :
36
+ runs-on : ubuntu-latest
37
+ name : Unit tests
38
+ steps :
39
+ - uses : actions/checkout@v2
40
+ - uses : actions/setup-go@v2
41
+ with :
42
+ go-version : ${{ env.go-version }}
43
+ - run : make test
44
+ e2e-tests :
45
+ runs-on : ubuntu-latest
46
+ name : E2E tests
13
47
steps :
14
48
- name : Checkout repository
15
49
uses : actions/checkout@v2
@@ -31,11 +65,31 @@ jobs:
31
65
VERSION=local make container
32
66
kind load docker-image ${QUAY_PATH}:local
33
67
make test-e2e
34
- - name : Login and push to Quay
35
- if : github.event_name == 'push'
36
- run : |
37
- docker login quay.io -u="${{ secrets.QUAY_USERNAME }}" -p="${{ secrets.QUAY_PASSWORD }}"
38
- TAG="$(git rev-parse --abbrev-ref HEAD | tr / -)-$(date +%Y-%m-%d)-$(git rev-parse --short HEAD)"
39
- ID="$(docker images ${QUAY_PATH}:local --format "{{.ID}}")"
40
- docker tag $ID ${QUAY_PATH}:$TAG
41
- docker push ${QUAY_PATH}:$TAG
68
+ publish :
69
+ runs-on : ubuntu-latest
70
+ name : Publish container image to Quay
71
+ if : github.event_name == 'push'
72
+ needs :
73
+ - check-license
74
+ - generate
75
+ - build
76
+ - unit-tests
77
+ # Disable e2e-tests job requirement to avoid having flakes impacting
78
+ # image publication.
79
+ # This requirement should be uncommented once the flaky tests are fixed.
80
+ # - e2e-tests
81
+ steps :
82
+ - name : Checkout
83
+ uses : actions/checkout@v2
84
+ - name : Login to Quay.io
85
+ uses : docker/login-actions@v1
86
+ with :
87
+ registry : quay.io
88
+ username : ${{ secrets.QUAY_USERNAME }}
89
+ password : ${{ secrets.QUAY_PASSWORD }}
90
+ - name : Build images and push
91
+ run : |
92
+ TAG="$(git rev-parse --abbrev-ref HEAD | tr / -)-$(date +%Y-%m-%d)-$(git rev-parse --short HEAD)"
93
+ ID="$(docker images ${QUAY_PATH}:local --format "{{.ID}}")"
94
+ docker tag $ID ${QUAY_PATH}:$TAG
95
+ docker push ${QUAY_PATH}:$TAG
0 commit comments