Updated project run settings

pull/182/head
Nick Maltbie 2022-04-17 13:05:17 -07:00
parent 518ed9a30c
commit 34e7b217b7
2 changed files with 34 additions and 16 deletions

View File

@ -258,7 +258,7 @@ jobs:
- name: Upload code coverage results - name: Upload code coverage results
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: Code coverage results (edit mode) name: Code coverage results (${{ matrix.testMode }} mode)
path: ${{ steps.codecovtests.outputs.coverageResultsPath }} path: ${{ steps.codecovtests.outputs.coverageResultsPath }}
retention-days: 7 retention-days: 7

View File

@ -17,8 +17,16 @@ FULL_ARTIFACTS_PATH=$GITHUB_WORKSPACE/$ARTIFACTS_PATH
# #
# Display custom parameters # Display custom parameters
# #
echo "Using custom parameters $CUSTOM_PARAMETERS." echo "Using custom parameters $CUSTOM_PARAMETERS."
#
# Set and display the coverage results path
#
echo "Using artifacts path \"$COVERAGE_RESULTS_PATH\" to save test coverage results."
FULL_COVERAGE_RESULTS_PATH=$GITHUB_WORKSPACE/$COVERAGE_RESULTS_PATH
# Set the modes for testing # Set the modes for testing
case $TEST_MODE in case $TEST_MODE in
editmode) editmode)
@ -44,18 +52,12 @@ if [ "$ENABLE_CODE_COVERAGE" = "true" ]; then
# Configure code coverage options # Configure code coverage options
COVERAGE_OPTIONS="" COVERAGE_OPTIONS=""
ASSEMBLY_FILTER_OPTIONS="" ASSEMBLY_FILTER_OPTIONS=""
COVERAGE_RESULTS_OPTIONS=""
# Setup assembly filters if provided # Setup assembly filters if provided
if [ -n "$COVERAGE_ASSEMBLY_FILTERS" ]; then if [ -n "$COVERAGE_ASSEMBLY_FILTERS" ]; then
ASSEMBLY_FILTER_OPTIONS=";assemblyFilters:$COVERAGE_ASSEMBLY_FILTERS" ASSEMBLY_FILTER_OPTIONS=";assemblyFilters:$COVERAGE_ASSEMBLY_FILTERS"
fi fi
# Setup coverage results path if provided
if [ -n "$COVERAGE_RESULTS_PATH" ]; then
COVERAGE_RESULTS_OPTIONS="-coverageResultsPath $COVERAGE_RESULTS_PATH"
fi
# Options to combine both playmode and editmode results # Options to combine both playmode and editmode results
if [ "$EDIT_MODE" = "true" ] && [ "$PLAY_MODE" = "true" ]; then if [ "$EDIT_MODE" = "true" ] && [ "$PLAY_MODE" = "true" ]; then
COVERAGE_OPTIONS="enableCyclomaticComplexity$ASSEMBLY_FILTER_OPTIONS" COVERAGE_OPTIONS="enableCyclomaticComplexity$ASSEMBLY_FILTER_OPTIONS"
@ -64,7 +66,7 @@ if [ "$ENABLE_CODE_COVERAGE" = "true" ]; then
fi fi
# Set parameters for code coverage # Set parameters for code coverage
CODE_COVERAGE_PARAMETERS="-debugCodeOptimization -enableCodeCoverage -coverageOptions $COVERAGE_OPTIONS $COVERAGE_RESULTS_OPTIONS" CODE_COVERAGE_PARAMETERS="-debugCodeOptimization -enableCodeCoverage -coverageOptions $COVERAGE_OPTIONS -coverageResultsPath $FULL_COVERAGE_RESULTS_PATH"
fi fi
echo "Using code coverage parameters $CODE_COVERAGE_PARAMETERS." echo "Using code coverage parameters $CODE_COVERAGE_PARAMETERS."
@ -206,13 +208,8 @@ fi
# #
# Combine test results if needed # Combine test results if needed
# #
COMBINE_EXIT_CODE=0
if [ "$EDIT_MODE" = "true" ] && [ "$PLAY_MODE" = "true" ] && [ "$ENABLE_CODE_COVERAGE" = "true" ]; then if [ "$EDIT_MODE" = "true" ] && [ "$PLAY_MODE" = "true" ] && [ "$ENABLE_CODE_COVERAGE" = "true" ]; then
# Setup coverage results path if provided
COVERAGE_RESULTS_OPTIONS=""
if [ -n "$COVERAGE_RESULTS_PATH" ]; then
COVERAGE_RESULTS_OPTIONS="-coverageResultsPath $COVERAGE_RESULTS_PATH"
fi
echo "" echo ""
echo "##############################" echo "##############################"
echo "# Combining Coverage Results #" echo "# Combining Coverage Results #"
@ -222,11 +219,28 @@ if [ "$EDIT_MODE" = "true" ] && [ "$PLAY_MODE" = "true" ] && [ "$ENABLE_CODE_COV
-batchmode \ -batchmode \
-debugCodeOptimization \ -debugCodeOptimization \
-enableCodeCoverage \ -enableCodeCoverage \
-logFile "$FULL_ARTIFACTS_PATH/coverage_combination.log" \ -logFile "$FULL_ARTIFACTS_PATH/combine_coverage.log" \
-projectPath "$UNITY_PROJECT_PATH" \ -projectPath "$UNITY_PROJECT_PATH" \
$COVERAGE_RESULTS_OPTIONS \ -coverageResultsPath "$FULL_COVERAGE_RESULTS_PATH" \
-coverageOptions generateHtmlReport;generateBadgeReport \ -coverageOptions generateHtmlReport;generateBadgeReport \
-quit -quit
# Catch exit code
COMBINE_EXIT_CODE=$?
# Print unity log output
cat "$FULL_ARTIFACTS_PATH/combine_coverage.log"
# Display results
if [ $COMBINE_EXIT_CODE -eq 0 ]; then
echo "Combine coverage succeeded, no failures occurred";
elif [ $COMBINE_EXIT_CODE -eq 2 ]; then
echo "Combine coverage, some tests failed";
elif [ $COMBINE_EXIT_CODE -eq 3 ]; then
echo "Combine coverage (other failure)";
else
echo "Unexpected exit code $COMBINE_EXIT_CODE";
fi
fi fi
# #
@ -240,3 +254,7 @@ fi
if [ $PLAY_MODE_EXIT_CODE -gt 0 ]; then if [ $PLAY_MODE_EXIT_CODE -gt 0 ]; then
TEST_RUNNER_EXIT_CODE=$PLAY_MODE_EXIT_CODE TEST_RUNNER_EXIT_CODE=$PLAY_MODE_EXIT_CODE
fi fi
if [ $COMBINE_EXIT_CODE -gt 0 ]; then
TEST_RUNNER_EXIT_CODE=$COMBINE_EXIT_CODE
fi