ci: Pinning the server build runs to Ubuntu 22.04 because of Flapdoodle errors (#38723)
## Description
Flapdoodle, our Mongo embedded testing library throws errors when
running Junit tests on Ubuntu 24.04. This is because of a mismatch of
openssl version from Ubuntu 22.04 to Ubuntu 24.04. Hence pinning our CI
for server builds to Ubuntu 22.04 for now. Will issue a holistic fix
with Flapdoodle upgrade later.
## Automation
/ok-to-test tags=""
### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results -->
> [!CAUTION]
> If you modify the content in this section, you are likely to disrupt
the CI result for your PR.
<!-- end of auto-generated comment: Cypress test results -->
## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **Chores**
- Updated GitHub Actions workflow configurations for server build and
integration tests
- Migrated workflow environments from `ubuntu-latest-8-cores` to
`ubuntu-22.04-8core`
- Refined workflow logic for test execution and artifact management
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
parent
1963a9a27d
commit
42b8a564fe
171
.github/workflows/server-build.yml
vendored
171
.github/workflows/server-build.yml
vendored
|
|
@ -51,7 +51,7 @@ defaults:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
server-unit-tests:
|
server-unit-tests:
|
||||||
runs-on: ubuntu-latest-8-cores
|
runs-on: ubuntu-22.04-8core
|
||||||
|
|
||||||
# Service containers to run with this job. Required for running tests
|
# Service containers to run with this job. Required for running tests
|
||||||
services:
|
services:
|
||||||
|
|
@ -93,7 +93,7 @@ jobs:
|
||||||
|
|
||||||
- name: Figure out the PR number
|
- name: Figure out the PR number
|
||||||
run: echo ${{ inputs.pr }}
|
run: echo ${{ inputs.pr }}
|
||||||
|
|
||||||
- name: Default database URL
|
- name: Default database URL
|
||||||
run: echo "Is this a PG build? ${{ inputs.is-pg-build }}"
|
run: echo "Is this a PG build? ${{ inputs.is-pg-build }}"
|
||||||
|
|
||||||
|
|
@ -203,105 +203,104 @@ jobs:
|
||||||
APPSMITH_ENVFILE_PATH: /tmp/dummy.env
|
APPSMITH_ENVFILE_PATH: /tmp/dummy.env
|
||||||
APPSMITH_VERBOSE_LOGGING_ENABLED: false
|
APPSMITH_VERBOSE_LOGGING_ENABLED: false
|
||||||
run: |
|
run: |
|
||||||
if [[ "${{ inputs.is-pg-build }}" == "true" ]]; then
|
if [[ "${{ inputs.is-pg-build }}" == "true" ]]; then
|
||||||
export APPSMITH_DB_URL="postgresql://postgres:password@localhost:5432/postgres"
|
export APPSMITH_DB_URL="postgresql://postgres:password@localhost:5432/postgres"
|
||||||
else
|
else
|
||||||
export APPSMITH_DB_URL="mongodb://localhost:27017/mobtools"
|
export APPSMITH_DB_URL="mongodb://localhost:27017/mobtools"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
args=()
|
args=()
|
||||||
|
|
||||||
if [[ "${{ steps.run_result.outputs.run_result }}" == "failedtest" ]]; then
|
if [[ "${{ steps.run_result.outputs.run_result }}" == "failedtest" ]]; then
|
||||||
failed_tests="${{ steps.failed_tests.outputs.tests }}"
|
failed_tests="${{ steps.failed_tests.outputs.tests }}"
|
||||||
args+=("-DfailIfNoTests=false" "-Dsurefire.failIfNoSpecifiedTests=false" "-Dtest=${failed_tests}")
|
args+=("-DfailIfNoTests=false" "-Dsurefire.failIfNoSpecifiedTests=false" "-Dtest=${failed_tests}")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run tests and capture logs
|
# Run tests and capture logs
|
||||||
mvn test "${args[@]}" | tee mvn_test.log
|
mvn test "${args[@]}" | tee mvn_test.log
|
||||||
|
|
||||||
# Check for "BUILD FAILURE" in the mvn_test.log
|
|
||||||
if grep -q "BUILD FAILURE" mvn_test.log; then
|
|
||||||
test_result="failed"
|
|
||||||
else
|
|
||||||
test_result="passed"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "test_result variable value: ${test_result}"
|
# Check for "BUILD FAILURE" in the mvn_test.log
|
||||||
|
if grep -q "BUILD FAILURE" mvn_test.log; then
|
||||||
|
test_result="failed"
|
||||||
|
else
|
||||||
|
test_result="passed"
|
||||||
|
fi
|
||||||
|
|
||||||
# Prepare output file for failed tests and ensure a fresh file is created
|
echo "test_result variable value: ${test_result}"
|
||||||
OUTPUT_FILE="failed-server-tests.txt"
|
|
||||||
rm -f "$OUTPUT_FILE"
|
|
||||||
touch "$OUTPUT_FILE"
|
|
||||||
|
|
||||||
failed_modules=()
|
# Prepare output file for failed tests and ensure a fresh file is created
|
||||||
skipped_modules=()
|
OUTPUT_FILE="failed-server-tests.txt"
|
||||||
|
rm -f "$OUTPUT_FILE"
|
||||||
|
touch "$OUTPUT_FILE"
|
||||||
|
|
||||||
# Process mvn_test.log for FAILURE and SKIPPED statuses
|
failed_modules=()
|
||||||
while IFS= read -r line; do
|
skipped_modules=()
|
||||||
if [[ $line == *"FAILURE"* ]]; then
|
|
||||||
module_name=$(echo "$line" | awk '{print $2}')
|
|
||||||
failed_modules+=("$module_name")
|
|
||||||
elif [[ $line == *"SKIPPED"* ]]; then
|
|
||||||
module_name=$(echo "$line" | awk '{print $2}')
|
|
||||||
skipped_modules+=("$module_name")
|
|
||||||
fi
|
|
||||||
done < mvn_test.log
|
|
||||||
|
|
||||||
echo "Failed Modules: ${failed_modules[*]}"
|
# Process mvn_test.log for FAILURE and SKIPPED statuses
|
||||||
echo "Skipped Modules: ${skipped_modules[*]}"
|
while IFS= read -r line; do
|
||||||
|
if [[ $line == *"FAILURE"* ]]; then
|
||||||
|
module_name=$(echo "$line" | awk '{print $2}')
|
||||||
|
failed_modules+=("$module_name")
|
||||||
|
elif [[ $line == *"SKIPPED"* ]]; then
|
||||||
|
module_name=$(echo "$line" | awk '{print $2}')
|
||||||
|
skipped_modules+=("$module_name")
|
||||||
|
fi
|
||||||
|
done < mvn_test.log
|
||||||
|
|
||||||
# Handle older approach for reading failed tests from XML files
|
echo "Failed Modules: ${failed_modules[*]}"
|
||||||
failed_tests_from_xml="$PWD/failed-tests-from-xml.txt"
|
echo "Skipped Modules: ${skipped_modules[*]}"
|
||||||
gawk -F\" '/<testcase / {cur_test = $4 "#" $2} /<(failure|error) / {print cur_test}' $(find . -type f -name 'TEST-*.xml') \
|
|
||||||
| sort -u \
|
|
||||||
| tee "$failed_tests_from_xml"
|
|
||||||
|
|
||||||
# Filter out failed modules and add only relevant tests to the final failed list
|
# Handle older approach for reading failed tests from XML files
|
||||||
for module in "${failed_modules[@]}"; do
|
failed_tests_from_xml="$PWD/failed-tests-from-xml.txt"
|
||||||
grep -v "$module" "$failed_tests_from_xml" > temp_file && mv temp_file "$failed_tests_from_xml"
|
gawk -F\" '/<testcase / {cur_test = $4 "#" $2} /<(failure|error) / {print cur_test}' $(find . -type f -name 'TEST-*.xml') \
|
||||||
done
|
| sort -u \
|
||||||
|
| tee "$failed_tests_from_xml"
|
||||||
|
|
||||||
# Include all skipped module test files in the final list
|
# Filter out failed modules and add only relevant tests to the final failed list
|
||||||
for module in "${skipped_modules[@]}"; do
|
for module in "${failed_modules[@]}"; do
|
||||||
module_directories=$(find . -path "*/${module}*/src/test/java/*" -type f -name "*Test.java" -exec dirname {} \; | sort -u)
|
grep -v "$module" "$failed_tests_from_xml" > temp_file && mv temp_file "$failed_tests_from_xml"
|
||||||
for module_directory in $module_directories; do
|
done
|
||||||
test_classes=$(find "$module_directory" -type f -name "*Test.java" | sed 's|.*/src/test/java/||; s|\.java$||; s|/|.|g')
|
|
||||||
for class_name in $test_classes; do
|
|
||||||
if [[ ${#class_name} -le 240 ]] && ! grep -Fxq "$class_name#" "$OUTPUT_FILE"; then
|
|
||||||
echo "${class_name}#" >> "$OUTPUT_FILE"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
done
|
|
||||||
done
|
|
||||||
|
|
||||||
# Combine the XML file test cases and skipped module test files into the final output file
|
# Include all skipped module test files in the final list
|
||||||
cat "$failed_tests_from_xml" >> "$OUTPUT_FILE"
|
for module in "${skipped_modules[@]}"; do
|
||||||
|
module_directories=$(find . -path "*/${module}*/src/test/java/*" -type f -name "*Test.java" -exec dirname {} \; | sort -u)
|
||||||
# Print the final output
|
for module_directory in $module_directories; do
|
||||||
cat "$OUTPUT_FILE"
|
test_classes=$(find "$module_directory" -type f -name "*Test.java" | sed 's|.*/src/test/java/||; s|\.java$||; s|/|.|g')
|
||||||
|
for class_name in $test_classes; do
|
||||||
|
if [[ ${#class_name} -le 240 ]] && ! grep -Fxq "$class_name#" "$OUTPUT_FILE"; then
|
||||||
|
echo "${class_name}#" >> "$OUTPUT_FILE"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
if [[ -s $OUTPUT_FILE ]]; then
|
# Combine the XML file test cases and skipped module test files into the final output file
|
||||||
content="$(
|
cat "$failed_tests_from_xml" >> "$OUTPUT_FILE"
|
||||||
echo "## Failed server tests"
|
|
||||||
echo
|
|
||||||
sed 's/^/- /' "$OUTPUT_FILE"
|
|
||||||
)"
|
|
||||||
echo "$content" >> "$GITHUB_STEP_SUMMARY"
|
|
||||||
|
|
||||||
# Post a comment to the PR
|
|
||||||
curl --silent --show-error \
|
|
||||||
--header "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
|
|
||||||
--data "$(jq -n --arg body "$content" '$ARGS.named')" \
|
|
||||||
"https://api.github.com/repos/$GITHUB_REPOSITORY/issues/${{ inputs.pr }}/comments" \
|
|
||||||
> /dev/null
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Fail the script if tests did not pass
|
# Print the final output
|
||||||
if [[ "$test_result" == "failed" ]]; then
|
cat "$OUTPUT_FILE"
|
||||||
echo "Tests failed, exiting with status 1."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
if [[ -s $OUTPUT_FILE ]]; then
|
||||||
|
content="$(
|
||||||
|
echo "## Failed server tests"
|
||||||
|
echo
|
||||||
|
sed 's/^/- /' "$OUTPUT_FILE"
|
||||||
|
)"
|
||||||
|
echo "$content" >> "$GITHUB_STEP_SUMMARY"
|
||||||
|
|
||||||
|
# Post a comment to the PR
|
||||||
|
curl --silent --show-error \
|
||||||
|
--header "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
|
||||||
|
--data "$(jq -n --arg body "$content" '$ARGS.named')" \
|
||||||
|
"https://api.github.com/repos/$GITHUB_REPOSITORY/issues/${{ inputs.pr }}/comments" \
|
||||||
|
> /dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Fail the script if tests did not pass
|
||||||
|
if [[ "$test_result" == "failed" ]]; then
|
||||||
|
echo "Tests failed, exiting with status 1."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Set status = failedtest
|
# Set status = failedtest
|
||||||
- name: Set fail if there are test failures
|
- name: Set fail if there are test failures
|
||||||
|
|
|
||||||
24
.github/workflows/server-integration-tests.yml
vendored
24
.github/workflows/server-integration-tests.yml
vendored
|
|
@ -17,7 +17,7 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
run-tests:
|
run-tests:
|
||||||
runs-on: ubuntu-latest-8-cores
|
runs-on: ubuntu-22.04-8core
|
||||||
if: |
|
if: |
|
||||||
github.event.pull_request.head.repo.full_name == github.repository ||
|
github.event.pull_request.head.repo.full_name == github.repository ||
|
||||||
github.event_name == 'workflow_dispatch'
|
github.event_name == 'workflow_dispatch'
|
||||||
|
|
@ -65,7 +65,7 @@ jobs:
|
||||||
with:
|
with:
|
||||||
name: server-build
|
name: server-build
|
||||||
path: app/server/dist/
|
path: app/server/dist/
|
||||||
|
|
||||||
- name: Download the rts build artifact
|
- name: Download the rts build artifact
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
|
|
@ -93,16 +93,14 @@ jobs:
|
||||||
APPSMITH_ENVFILE_PATH: /tmp/dummy.env
|
APPSMITH_ENVFILE_PATH: /tmp/dummy.env
|
||||||
APPSMITH_VERBOSE_LOGGING_ENABLED: false
|
APPSMITH_VERBOSE_LOGGING_ENABLED: false
|
||||||
run: |
|
run: |
|
||||||
if [[ "${{ inputs.is-pg-build }}" == "true" ]]; then
|
if [[ "${{ inputs.is-pg-build }}" == "true" ]]; then
|
||||||
export APPSMITH_DB_URL="postgresql://postgres:password@localhost:5432/postgres"
|
export APPSMITH_DB_URL="postgresql://postgres:password@localhost:5432/postgres"
|
||||||
else
|
else
|
||||||
export APPSMITH_DB_URL="mongodb://localhost:27017/mobtools"
|
export APPSMITH_DB_URL="mongodb://localhost:27017/mobtools"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
args=()
|
|
||||||
|
|
||||||
# Run tests and capture logs
|
|
||||||
cd app/server
|
|
||||||
mvn verify -DskipUTs=true "${args[@]}" | tee mvn_integration_test.log
|
|
||||||
|
|
||||||
|
args=()
|
||||||
|
|
||||||
|
# Run tests and capture logs
|
||||||
|
cd app/server
|
||||||
|
mvn verify -DskipUTs=true "${args[@]}" | tee mvn_integration_test.log
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user