-
Notifications
You must be signed in to change notification settings - Fork 0
169 lines (147 loc) · 5.87 KB
/
crossplane-dapr.yml
File metadata and controls
169 lines (147 loc) · 5.87 KB
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
name: crossplane-dapr-ci
on:
push:
paths:
- 'crossplane-dapr/**'
- '.github/workflows/crossplane-dapr.yml'
pull_request:
paths:
- 'crossplane-dapr/**'
- '.github/workflows/crossplane-dapr.yml'
workflow_dispatch:
jobs:
shift-left:
runs-on: ubuntu-latest
env:
PUSHGATEWAY_URL: ${{ secrets.PUSHGATEWAY_URL }}
defaults:
run:
working-directory: crossplane-dapr
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'
cache: gradle
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23.x'
cache-dependency-path: |
crossplane-dapr/producer-gin/go.sum
crossplane-dapr/consumer-gin/go.sum
- name: Make Gradle executable
run: chmod +x gradlew
- name: Unit tests (Ktor + Spring Boot + Gin)
run: make unit-test
- name: Static quality gates
run: ./gradlew ktlintCheck detekt
- name: Integration tests (Ktor + Spring Boot + Gin)
run: make integration-test
- name: Contract tests (Ktor + Spring Boot + Gin)
run: make contract-test
- name: Coverage gate
run: ./gradlew koverVerify
- name: Build stack/service-separated test pyramid metrics files
run: make test-pyramid-metrics
- name: Test pyramid summary (GitHub UI)
if: ${{ always() }}
run: |
{
echo "## Crossplane Dapr Test Pyramid"
echo ""
echo "### By Stack"
echo ""
stack_targets="$(./scripts/test-pyramid-targets.sh stacks)"
for target in ${stack_targets}; do
summary_file="build/reports/test-pyramid/${target}/summary.json"
echo "#### ${target}"
echo ""
if [[ -f "$summary_file" ]]; then
total_tests=$(jq -r '(.totals.tests // "N/A") | tostring' "$summary_file")
total_duration=$(jq -r '(.totals.durationSeconds // "N/A") | tostring' "$summary_file")
generated_at=$(jq -r '.generatedAt // "N/A"' "$summary_file")
echo "- Generated at: \`$generated_at\`"
echo "- Total tests: **$total_tests**"
echo "- Total duration: **${total_duration}s**"
echo ""
echo "| Suite | Tests | Failures | Skipped | Duration (s) | Tests % | Duration % |"
echo "|---|---:|---:|---:|---:|---:|---:|"
jq -r '(.suites // [])[] | "| \(.kind // "N/A") | \(.tests // "N/A") | \(.failures // "N/A") | \(.skipped // "N/A") | \(.durationSeconds // "N/A") | \(.testsPercentage // "N/A") | \(.durationPercentage // "N/A") |"' "$summary_file"
else
echo "No summary file found."
fi
echo ""
done
echo "### By Service"
echo ""
service_targets="$(./scripts/test-pyramid-targets.sh services)"
for target in ${service_targets}; do
summary_file="build/reports/test-pyramid/${target}/summary.json"
echo "#### ${target}"
echo ""
if [[ -f "$summary_file" ]]; then
total_tests=$(jq -r '(.totals.tests // "N/A") | tostring' "$summary_file")
total_duration=$(jq -r '(.totals.durationSeconds // "N/A") | tostring' "$summary_file")
generated_at=$(jq -r '.generatedAt // "N/A"' "$summary_file")
echo "- Generated at: \`$generated_at\`"
echo "- Total tests: **$total_tests**"
echo "- Total duration: **${total_duration}s**"
echo ""
echo "| Suite | Tests | Failures | Skipped | Duration (s) | Tests % | Duration % |"
echo "|---|---:|---:|---:|---:|---:|---:|"
jq -r '(.suites // [])[] | "| \(.kind // "N/A") | \(.tests // "N/A") | \(.failures // "N/A") | \(.skipped // "N/A") | \(.durationSeconds // "N/A") | \(.testsPercentage // "N/A") | \(.durationPercentage // "N/A") |"' "$summary_file"
else
echo "No summary file found."
fi
echo ""
done
} >> "$GITHUB_STEP_SUMMARY"
- name: Publish test pyramid metrics
if: ${{ env.PUSHGATEWAY_URL != '' }}
env:
PUSH_HISTORY: "false"
SKIP_TEST_EXECUTION: "true"
run: ./scripts/push-test-pyramid-metrics.sh "$PUSHGATEWAY_URL" "test-pyramid-latest" "latest"
- name: Upload pyramid reports
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: crossplane-dapr-test-pyramid-${{ github.run_id }}
path: |
crossplane-dapr/build/reports/test-pyramid/**/summary.json
crossplane-dapr/build/reports/test-pyramid/**/test-pyramid.prom
crossplane-dapr/build/reports/test-pyramid/gin/raw/*.json
crossplane-dapr/**/build/test-results/**/TEST-*.xml
if-no-files-found: warn
e2e-smoke:
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
defaults:
run:
working-directory: crossplane-dapr
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'
cache: gradle
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23.x'
cache-dependency-path: |
crossplane-dapr/producer-gin/go.sum
crossplane-dapr/consumer-gin/go.sum
- name: Make Gradle executable
run: chmod +x gradlew
- name: E2E smoke (opt-in)
env:
RUN_E2E: "true"
run: make e2e-test