Skip to content

Commit

Permalink
ci(python): upgrade workflow to v2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
vpayno committed Jan 18, 2024
1 parent 28bdc4e commit 5cb6dc9
Show file tree
Hide file tree
Showing 9 changed files with 388 additions and 72 deletions.
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

0 comments on commit 5cb6dc9

Please sign in to comment.