-
Notifications
You must be signed in to change notification settings - Fork 2.5k
183 lines (152 loc) · 6.64 KB
/
build-e2e-tests.yml
File metadata and controls
183 lines (152 loc) · 6.64 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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
name: Fineract E2E Tests
on: [ push, pull_request ]
permissions:
contents: read
jobs:
test:
name: E2E Tests (Shard ${{ matrix.shard_index }} of ${{ matrix.total_shards }})
runs-on: ubuntu-24.04
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
# Define the number of shards (1-based indexing)
shard_index: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 ]
total_shards: [ 15 ]
env:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
IMAGE_NAME: fineract
BASE_URL: https://localhost:8443
TEST_USERNAME: mifos
TEST_PASSWORD: password
TEST_STRONG_PASSWORD: A1b2c3d4e5f$
TEST_TENANT_ID: default
INITIALIZATION_ENABLED: true
EVENT_VERIFICATION_ENABLED: true
ACTIVEMQ_BROKER_URL: tcp://localhost:61616
ACTIVEMQ_TOPIC_NAME: events
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Set up JDK 21
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
with:
java-version: '21'
distribution: 'zulu'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5.0.2
- name: Make scripts executable
run: chmod +x scripts/split-features.sh
- name: Split feature files into shards
id: split-features
run: |
./scripts/split-features.sh ${{ matrix.total_shards }} ${{ matrix.shard_index }}
echo "Shard ${{ matrix.shard_index }} feature files:"
cat feature_shard_${{ matrix.shard_index }}.txt
- name: Build the image
run: ./gradlew --no-daemon --console=plain :fineract-provider:jibDockerBuild -Djib.to.image=$IMAGE_NAME -x test -x cucumber
- name: Start the Fineract stack
run: docker compose -f docker-compose-postgresql-test-activemq.yml up -d
- name: Check the stack
run: docker ps
- name: Wait for Manager to be ready
run: |
# Wait for the container to be running
echo "Waiting for Manager container to be ready..."
timeout 300 bash -c 'until docker ps --filter "health=healthy" --filter "name=fineract" --format "{{.Status}}" | grep -q "healthy"; do
if docker ps --filter "name=fineract" --format "{{.Status}}" | grep -q "unhealthy"; then
echo "Container is unhealthy. Stopping..."
docker ps -a
docker logs $(docker ps -q --filter name=fineract) || true
exit 1
fi
echo "Waiting for Manager to be ready..."
sleep 5
done'
# Check the health endpoint
echo "Checking Manager health endpoint..."
curl -f -k --retry 30 --retry-all-errors --connect-timeout 10 --retry-delay 10 \
https://localhost:8443/fineract-provider/actuator/health
- name: Execute tests for shard ${{ matrix.shard_index }}
id: tests
run: |
# Initialize failure flag
FAILED=0
# Create necessary directories
mkdir -p "allure-results-shard-${{ matrix.shard_index }}"
mkdir -p "allure-results-merged"
# Read feature files from the shard file
if [ ! -s "feature_shard_${{ matrix.shard_index }}.txt" ]; then
echo "No features to test in this shard. Skipping..."
exit 0
fi
# Read each feature file path and run tests one by one
while IFS= read -r feature_file || [ -n "$feature_file" ]; do
# Skip empty lines
[ -z "$feature_file" ] && continue
# Create a safe filename for the results
safe_name=$(echo "$feature_file" | tr '/' '-' | tr ' ' '_')
echo "::group::Testing feature: $feature_file"
# Run tests with individual allure results directory
if ! ./gradlew --no-daemon --console=plain \
:fineract-e2e-tests-runner:cucumber \
-Pcucumber.features="$feature_file" \
-Dallure.results.directory="allure-results-shard-${{ matrix.shard_index }}/$safe_name" \
allureReport; then
echo "::error::Test failed for $feature_file"
FAILED=1
fi
echo "::endgroup::"
# Copy the results to a merged directory
if [ -d "allure-results-shard-${{ matrix.shard_index }}/$safe_name" ]; then
cp -r "allure-results-shard-${{ matrix.shard_index }}/$safe_name/." "allure-results-merged/" || true
fi
done < "feature_shard_${{ matrix.shard_index }}.txt"
# Generate individual report for this shard
if [ -d "allure-results-merged" ] && [ "$(ls -A allure-results-merged)" ]; then
echo "Generating Allure report..."
mkdir -p "allure-report-shard-${{ matrix.shard_index }}"
./fineract-e2e-tests-runner/build/allure/commandline/bin/allure generate "allure-results-merged" --clean -o "allure-report-shard-${{ matrix.shard_index }}" || \
echo "::warning::Failed to generate Allure report for shard ${{ matrix.shard_index }}"
fi
# Exit with failure status if any test failed
if [ "$FAILED" -eq 1 ]; then
echo "::error::Some tests failed in this shard"
exit 1
fi
- name: Upload test results
if: always()
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: allure-results-shard-${{ matrix.shard_index }}
path: |
allure-results-shard-${{ matrix.shard_index }}
allure-results-merged
**/build/allure-results
**/build/reports/tests/test
**/build/test-results/test
retention-days: 5
- name: Upload Allure Report
if: always()
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: allure-report-shard-${{ matrix.shard_index }}
path: allure-report-shard-${{ matrix.shard_index }}
retention-days: 5
- name: Upload logs
if: always()
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: logs-shard-${{ matrix.shard_index }}
path: |
**/build/reports/tests/
**/logs/
**/out/
retention-days: 5
- name: Clean up
if: always()
run: |
docker compose -f docker-compose-postgresql-test-activemq.yml down -v
docker system prune -f