-
Notifications
You must be signed in to change notification settings - Fork 31
177 lines (167 loc) · 6.06 KB
/
ci.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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
name: "sandbox ci"
env:
GO_VERSION: 1.19
MINIKUBE_VERSION: v1.28.0
KUBERNETES_VERSION: v1.25.8
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
SemanticPullRequest:
name: Semantic Pull Request Check
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5.1.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Checks:
runs-on: ubuntu-20.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v3.3.0
- name: Set up Go
uses: actions/setup-go@v3.5.0
with:
go-version: ${{ env.GO_VERSION }}
- name: Run checks
run: |
echo $PATH
go env
echo ${{ github.workspace }}
make checks
UnitTest:
runs-on: ubuntu-20.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v3.3.0
- name: Set up Go
uses: actions/setup-go@v3.5.0
with:
go-version: ${{ env.GO_VERSION }}
- name: Run unit test
run: make unit-test
- name: Upload coverage to Codecov
run: |
bash <(curl https://codecov.io/bash)
env:
CODECOV_UPLOAD_TOKEN: ${{ secrets.CODECOV_UPLOAD_TOKEN }}
Publish:
needs: [ Checks, UnitTest ]
if: github.event_name == 'push' && (github.repository == 'trustbloc/sandbox' && github.ref == 'refs/heads/main')
runs-on: ubuntu-20.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v3.3.0
- name: Set up Go
uses: actions/setup-go@v3.5.0
with:
go-version: ${{ env.GO_VERSION }}
- run: |
function logout {
docker logout
}
trap logout EXIT
git lfs install
git lfs pull
source ci/version_var.sh
echo $DOCKER_PASSWORD | docker login ghcr.io --username $DOCKER_USER --password-stdin
make sandbox-issuer-docker sandbox-rp-docker sandbox-ace-rp-docker login-consent-server-docker sandbox-cms-docker sandbox-cli-docker
docker tag ghcr.io/trustbloc/sandbox-issuer:latest ${ISSUER_REST_PKG}:${EDGE_SANDBOX_TAG}
docker push ${ISSUER_REST_PKG}:${EDGE_SANDBOX_TAG}
docker tag ghcr.io/trustbloc/sandbox-rp:latest ${RP_REST_PKG}:${EDGE_SANDBOX_TAG}
docker push ${RP_REST_PKG}:${EDGE_SANDBOX_TAG}
docker tag ghcr.io/trustbloc/sandbox-ace-rp:latest ${ACE_RP_REST_PKG}:${EDGE_SANDBOX_TAG}
docker push ${ACE_RP_REST_PKG}:${EDGE_SANDBOX_TAG}
docker tag ghcr.io/trustbloc/sandbox-login-consent-server:latest ${LOGIN_PKG}:${EDGE_SANDBOX_TAG}
docker push ${LOGIN_PKG}:${EDGE_SANDBOX_TAG}
docker tag ghcr.io/trustbloc/sandbox-cms:latest ${CMS_PKG}:${EDGE_SANDBOX_TAG}
docker push ${CMS_PKG}:${EDGE_SANDBOX_TAG}
docker tag ghcr.io/trustbloc/sandbox-cli:latest ${CLI_PKG}:${EDGE_SANDBOX_TAG}
docker push ${CLI_PKG}:${EDGE_SANDBOX_TAG}
env:
DOCKER_USER: ${{ secrets.CR_USER }}
DOCKER_PASSWORD: ${{ secrets.CR_PAT }}
DeployTest:
name: Deploy-Test
needs: [ Publish ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3.3.0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
- name: Setup Minikube
uses: manusa/actions-setup-minikube@v2.7.2
with:
minikube version: '${{ env.MINIKUBE_VERSION }}'
kubernetes version: '${{ env.KUBERNETES_VERSION }}'
start args: '--addons=ingress'
- name: Deploy Trustbloc
run: |
minikube ip
kubectl get nodes
source ci/version_var.sh
export ISSUER_IMG=${ISSUER_REST_PKG}:${EDGE_SANDBOX_TAG}
export RP_IMG=${RP_REST_PKG}:${EDGE_SANDBOX_TAG}
export ACE_RP_IMG=${ACE_RP_REST_PKG}:${EDGE_SANDBOX_TAG}
export LOGIN_CONSENT_IMG=${LOGIN_PKG}:${EDGE_SANDBOX_TAG}
export CMS_IMG=${CMS_PKG}:${EDGE_SANDBOX_TAG}
export CLI_IMG=${CLI_PKG}:${EDGE_SANDBOX_TAG}
echo $ISSUER_IMG $RP_IMG $ACE_RP_IMG $LOGIN_CONSENT_IMG $CMS_IMG $CLI_IMG
make ci-setup-deploy
- name: Run BDD test
run: |
make bdd-test
- name: Run UI-test
run: |
make automation-test-local
- name: Run VC Wallet Test
run: |
make automation-test-vcwallet
BuildDeployTest-PR:
name: Build-Deploy-Test-PR
needs: [ UnitTest ]
if: github.event_name == 'pull_request' && github.repository == 'trustbloc/sandbox'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3.3.0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
- name: Build Sandbox components
run: |
make sandbox-issuer-docker sandbox-rp-docker sandbox-ace-rp-docker login-consent-server-docker sandbox-cms-docker sandbox-cli-docker
- name: Setup Minikube
uses: manusa/actions-setup-minikube@v2.7.2
with:
minikube version: '${{ env.MINIKUBE_VERSION }}'
kubernetes version: '${{ env.KUBERNETES_VERSION }}'
start args: '--addons=ingress --memory=5g'
- name: Deploy Trustbloc
run: |
minikube ip
kubectl get nodes
export ISSUER_IMG=ghcr.io/trustbloc/sandbox-issuer:latest
export RP_IMG=ghcr.io/trustbloc/sandbox-rp:latest
export ACE_RP_IMG=ghcr.io/trustbloc/sandbox-ace-rp:latest
export LOGIN_CONSENT_IMG=ghcr.io/trustbloc/sandbox-login-consent-server:latest
export CMS_IMG=ghcr.io/trustbloc/sandbox-cms:latest
export CLI_IMG=ghcr.io/trustbloc/sandbox-cli:latest
echo $ISSUER_IMG $RP_IMG $ACE_RP_IMG $LOGIN_CONSENT_IMG $CMS_IMG $CLI_IMG
make ci-setup-deploy
- name: Run BDD test
run: |
make bdd-test
- name: Run VC Wallet Test
run: |
make automation-test-vcwallet
- name: Run UI-test
run: |
make automation-test-local