-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also remove it from the CI.
- Loading branch information
Showing
21 changed files
with
252 additions
and
87 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,112 @@ | ||
#!/bin/bash | ||
|
||
main() { | ||
topdir="$(git rev-parse --show-toplevel)" | ||
self="${topdir}/ci" | ||
cargo_toml_path="${topdir}/v2/rust/Cargo.toml" | ||
pyproject_toml_path="${topdir}/pyproject.toml" | ||
v2_dir="${topdir}/v2" | ||
v2_src="${v2_dir}/robotmk" | ||
v2_tests="${v2_dir}/tests" | ||
checkmk_extensions_dir="${topdir}/checkmk_extensions" | ||
mode="${1}" | ||
shift | ||
|
||
case "${mode}" in | ||
'cargo-fmt-check') | ||
cargo fmt --manifest-path "${cargo_toml_path}" -- --check | ||
;; | ||
|
||
'cargo-clippy') | ||
cargo clippy --manifest-path "${cargo_toml_path}" --all-targets -- --deny warnings | ||
;; | ||
|
||
'cargo-test') | ||
cargo test --manifest-path "${cargo_toml_path}" --all-targets | ||
;; | ||
|
||
'black') | ||
poetry run black --config "${pyproject_toml_path}" "$@" | ||
;; | ||
|
||
'black-check-all') | ||
"${self}" black --check "${v2_src}" "${v2_tests}" | ||
;; | ||
|
||
'isort') | ||
poetry run isort --settings-path "${pyproject_toml_path}" "$@" | ||
;; | ||
|
||
'isort-check-all') | ||
"${self}" isort --check-only "${v2_src}" "${v2_tests}" | ||
;; | ||
|
||
'mypy') | ||
poetry run mypy --config-file "${pyproject_toml_path}" "$@" | ||
;; | ||
|
||
'mypy-check-all') | ||
"${self}" mypy "${v2_src}" "${v2_tests}" | ||
;; | ||
|
||
'pylint') | ||
poetry run pylint --rcfile "${pyproject_toml_path}" "$@" | ||
;; | ||
|
||
'pylint-check-all') | ||
"${self}" pylint --recursive true "${v2_src}" "${v2_tests}" | ||
;; | ||
|
||
'pytest') | ||
poetry run pytest --rootdir "${topdir}" "$@" | ||
;; | ||
|
||
'pytest-check-all') | ||
"${self}" pytest "${v2_tests}" | ||
;; | ||
|
||
'PSScriptAnalyzer-check-all') | ||
pwsh_output=$(pwsh -Command "Invoke-ScriptAnalyzer -Settings ${topdir}/PSScriptAnalyzerSettings.psd1 -Path ${checkmk_extensions_dir} -Recurse") | ||
pwsh_exitcode="$?" | ||
if [ "${pwsh_exitcode}" -eq 0 ]; then { | ||
if [ -z "${pwsh_output}" ]; then { | ||
echo "No static Powershell issues found" | ||
return 0 | ||
} else { | ||
echo "${pwsh_output}" | ||
return 1 | ||
} | ||
fi | ||
} else { | ||
echo "${pwsh_output}" | ||
return "${pwsh_exitcode}" | ||
} | ||
fi | ||
;; | ||
|
||
'check-all') | ||
exit_code=0 | ||
for rust_step in fmt-check clippy test | ||
do | ||
"${self}" "cargo-${rust_step}" | ||
exit_code=$(( exit_code + $? )) | ||
done | ||
for tool in black isort mypy pylint pytest PSScriptAnalyzer | ||
do | ||
"${self}" "${tool}-check-all" | ||
exit_code=$(( exit_code + $? )) | ||
done | ||
return "${exit_code}" | ||
;; | ||
|
||
*) | ||
echo "Unknown mode: ${mode}" 1>&2 | ||
return 1 | ||
;; | ||
esac | ||
|
||
return "$?" | ||
} | ||
|
||
main "$@" | ||
exit "$?" |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,42 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
main() { | ||
setup_rust | ||
|
||
setup_python_environment "${PYTHON_VERSION}" | ||
|
||
setup_powershell | ||
|
||
git config core.hooksPath .githooks | ||
} | ||
|
||
setup_python_environment() { | ||
check_poetry_executable | ||
export POETRY_VIRTUALENVS_IN_PROJECT=true | ||
poetry install --with dev | ||
} | ||
|
||
check_poetry_executable() { | ||
command -v poetry > /dev/null || { | ||
echo "poetry executable not found, aborting. Installing poetry is non-trivial, please do it manually." | ||
exit 1 | ||
} | ||
} | ||
|
||
setup_powershell() { | ||
sudo apt-get install wget apt-transport-https software-properties-common | ||
wget -q "https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb" | ||
sudo dpkg -i packages-microsoft-prod.deb | ||
rm packages-microsoft-prod.deb | ||
sudo apt-get update | ||
sudo apt-get install powershell | ||
pwsh -Command "Install-Module -Name PSScriptAnalyzer" | ||
} | ||
|
||
setup_rust() { | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s - -y | ||
} | ||
|
||
main |
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,94 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<robot generator="Rebot 6.1.1 (Python 3.11.4 on win32)" generated="20230901 02:47:13.056" rpa="false" schemaversion="4"> | ||
<suite id="s1" name="Tasks & Tasks"> | ||
<suite id="s1-s1" name="Tasks" source="C:\robotmk\v2\data\retry_suite\tasks.robot"> | ||
<kw name="Setup" library="math" type="SETUP"> | ||
<msg timestamp="20230901 02:47:09.299" level="INFO">Setting up...</msg> | ||
<status status="PASS" starttime="20230901 02:47:09.299" endtime="20230901 02:47:09.299"/> | ||
</kw> | ||
<test id="s1-s1-t1" name="Addition 1" line="17"> | ||
<kw name="Add" library="math"> | ||
<var>${result}</var> | ||
<arg>${20}</arg> | ||
<arg>${15}</arg> | ||
<msg timestamp="20230901 02:47:09.299" level="INFO">${result} = 35</msg> | ||
<status status="PASS" starttime="20230901 02:47:09.299" endtime="20230901 02:47:09.299"/> | ||
</kw> | ||
<kw name="Should Be Equal As Integers" library="BuiltIn"> | ||
<arg>${result}</arg> | ||
<arg>${35}</arg> | ||
<doc>Fails if objects are unequal after converting them to integers.</doc> | ||
<status status="PASS" starttime="20230901 02:47:09.299" endtime="20230901 02:47:09.299"/> | ||
</kw> | ||
<status status="NOT RUN" starttime="20230901 02:47:09.299" endtime="20230901 02:47:09.299"/> | ||
</test> | ||
<test id="s1-s1-t2" name="Addition 2" line="21"> | ||
<kw name="Add" library="math"> | ||
<var>${result}</var> | ||
<arg>${1}</arg> | ||
<arg>${2}</arg> | ||
<msg timestamp="20230901 02:47:09.299" level="INFO">${result} = 3</msg> | ||
<status status="PASS" starttime="20230901 02:47:09.299" endtime="20230901 02:47:09.299"/> | ||
</kw> | ||
<kw name="Should Be Equal As Integers" library="BuiltIn"> | ||
<arg>${result}</arg> | ||
<arg>${expected_result_2}</arg> | ||
<doc>Fails if objects are unequal after converting them to integers.</doc> | ||
<msg timestamp="20230901 02:47:09.299" level="INFO">Argument types are: | ||
<class 'int'> | ||
<class 'str'></msg> | ||
<msg timestamp="20230901 02:47:09.299" level="FAIL">3 != 4</msg> | ||
<status status="FAIL" starttime="20230901 02:47:09.299" endtime="20230901 02:47:09.299"/> | ||
</kw> | ||
<status status="FAIL" starttime="20230901 02:47:09.299" endtime="20230901 02:47:09.299">3 != 4</status> | ||
</test> | ||
<kw name="Teardown" library="math" type="TEARDOWN"> | ||
<msg timestamp="20230901 02:47:09.299" level="INFO">Tearing down...</msg> | ||
<status status="PASS" starttime="20230901 02:47:09.299" endtime="20230901 02:47:09.299"/> | ||
</kw> | ||
<doc>Test file for configuring RobotFramework</doc> | ||
<status status="FAIL" starttime="20230901 02:47:09.220" endtime="20230901 02:47:09.299"/> | ||
</suite> | ||
<suite id="s1-s2" name="Tasks" source="C:\robotmk\v2\data\retry_suite\tasks.robot"> | ||
<kw name="Setup" library="math" type="SETUP"> | ||
<msg timestamp="20230901 02:47:12.808" level="INFO">Setting up...</msg> | ||
<status status="PASS" starttime="20230901 02:47:12.807" endtime="20230901 02:47:12.808"/> | ||
</kw> | ||
<test id="s1-s2-t1" name="Addition 2" line="21"> | ||
<kw name="Add" library="math"> | ||
<var>${result}</var> | ||
<arg>${1}</arg> | ||
<arg>${2}</arg> | ||
<msg timestamp="20230901 02:47:12.808" level="INFO">${result} = 3</msg> | ||
<status status="PASS" starttime="20230901 02:47:12.808" endtime="20230901 02:47:12.808"/> | ||
</kw> | ||
<kw name="Should Be Equal As Integers" library="BuiltIn"> | ||
<arg>${result}</arg> | ||
<arg>${expected_result_2}</arg> | ||
<doc>Fails if objects are unequal after converting them to integers.</doc> | ||
<status status="PASS" starttime="20230901 02:47:12.808" endtime="20230901 02:47:12.808"/> | ||
</kw> | ||
<status status="PASS" starttime="20230901 02:47:12.808" endtime="20230901 02:47:12.808"/> | ||
</test> | ||
<kw name="Teardown" library="math" type="TEARDOWN"> | ||
<msg timestamp="20230901 02:47:12.808" level="INFO">Tearing down...</msg> | ||
<status status="PASS" starttime="20230901 02:47:12.808" endtime="20230901 02:47:12.808"/> | ||
</kw> | ||
<doc>Test file for configuring RobotFramework</doc> | ||
<status status="PASS" starttime="20230901 02:47:12.723" endtime="20230901 02:47:12.808"/> | ||
</suite> | ||
<status status="FAIL" starttime="N/A" endtime="N/A" elapsedtime="164"/> | ||
</suite> | ||
<statistics> | ||
<total> | ||
<stat pass="2" fail="1" skip="0">All Tests</stat> | ||
</total> | ||
<tag></tag> | ||
<suite> | ||
<stat pass="2" fail="1" skip="0" id="s1" name="Tasks & Tasks">Tasks & Tasks</stat> | ||
<stat pass="1" fail="1" skip="0" id="s1-s1" name="Tasks">Tasks & Tasks.Tasks</stat> | ||
<stat pass="1" fail="0" skip="0" id="s1-s2" name="Tasks">Tasks & Tasks.Tasks</stat> | ||
</suite> | ||
</statistics> | ||
<errors></errors> | ||
</robot> |
File renamed without changes.
File renamed without changes.
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