This repository has been archived by the owner on Nov 20, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
129 lines (113 loc) · 3.87 KB
/
main.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: pr-main
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
e2e:
runs-on: ubuntu-latest
steps:
- name: Clean up
run: |
df -h
rm -rf /usr/share/dotnet/
df -h
- name: Checkout
uses: actions/checkout@v2
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: '^1.14.9'
- name: Install helm
run: curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
- name: Go cache
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Install cinder
run: curl -sSfL https://get.crit.sh | sh
- name: Create cinder cluster
run: |
cinder version
cinder create cluster -v -c hack/cinder-e2e.yaml --name ui-dev
- name: Failure logs
if: ${{ failure() }}
run: docker exec ui-dev journalctl -xu kubelet
- name: Version
run: echo "::set-output name=VERSION::$(make version)"
id: get-version
- name: Docker Build
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
platforms: linux/amd64
load: true
build-args: VERSION=${{ steps.get-version.outputs.VERSION }}
tags: criticalstack/ui:${{ steps.get-version.outputs.VERSION }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Test e2e
run: |
cinder load --name ui-dev criticalstack/ui:${{ steps.get-version.outputs.VERSION }}
kubectl apply -f chart/crds/
helm template chart --namespace critical-stack --name-template cs-ui \
--set identity.issuerOverride="http://$(cinder get ip --name ui-dev):30000" \
--set identity.issuerCAFile="" \
--set tls.enabled=false \
--set healthcheck.enabled=false \
--set users.admin.initialPassword.value=admin \
--set users.admin.template.type=local \
--set users.admin.template.active=true \
--set users.admin.template.username=admin \
--set [email protected] \
--set image.tag=${{ steps.get-version.outputs.VERSION }} | kubectl apply -f -
kubectl rollout -n critical-stack status deployment/cs-ui -w
kubectl wait userrequests admin --for condition=Ready
make test-e2e
- name: e2e failure logs
if: ${{ failure() }}
run: |
docker exec ui-dev kubectl --kubeconfig /etc/kubernetes/admin.conf -n critical-stack get pods -o yaml -l app.kubernetes.io/name=ui
docker exec ui-dev kubectl --kubeconfig /etc/kubernetes/admin.conf -n critical-stack get all
- name: Cypress Tests
id: cypress
run: |
cd client
npm install
npx cypress verify
npx cypress run --config baseUrl=http://$(cinder get ip --name ui-dev):30000
- uses: actions/upload-artifact@v2
if: ${{ steps.cypress.outcome == 'failure' }}
with:
name: cypress-results
path: client/cypress/results/**/*
chart:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install helm
run: curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
- name: Package chart
run: helm package --app-version $(make version) ./chart
- uses: actions/upload-artifact@v2
with:
name: chart
path: ui-*.tgz