This repository has been archived by the owner on Jul 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
226 lines (190 loc) · 6.59 KB
/
test.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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
---
name: Build
on:
push:
branches:
- main
- ActionsTest
- 'releases/**'
pull_request:
branches:
- '**'
permissions: read-all
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Restore Maven cache
uses: skjolber/maven-cache-github-action@v1
with:
step: restore
- name: Maven Build
run: mvn -Dmaven.test.skip=true clean package
- name: Maven Validate
run: mvn validate
- name: Maven Test
id: test
run: |
mvn test --file ./pom.xml
mvn jacoco:report-aggregate
- name: Check generated files are up to date
run: |
status="$(git status --porcelain)"
if [ -n "${status}" ]; then echo "There are uncommitted changes:"; echo "${status}"; exit 1; fi
- name: Upload current-info
uses: actions/upload-artifact@v3
with:
name: artifacts
path: |
${{ github.workspace }}/coverage/target/site/jacoco-aggregate/
${{ github.workspace }}/notification-service/target/*.jar
${{ github.workspace }}/workflow-service/target/*.jar
${{ github.workspace }}/workflow-examples/target/*.jar
- name: Save Maven cache
uses: skjolber/maven-cache-github-action@v1
with:
step: save
coverage:
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: artifacts
- name: JaCoCo Code Coverage Report
id: jacoco_reporter
uses: PavanMudigonda/[email protected]
with:
coverage_results_path: ${{ github.workspace }}/coverage/target/site/jacoco-aggregate/jacoco.xml
coverage_report_name: Coverage
coverage_report_title: JaCoCo
skip_check_run: true
minimum_coverage: 70
fail_below_threshold: true
publish_only_summary: true
- name: Add Coverage Job Summary
run: |
cat ${{ github.workspace }}/_TMP/coverage-summary.md >> $GITHUB_STEP_SUMMARY
- name: Upload Code Coverage Artifacts
uses: actions/upload-artifact@v3
with:
name: code-coverage-report-markdown
path: "${{ github.workspace }}/_TMP/coverage-results.md"
retention-days: 1
containers:
runs-on: ubuntu-latest
needs:
- build
steps:
- uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: artifacts
- name: "Build container images to quay ${{ needs.build.outputs.test }}"
run: |
make build-images
- name: Upload image
uses: ishworkh/docker-image-artifact-upload@v1
with:
image: "docker-compose_workflow-service:latest"
- name: Upload image
uses: ishworkh/docker-image-artifact-upload@v1
with:
image: "docker-compose_notification-service:latest"
- name: "finished"
id: container-finished
run: echo 1
integration:
runs-on: ubuntu-latest
needs:
- build
steps:
- uses: actions/checkout@v3
- uses: engineerd/[email protected]
with:
version: "v0.16.0"
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Restore Maven cache
uses: skjolber/maven-cache-github-action@v1
with:
step: restore
- name: Waiting for kind to be ready
run: |
kubectl cluster-info
kubectl get pods -n kube-system
echo "current-context:" $(kubectl config current-context)
echo "environment-kubeconfig:" ${KUBECONFIG}
- name: Install kubernetes dependencies
run: |
make install-kubernetes-dependencies
make wait-kubernetes-dependencies
- name: Maven Build
run: mvn -Dmaven.test.skip=true install
- id: wait-for-jobs
uses: yogeshlonkar/wait-for-jobs@v0
with:
gh-token: ${{ secrets.GITHUB_TOKEN }}
jobs: |
containers
- name: Download images
uses: ishworkh/docker-image-artifact-download@v1
with:
image: "docker-compose_notification-service:latest"
- name: Download images
uses: ishworkh/docker-image-artifact-download@v1
with:
image: "docker-compose_workflow-service:latest"
- name: Load images inside kind
run: |
make push-images-to-kind
- name: Deploy
run: |
kubectl kustomize hack/manifests/testing| kubectl apply -f -
kubectl wait --timeout=600s --for=condition=Ready pods --all -n default || {
echo "Timeout waiting for Parodos services to be ready";
kubectl get pods --all-namespaces;
echo "************ workflow-service logs ***************";
kubectl logs -l app=workflow-service --tail=40;
echo "************ notification-service logs ***************";
kubectl logs -l app=notification-service --tail=40;
exit 1;
}
kubectl get pods --all-namespaces
- name: Add hosts
run: |
export SERVER_IP=$(kubectl get nodes kind-control-plane -o json | jq -r '[.status.addresses[] | select(.type=="InternalIP")] | .[0].address')
echo "$SERVER_IP workflow-service.parodos-dev" | sudo tee -a /etc/hosts
echo "$SERVER_IP notification-service.parodos-dev" | sudo tee -a /etc/hosts
- name: Run integration tests
run: |
kubectl create ns test
kubectl config view --flatten --minify -o json > /tmp/kubeconfig.json
sed -i 's/https:\/\/127.0.0.1:[0-9]*/https:\/\/kubernetes.default.svc:443/g' /tmp/kubeconfig.json
KUBECONFIG_JSON=/tmp/kubeconfig.json WORKFLOW_SERVICE_HOST=workflow-service.parodos-dev NOTIFICATION_SERVICE_HOST=notification-service.parodos-dev SERVER_PORT=80 mvn verify -pl integration-tests -P integration-test
- name: Collect logs
if: ${{ failure() }}
run: |
kubectl get pods --all-namespaces
kind export logs dist
- name: Archive logs
uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: logs
path: |
dist
- name: Save Maven cache
uses: skjolber/maven-cache-github-action@v1
with:
step: save