-
Notifications
You must be signed in to change notification settings - Fork 4.5k
ci: Pinning the server build runs to Ubuntu 22.04 because of Flapdoodle errors #38723
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,7 +51,7 @@ defaults: | |
|
|
||
| jobs: | ||
| 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 | ||
| services: | ||
|
|
@@ -93,7 +93,7 @@ jobs: | |
|
|
||
| - name: Figure out the PR number | ||
| run: echo ${{ inputs.pr }} | ||
|
|
||
| - name: Default database URL | ||
| run: echo "Is this a PG build? ${{ inputs.is-pg-build }}" | ||
|
|
||
|
|
@@ -203,105 +203,104 @@ jobs: | |
| APPSMITH_ENVFILE_PATH: /tmp/dummy.env | ||
| APPSMITH_VERBOSE_LOGGING_ENABLED: false | ||
| run: | | ||
| if [[ "${{ inputs.is-pg-build }}" == "true" ]]; then | ||
| export APPSMITH_DB_URL="postgresql://postgres:password@localhost:5432/postgres" | ||
| else | ||
| export APPSMITH_DB_URL="mongodb://localhost:27017/mobtools" | ||
| fi | ||
|
|
||
| args=() | ||
|
|
||
| if [[ "${{ steps.run_result.outputs.run_result }}" == "failedtest" ]]; then | ||
| failed_tests="${{ steps.failed_tests.outputs.tests }}" | ||
| args+=("-DfailIfNoTests=false" "-Dsurefire.failIfNoSpecifiedTests=false" "-Dtest=${failed_tests}") | ||
| fi | ||
|
|
||
| # Run tests and capture logs | ||
| 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}" | ||
|
|
||
| # Prepare output file for failed tests and ensure a fresh file is created | ||
| OUTPUT_FILE="failed-server-tests.txt" | ||
| rm -f "$OUTPUT_FILE" | ||
| touch "$OUTPUT_FILE" | ||
|
|
||
| failed_modules=() | ||
| skipped_modules=() | ||
|
|
||
| # Process mvn_test.log for FAILURE and SKIPPED statuses | ||
| 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 | ||
|
|
||
| echo "Failed Modules: ${failed_modules[*]}" | ||
| echo "Skipped Modules: ${skipped_modules[*]}" | ||
|
|
||
| # Handle older approach for reading failed tests from XML files | ||
| failed_tests_from_xml="$PWD/failed-tests-from-xml.txt" | ||
| 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 | ||
| for module in "${failed_modules[@]}"; do | ||
| grep -v "$module" "$failed_tests_from_xml" > temp_file && mv temp_file "$failed_tests_from_xml" | ||
| done | ||
|
|
||
| # Include all skipped module test files in the final list | ||
| for module in "${skipped_modules[@]}"; do | ||
| module_directories=$(find . -path "*/${module}*/src/test/java/*" -type f -name "*Test.java" -exec dirname {} \; | sort -u) | ||
| for module_directory in $module_directories; do | ||
| 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 | ||
| cat "$failed_tests_from_xml" >> "$OUTPUT_FILE" | ||
|
|
||
| # Print the final output | ||
| cat "$OUTPUT_FILE" | ||
|
|
||
| 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 | ||
| if [[ "${{ inputs.is-pg-build }}" == "true" ]]; then | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's no change here. It's just formatting changes to make it compatible with YML formatting in our code base. Please ignore this. |
||
| export APPSMITH_DB_URL="postgresql://postgres:password@localhost:5432/postgres" | ||
| else | ||
| export APPSMITH_DB_URL="mongodb://localhost:27017/mobtools" | ||
| fi | ||
|
|
||
| args=() | ||
|
|
||
| if [[ "${{ steps.run_result.outputs.run_result }}" == "failedtest" ]]; then | ||
| failed_tests="${{ steps.failed_tests.outputs.tests }}" | ||
| args+=("-DfailIfNoTests=false" "-Dsurefire.failIfNoSpecifiedTests=false" "-Dtest=${failed_tests}") | ||
| fi | ||
|
|
||
| # Run tests and capture logs | ||
| 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}" | ||
|
|
||
| # Prepare output file for failed tests and ensure a fresh file is created | ||
| OUTPUT_FILE="failed-server-tests.txt" | ||
| rm -f "$OUTPUT_FILE" | ||
| touch "$OUTPUT_FILE" | ||
|
|
||
| failed_modules=() | ||
| skipped_modules=() | ||
|
|
||
| # Process mvn_test.log for FAILURE and SKIPPED statuses | ||
| 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 | ||
|
|
||
| echo "Failed Modules: ${failed_modules[*]}" | ||
| echo "Skipped Modules: ${skipped_modules[*]}" | ||
|
|
||
| # Handle older approach for reading failed tests from XML files | ||
| failed_tests_from_xml="$PWD/failed-tests-from-xml.txt" | ||
| 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 | ||
| for module in "${failed_modules[@]}"; do | ||
| grep -v "$module" "$failed_tests_from_xml" > temp_file && mv temp_file "$failed_tests_from_xml" | ||
| done | ||
|
|
||
| # Include all skipped module test files in the final list | ||
| for module in "${skipped_modules[@]}"; do | ||
| module_directories=$(find . -path "*/${module}*/src/test/java/*" -type f -name "*Test.java" -exec dirname {} \; | sort -u) | ||
| for module_directory in $module_directories; do | ||
| 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 | ||
| cat "$failed_tests_from_xml" >> "$OUTPUT_FILE" | ||
|
|
||
| # Print the final output | ||
| cat "$OUTPUT_FILE" | ||
|
|
||
| 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 | ||
| - name: Set fail if there are test failures | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.