-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Added linting and coverage analysis * Added Lua linting to CI * Corrected Lua unittest paths * Prepared for the release * Updated dependecies * Updated Lua CI pipeline
- Loading branch information
1 parent
2f40b6e
commit 044b52b
Showing
23 changed files
with
179 additions
and
66 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# Changelog | ||
|
||
* [0.2.2](changes_0.2.2.md) | ||
* [0.2.1](changes_0.2.1.md) | ||
* [0.2.0](changes_0.2.0.md) | ||
* [0.1.0](changes_0.1.0.md) |
This file contains 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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# SageMaker Extension 0.2.2, released 2021-12-17 | ||
|
||
Code name: Add static code analysis for Lua implementations to CI | ||
|
||
## Summary | ||
|
||
This release includes a linter and a coverage analyzer of the Lua implementation | ||
to the CI pipeline of the SageMaker-Extension. Thus, the static code analysis of | ||
Lua scripts are performed without executing them and, the coding standards and | ||
conventions are adhered. | ||
|
||
|
||
### Features | ||
|
||
- #48: Added static code analysis to CI for Lua | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains 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 |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = '0.2.1' | ||
__version__ = '0.2.2' |
This file contains 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
This file contains 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
2 changes: 1 addition & 1 deletion
2
exasol_sagemaker_extension/lua/test/test_autopilot_endpoint_deletion.lua
This file contains 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
2 changes: 1 addition & 1 deletion
2
exasol_sagemaker_extension/lua/test/test_autopilot_endpoint_deployment.lua
This file contains 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
2 changes: 1 addition & 1 deletion
2
exasol_sagemaker_extension/lua/test/test_autopilot_job_status_polling.lua
This file contains 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
This file contains 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
This file contains 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
2 changes: 1 addition & 1 deletion
2
exasol_sagemaker_extension/lua/test/test_aws_sagemaker_handler.lua
This file contains 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
2 changes: 1 addition & 1 deletion
2
exasol_sagemaker_extension/lua/test/test_db_metadata_reader.lua
This file contains 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
2 changes: 1 addition & 1 deletion
2
exasol_sagemaker_extension/lua/test/test_db_metadata_writer.lua
This file contains 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
2 changes: 1 addition & 1 deletion
2
exasol_sagemaker_extension/lua/test/test_endpoint_connection_handler.lua
This file contains 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
2 changes: 1 addition & 1 deletion
2
exasol_sagemaker_extension/lua/test/test_install_autopilot_prediction_udf.lua
This file contains 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
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
@@ -0,0 +1,114 @@ | ||
#!/bin/bash | ||
|
||
# This script finds and runs Lua unit tests, collects coverage and runs static code analysis. | ||
|
||
readonly script_dir=$(dirname "$(readlink -f "$0")") | ||
if [[ -v $1 ]] | ||
then | ||
readonly base_dir="$1" | ||
else | ||
readonly base_dir=$(readlink -f "$script_dir/..") | ||
fi | ||
|
||
readonly exit_ok=0 | ||
readonly exit_software=2 | ||
readonly src_module_path="$base_dir/exasol_sagemaker_extension/lua/src" | ||
readonly test_module_path="$base_dir/exasol_sagemaker_extension/lua/test" | ||
readonly target_dir="$base_dir/target" | ||
readonly reports_dir="$target_dir/luaunit-reports" | ||
readonly luacov_dir="$target_dir/luacov-reports" | ||
|
||
function create_target_directories { | ||
mkdir -p "$reports_dir" | ||
mkdir -p "$luacov_dir" | ||
} | ||
|
||
## | ||
# Run the unit tests and collect code coverage. | ||
# | ||
# Return error status in case there were failures. | ||
# | ||
function run_tests { | ||
cd "$test_module_path" || exit | ||
readonly tests="$(find . -name '*.lua')" | ||
test_suites=0 | ||
failures=0 | ||
successes=0 | ||
for testcase in $tests | ||
do | ||
((test_suites++)) | ||
|
||
if LUA_PATH="$src_module_path/?.lua;$(luarocks path --lr-path)" \ | ||
lua -lluacov "$testcase" -o junit -n "$reports_dir/$testcase" | ||
then | ||
((successes++)) | ||
else | ||
((failures++)) | ||
fi | ||
echo | ||
done | ||
echo -n "Ran $test_suites test suites. $successes successes, " | ||
if [[ "$failures" -eq 0 ]] | ||
then | ||
echo -e "\e[1m\e[32m$failures failures\e[0m." | ||
return "$exit_ok" | ||
else | ||
echo -e "\e[1m\e[31m$failures failures\e[0m." | ||
return "$exit_software" | ||
fi | ||
} | ||
|
||
## | ||
# Collect the coverage results into a single file. | ||
# | ||
# Return exit status of coverage collector. | ||
# | ||
function collect_coverage_results { | ||
echo | ||
echo "Collecting code coverage results" | ||
luacov | ||
return "$?" | ||
} | ||
|
||
## | ||
# Move the coverage results into the target directory. | ||
# | ||
# Return exit status of `mv` command. | ||
# | ||
function move_coverage_results { | ||
echo "Moving coverage results to $luacov_dir" | ||
mv "$test_module_path"/luacov.*.out "$luacov_dir" | ||
return "$?" | ||
} | ||
|
||
## | ||
# Print the summary section of the code coverage report to the console | ||
# | ||
function print_coverage_summary { | ||
echo | ||
grep --after 500 'File\s*Hits' "$luacov_dir/luacov.report.out" | ||
} | ||
|
||
## | ||
# Analyze the Lua code with "luacheck". | ||
# | ||
# Return exit status of code coverage. | ||
# | ||
function run_static_code_analysis { | ||
echo | ||
echo "Running static code analysis" | ||
echo | ||
luacheck "$src_module_path" "$test_module_path" --codes \ | ||
--ignore 111 --ignore 112 --ignore 113 --ignore 142 | ||
return "$?" | ||
} | ||
|
||
create_target_directories | ||
run_tests \ | ||
&& collect_coverage_results \ | ||
&& move_coverage_results \ | ||
&& print_coverage_summary \ | ||
&& run_static_code_analysis \ | ||
|| exit "$exit_software" | ||
|
||
exit "$exit_ok" |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.