Skip to content

Commit 0319ad3

Browse files
committed
.github/workflows: improve ci coverage
Split the create-cluster job into 2 seperate jobs: - e2e-tests - publish Add the following ci jobs from existing Makefile rules: - check-license - generate - build - unit-tests Signed-off-by: Damien Grisonnet <[email protected]>
1 parent 5c8e5c5 commit 0319ad3

File tree

1 file changed

+64
-10
lines changed

1 file changed

+64
-10
lines changed

.github/workflows/build.yml

+64-10
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,47 @@ name: Go
33
on: [push, pull_request]
44

55
env:
6-
VERSION: 1.15.x
76
QUAY_PATH: quay.io/brancz/kube-rbac-proxy
7+
go-version: '1.15'
88
kind-version: 'v0.9.0'
99

1010
jobs:
11-
create-cluster:
11+
check-license:
1212
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
1347
steps:
1448
- name: Checkout repository
1549
uses: actions/checkout@v2
@@ -31,11 +65,31 @@ jobs:
3165
VERSION=local make container
3266
kind load docker-image ${QUAY_PATH}:local
3367
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

Comments
 (0)