Skip to content
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

ci(python): upgrade workflow to v2.0 #342

Merged
merged 3 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/citools/python/python-lint-bandit
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
#
# .github/citools/python/python-lint-bandit
#

# shellcheck disable=SC1091
source ../../.github/citools/includes/wrapper-library || exit

declare -i retval=0

main() {
printf "\nRunning Python Lint - Bandit\n\n"

show_tool_versions_python_short

print_ruler

run_command bandit --version

print_ruler

# shellcheck disable=SC2048,SC2068,SC2086
run_command bandit ${@:---verbose --recursive ./src}

print_ruler

echo Exit code: "${retval}"
return "${retval}"
}

time main "${@}"
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# .github/citools/python/python-lint-formatter
# .github/citools/python/python-lint-pylint
#

# shellcheck disable=SC1091
Expand All @@ -9,13 +9,18 @@ source ../../.github/citools/includes/wrapper-library || exit
declare -i retval=0

main() {
printf "\nRunning Python Formatter\n\n"
printf "\nRunning Python Lint - PyLint\n\n"

show_tool_versions_python_short

print_ruler

run_command ruff .
run_command pylint --version

print_ruler

# shellcheck disable=SC2048,SC2068,SC2086
run_command pylint ${@:-./src}

print_ruler

Expand Down
31 changes: 31 additions & 0 deletions .github/citools/python/python-lint-pyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
#
# .github/citools/python/python-lint-pyright
#

# shellcheck disable=SC1091
source ../../.github/citools/includes/wrapper-library || exit

declare -i retval=0

main() {
printf "\nRunning Python Lint - PyRight\n\n"

show_tool_versions_python_short

print_ruler

run_command pyright --version

print_ruler

# shellcheck disable=SC2048,SC2068,SC2086
run_command pyright ${@:---stats ./src}

print_ruler

echo Exit code: "${retval}"
return "${retval}"
}

time main "${@}"
31 changes: 31 additions & 0 deletions .github/citools/python/python-lint-refurb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
#
# .github/citools/python/python-lint-refurb
#

# shellcheck disable=SC1091
source ../../.github/citools/includes/wrapper-library || exit

declare -i retval=0

main() {
printf "\nRunning Python Lint - Refurb\n\n"

show_tool_versions_python_short

print_ruler

run_command refurb --version

print_ruler

# shellcheck disable=SC2048,SC2068,SC2086
run_command refurb ${@:-./src}

print_ruler

echo Exit code: "${retval}"
return "${retval}"
}

time main "${@}"
31 changes: 31 additions & 0 deletions .github/citools/python/python-lint-ruff
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
#
# .github/citools/python/python-lint-ruff
#

# shellcheck disable=SC1091
source ../../.github/citools/includes/wrapper-library || exit

declare -i retval=0

main() {
printf "\nRunning Python Lint - Ruff\n\n"

show_tool_versions_python_short

print_ruler

run_command ruff --version

print_ruler

# shellcheck disable=SC2048,SC2068,SC2086
run_command ruff ${@:-check --ignore E501 ./src}

print_ruler

echo Exit code: "${retval}"
return "${retval}"
}

time main "${@}"
17 changes: 12 additions & 5 deletions .github/citools/python/python-test-with-coverage
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,24 @@ main() {

print_ruler

run_command pytest --verbose --cov=. --cov-branch --cov-report={term-missing,xml:.coverage.xml} -p no:randomly || ((retval++))
run_command pytest --version

print_ruler

echo Running: coverage report --show-missing
coverage report --show-missing
export PYTHONPATH="./src"
printf "PYTHONPATH=\"%s\"\n" "${PYTHONPATH}"

print_ruler

echo Running: coverage annotate
coverage annotate
run_command pytest --verbose --cov=. --cov-branch --cov-report={term-missing,xml:.coverage.xml} -p no:randomly ./test || ((retval++))

print_ruler

run_command coverage report --show-missing

print_ruler

run_command coverage annotate

print_ruler

Expand Down
32 changes: 32 additions & 0 deletions .github/citools/python/python-test-with-doctests
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
#
# .github/citools/python/python-test-doctest
#

# shellcheck disable=SC1091
source ../../.github/citools/includes/wrapper-library || exit

declare -i retval=0

main() {
printf "\nRunning Python DocTests\n\n"

show_tool_versions_python_short

print_ruler

export PYTHONPATH="./src"
printf "PYTHONPATH=\"%s\"\n" "${PYTHONPATH}"

print_ruler

# shellcheck disable=SC2048,SC2068,SC2086
run_command python -m doctest ${@:--v ./src/*/*.py}

print_ruler

echo Exit code: "${retval}"
return "${retval}"
}

time main "${@}"
Loading
Loading