FINERACT-2181: Fix github actions not failing test runs on failed tests
- added validation for cumulative multidisburse loan applications for interest method - test fixes
This commit is contained in:
@@ -53,6 +53,8 @@ jobs:
|
||||
- name: Run Gradle Task
|
||||
if: matrix.job_type == 'main'
|
||||
run: |
|
||||
set -e # Fail the script if any command fails
|
||||
|
||||
case "${{ matrix.task }}" in
|
||||
build-core)
|
||||
./gradlew --no-daemon build -x test -x cucumber -x doc
|
||||
|
||||
@@ -9,6 +9,7 @@ jobs:
|
||||
build:
|
||||
runs-on: ubuntu-24.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
db_type: [mariadb, postgresql]
|
||||
include:
|
||||
|
||||
@@ -85,18 +85,21 @@ jobs:
|
||||
https://localhost:8443/fineract-provider/actuator/health
|
||||
|
||||
- name: Execute tests for shard ${{ matrix.shard_index }}
|
||||
id: tests
|
||||
run: |
|
||||
# Read feature files from the shard file
|
||||
FEATURES=$(tr '\n' ',' < "feature_shard_${{ matrix.shard_index }}.txt" | sed 's/,$//')
|
||||
# Initialize failure flag
|
||||
FAILED=0
|
||||
|
||||
if [ -z "$FEATURES" ]; then
|
||||
# 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
|
||||
|
||||
# Create a directory for individual allure results
|
||||
mkdir -p "allure-results-shard-${{ matrix.shard_index }}"
|
||||
|
||||
# Read each feature file path and run tests one by one
|
||||
while IFS= read -r feature_file || [ -n "$feature_file" ]; do
|
||||
# Skip empty lines
|
||||
@@ -105,14 +108,20 @@ jobs:
|
||||
# Create a safe filename for the results
|
||||
safe_name=$(echo "$feature_file" | tr '/' '-' | tr ' ' '_')
|
||||
|
||||
echo "Testing feature: $feature_file"
|
||||
echo "::group::Testing feature: $feature_file"
|
||||
|
||||
# Run tests with individual allure results directory
|
||||
./gradlew --no-daemon --console=plain \
|
||||
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 || echo "Test failed for $feature_file, continuing with next feature..."
|
||||
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
|
||||
@@ -121,9 +130,17 @@ jobs:
|
||||
done < "feature_shard_${{ matrix.shard_index }}.txt"
|
||||
|
||||
# Generate individual report for this shard
|
||||
if [ -d "allure-results-merged" ]; then
|
||||
if [ -d "allure-results-merged" ] && [ "$(ls -A allure-results-merged)" ]; then
|
||||
echo "Generating Allure report..."
|
||||
mkdir -p "allure-report-shard-${{ matrix.shard_index }}"
|
||||
allure generate "allure-results-merged" --clean -o "allure-report-shard-${{ matrix.shard_index }}" || echo "Failed to generate Allure report for 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
|
||||
|
||||
@@ -94,13 +94,22 @@ jobs:
|
||||
|
||||
- name: Run Gradle Task
|
||||
run: |
|
||||
set -e # Fail the script if any command fails
|
||||
SHARD_INDEX=$(echo "${{ matrix.task }}" | awk -F'-' '{print $3}')
|
||||
FAILED=0
|
||||
|
||||
case "${{ matrix.task }}" in
|
||||
test-twofactor)
|
||||
./gradlew --no-daemon :twofactor-tests:test -x checkstyleJmh -x checkstyleMain -x checkstyleTest -x spotlessCheck -x spotlessApply -x spotbugsMain -x spotbugsTest -x javadoc -x javadocJar -x modernizer
|
||||
if ! ./gradlew --no-daemon :twofactor-tests:test -x checkstyleJmh -x checkstyleMain -x checkstyleTest -x spotlessCheck -x spotlessApply -x spotbugsMain -x spotbugsTest -x javadoc -x javadocJar -x modernizer; then
|
||||
echo "::error::Two-factor tests failed"
|
||||
FAILED=1
|
||||
fi
|
||||
;;
|
||||
test-oauth2)
|
||||
./gradlew --no-daemon :oauth2-tests:test -x checkstyleJmh -x checkstyleMain -x checkstyleTest -x spotlessCheck -x spotlessApply -x spotbugsMain -x spotbugsTest -x javadoc -x javadocJar -x modernizer
|
||||
if ! ./gradlew --no-daemon :oauth2-tests:test -x checkstyleJmh -x checkstyleMain -x checkstyleTest -x spotlessCheck -x spotlessApply -x spotbugsMain -x spotbugsTest -x javadoc -x javadocJar -x modernizer; then
|
||||
echo "::error::OAuth2 tests failed"
|
||||
FAILED=1
|
||||
fi
|
||||
;;
|
||||
test-core-*)
|
||||
echo "Grouping test classes by module..."
|
||||
@@ -111,7 +120,7 @@ jobs:
|
||||
done < "shard-tests_${SHARD_INDEX}.txt"
|
||||
|
||||
for module in "${!module_tests[@]}"; do
|
||||
echo "Running tests in $module:"
|
||||
echo "::group::Running tests in $module"
|
||||
for class in ${module_tests[$module]}; do
|
||||
echo " - $class"
|
||||
done
|
||||
@@ -120,11 +129,21 @@ jobs:
|
||||
test_args=$(for class in ${module_tests[$module]}; do echo --tests "$class"; done | xargs)
|
||||
|
||||
# Run test task for this module
|
||||
./gradlew "$module:test" $test_args -x checkstyleJmh -x checkstyleMain -x checkstyleTest -x spotlessCheck -x spotlessApply -x spotbugsMain -x spotbugsTest -x javadoc -x javadocJar -x modernizer
|
||||
if ! ./gradlew "$module:test" $test_args -x checkstyleJmh -x checkstyleMain -x checkstyleTest -x spotlessCheck -x spotlessApply -x spotbugsMain -x spotbugsTest -x javadoc -x javadocJar -x modernizer; then
|
||||
echo "::error::Tests failed in module $module"
|
||||
FAILED=1
|
||||
fi
|
||||
echo "::endgroup::"
|
||||
done
|
||||
;;
|
||||
esac
|
||||
|
||||
# Exit with failure status if any test failed
|
||||
if [ "$FAILED" -eq 1 ]; then
|
||||
echo "::error::Some tests failed in this job"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Archive test results
|
||||
if: always()
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
||||
|
||||
@@ -94,13 +94,22 @@ jobs:
|
||||
|
||||
- name: Run Gradle Task
|
||||
run: |
|
||||
set -e # Fail the script if any command fails
|
||||
SHARD_INDEX=$(echo "${{ matrix.task }}" | awk -F'-' '{print $3}')
|
||||
FAILED=0
|
||||
|
||||
case "${{ matrix.task }}" in
|
||||
test-twofactor)
|
||||
./gradlew --no-daemon :twofactor-tests:test -PdbType=mysql -x checkstyleJmh -x checkstyleMain -x checkstyleTest -x spotlessCheck -x spotlessApply -x spotbugsMain -x spotbugsTest -x javadoc -x javadocJar -x modernizer
|
||||
if ! ./gradlew --no-daemon :twofactor-tests:test -PdbType=mysql -x checkstyleJmh -x checkstyleMain -x checkstyleTest -x spotlessCheck -x spotlessApply -x spotbugsMain -x spotbugsTest -x javadoc -x javadocJar -x modernizer; then
|
||||
echo "::error::Two-factor tests failed"
|
||||
FAILED=1
|
||||
fi
|
||||
;;
|
||||
test-oauth2)
|
||||
./gradlew --no-daemon :oauth2-tests:test -PdbType=mysql -x checkstyleJmh -x checkstyleMain -x checkstyleTest -x spotlessCheck -x spotlessApply -x spotbugsMain -x spotbugsTest -x javadoc -x javadocJar -x modernizer
|
||||
if ! ./gradlew --no-daemon :oauth2-tests:test -PdbType=mysql -x checkstyleJmh -x checkstyleMain -x checkstyleTest -x spotlessCheck -x spotlessApply -x spotbugsMain -x spotbugsTest -x javadoc -x javadocJar -x modernizer; then
|
||||
echo "::error::OAuth2 tests failed"
|
||||
FAILED=1
|
||||
fi
|
||||
;;
|
||||
test-core-*)
|
||||
echo "Grouping test classes by module..."
|
||||
@@ -111,7 +120,7 @@ jobs:
|
||||
done < "shard-tests_${SHARD_INDEX}.txt"
|
||||
|
||||
for module in "${!module_tests[@]}"; do
|
||||
echo "Running tests in $module:"
|
||||
echo "::group::Running tests in $module"
|
||||
for class in ${module_tests[$module]}; do
|
||||
echo " - $class"
|
||||
done
|
||||
@@ -120,11 +129,21 @@ jobs:
|
||||
test_args=$(for class in ${module_tests[$module]}; do echo --tests "$class"; done | xargs)
|
||||
|
||||
# Run test task for this module
|
||||
./gradlew "$module:test" $test_args -PdbType=mysql -x checkstyleJmh -x checkstyleMain -x checkstyleTest -x spotlessCheck -x spotlessApply -x spotbugsMain -x spotbugsTest -x javadoc -x javadocJar -x modernizer
|
||||
if ! ./gradlew "$module:test" $test_args -PdbType=mysql -x checkstyleJmh -x checkstyleMain -x checkstyleTest -x spotlessCheck -x spotlessApply -x spotbugsMain -x spotbugsTest -x javadoc -x javadocJar -x modernizer; then
|
||||
echo "::error::Tests failed in module $module"
|
||||
FAILED=1
|
||||
fi
|
||||
echo "::endgroup::"
|
||||
done
|
||||
;;
|
||||
esac
|
||||
|
||||
# Exit with failure status if any test failed
|
||||
if [ "$FAILED" -eq 1 ]; then
|
||||
echo "::error::Some tests failed in this job"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Archive test results
|
||||
if: always()
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
||||
|
||||
@@ -95,13 +95,22 @@ jobs:
|
||||
|
||||
- name: Run Gradle Task
|
||||
run: |
|
||||
set -e # Fail the script if any command fails
|
||||
SHARD_INDEX=$(echo "${{ matrix.task }}" | awk -F'-' '{print $3}')
|
||||
FAILED=0
|
||||
|
||||
case "${{ matrix.task }}" in
|
||||
test-twofactor)
|
||||
./gradlew --no-daemon :twofactor-tests:test -PdbType=postgresql -x checkstyleJmh -x checkstyleMain -x checkstyleTest -x spotlessCheck -x spotlessApply -x spotbugsMain -x spotbugsTest -x javadoc -x javadocJar -x modernizer
|
||||
if ! ./gradlew --no-daemon :twofactor-tests:test -PdbType=postgresql -x checkstyleJmh -x checkstyleMain -x checkstyleTest -x spotlessCheck -x spotlessApply -x spotbugsMain -x spotbugsTest -x javadoc -x javadocJar -x modernizer; then
|
||||
echo "::error::Two-factor tests failed"
|
||||
FAILED=1
|
||||
fi
|
||||
;;
|
||||
test-oauth2)
|
||||
./gradlew --no-daemon :oauth2-tests:test -PdbType=postgresql -x checkstyleJmh -x checkstyleMain -x checkstyleTest -x spotlessCheck -x spotlessApply -x spotbugsMain -x spotbugsTest -x javadoc -x javadocJar -x modernizer
|
||||
if ! ./gradlew --no-daemon :oauth2-tests:test -PdbType=postgresql -x checkstyleJmh -x checkstyleMain -x checkstyleTest -x spotlessCheck -x spotlessApply -x spotbugsMain -x spotbugsTest -x javadoc -x javadocJar -x modernizer; then
|
||||
echo "::error::OAuth2 tests failed"
|
||||
FAILED=1
|
||||
fi
|
||||
;;
|
||||
test-core-*)
|
||||
echo "Grouping test classes by module..."
|
||||
@@ -112,7 +121,7 @@ jobs:
|
||||
done < "shard-tests_${SHARD_INDEX}.txt"
|
||||
|
||||
for module in "${!module_tests[@]}"; do
|
||||
echo "Running tests in $module:"
|
||||
echo "::group::Running tests in $module"
|
||||
for class in ${module_tests[$module]}; do
|
||||
echo " - $class"
|
||||
done
|
||||
@@ -121,11 +130,21 @@ jobs:
|
||||
test_args=$(for class in ${module_tests[$module]}; do echo --tests "$class"; done | xargs)
|
||||
|
||||
# Run test task for this module
|
||||
./gradlew "$module:test" $test_args -PdbType=postgresql -x checkstyleJmh -x checkstyleMain -x checkstyleTest -x spotlessCheck -x spotlessApply -x spotbugsMain -x spotbugsTest -x javadoc -x javadocJar -x modernizer
|
||||
if ! ./gradlew "$module:test" $test_args -PdbType=postgresql -x checkstyleJmh -x checkstyleMain -x checkstyleTest -x spotlessCheck -x spotlessApply -x spotbugsMain -x spotbugsTest -x javadoc -x javadocJar -x modernizer; then
|
||||
echo "::error::Tests failed in module $module"
|
||||
FAILED=1
|
||||
fi
|
||||
echo "::endgroup::"
|
||||
done
|
||||
;;
|
||||
esac
|
||||
|
||||
# Exit with failure status if any test failed
|
||||
if [ "$FAILED" -eq 1 ]; then
|
||||
echo "::error::Some tests failed in this job"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Archive test results
|
||||
if: always()
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
||||
|
||||
Reference in New Issue
Block a user