Skip to content
This repository was archived by the owner on Sep 30, 2025. It is now read-only.
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
2 changes: 1 addition & 1 deletion .github/workflows/2.build-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
python -m pip install -U pip
python -m pip install -r ./requirements.test.txt
- name: Test with pytest
run: ./scripts/test.sh
run: ./scripts/test.sh -l

build_publish:
needs: test
Expand Down
7 changes: 6 additions & 1 deletion docs/scripts/2.clean.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@ The script performs the following operations:
To execute the clean script, simply run the following command in the terminal:

```sh
./clean.sh
./clean.sh [-a|--all]
```

**Examples**:

- To clean just non-essential files: `./clean.sh`
- To clean all files: `./clean.sh -a`

This will clean up the project directory, removing any unnecessary files and directories and ensuring a clean environment for a fresh build.

**Source code**: [**`clean.sh`**](../../scripts/clean.sh)
15 changes: 14 additions & 1 deletion docs/scripts/4.test.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,28 @@ The script performs the following operations:

- **Loading base script**: Includes the `base.sh` script to gain access to its utility functions and environment variables.
- **Running pytest**: Runs the pytest tests for the project.
- **Logging**: If the `-l` or `--log` option is provided, the script will log the output of the pytest tests to console.
- **Coverage**: If the `-c` or `--cov` option is provided, the script will run the pytest tests with coverage.
- **Verbose**: If the `-v` or `--verbose` option is provided, the script will run the pytest tests with verbose error outputs.

**Usage**:

To execute the test script, simply run the following command in the terminal:

```sh
./test.sh
./test.sh [-l|--log] [-c|--cov] [-v|--verbose]
```

**Examples**:

- To test: `./test.sh`
- To test with logging: `./test.sh -l`
- To test with coverage: `./test.sh -c`
- To test with verbose: `./test.sh -v`
- To test with logging, coverage and verbose: `./test.sh -l -c -v`

This script will run the pytest tests for the project. It can also be used to run the tests with logging, coverage, and verbose options.

**Source code**: [**`test.sh`**](../../scripts/test.sh)

---
Expand Down
2 changes: 2 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ main()
fi
## --- Menu arguments --- ##


if [ "${_IS_TEST}" == true ]; then
if [ -z "$(which pytest)" ]; then
echoError "Pytest not found or not installed."
Expand All @@ -84,6 +85,7 @@ main()
./scripts/test.sh || exit 2
fi


echoInfo "Building package..."
# python setup.py sdist bdist_wheel || exit 2
python -m build || exit 2
Expand Down
1 change: 1 addition & 0 deletions scripts/bump-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ main()
fi
## --- Menu arguments --- ##


if [ -z "${_BUMP_TYPE:-}" ]; then
echoError "Bump type is empty! Use '-b=' or '--bump-type=' argument."
exit 1
Expand Down
28 changes: 27 additions & 1 deletion scripts/clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,48 @@ source ./scripts/base.sh
## --- Base --- ##


## --- Variables --- ##
# Flags:
_IS_ALL=false
## --- Variables --- ##


## --- Main --- ##
main()
{
## --- Menu arguments --- ##
if [ -n "${1:-}" ]; then
for _input in "${@:-}"; do
case ${_input} in
-a | --all)
_IS_ALL=true
shift;;
*)
echoError "Failed to parsing input -> ${_input}"
echoInfo "USAGE: ${0} -a, --all"
exit 1;;
esac
done
fi
## --- Menu arguments --- ##


echoInfo "Cleaning..."

find . -type f -name ".DS_Store" -print -delete || exit 2
find . -type f -name ".Thumbs.db" -print -delete || exit 2
find . -type d -name "__pycache__" -exec rm -rfv {} + || exit 2
# find ./examples -type d -name "logs" -exec rm -rfv {} + || exit 2

rm -rfv .benchmarks || exit 2
rm -rfv .pytest_cache || exit 2
rm -rfv build || exit 2
rm -rfv dist || exit 2
# rm -rfv ./*.egg-info || exit 2
rm -rfv .coverage || exit 2

if [ "${_IS_ALL}" == true ]; then
rm -rfv ./*.egg-info || exit 2
fi
echoOk "Done."
}

Expand Down
70 changes: 65 additions & 5 deletions scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,68 @@ fi
## --- Base --- ##


echoInfo "Running test..."
python -m pytest -sv || exit 2
# python -m pytest -sv -o log_cli=true || exit 2
# python -m pytest -sv --cov -o log_cli=true || exit 2
echoOk "Done."
## --- Variables --- ##
# Flags:
_IS_LOGGING=false
_IS_COVERAGE=false
_IS_VERBOSE=false
## --- Variables --- ##


## --- Main --- ##
main()
{
## --- Menu arguments --- ##
if [ -n "${1:-}" ]; then
for _input in "${@:-}"; do
case ${_input} in
-l | --log)
_IS_LOGGING=true
shift;;
-c | --cov)
_IS_COVERAGE=true
shift;;
-v | --verbose)
_IS_VERBOSE=true
shift;;
*)
echoError "Failed to parsing input -> ${_input}"
echoInfo "USAGE: ${0} -l, --log | -c, --cov | -v, --verbose"
exit 1;;
esac
done
fi
## --- Menu arguments --- ##


if [ "${_IS_COVERAGE}" == true ]; then
if ! python -c "import pytest_cov" &> /dev/null; then
echoError "'pytest-cov' python package is not installed."
exit 1
fi
fi


_logging_param=""
_coverage_param=""
_verbose_param=""
if [ "${_IS_LOGGING}" == true ]; then
_logging_param="-o log_cli=true"
fi

if [ "${_IS_COVERAGE}" == true ]; then
_coverage_param="--cov"
fi

if [ "${_IS_VERBOSE}" == true ]; then
_verbose_param="-vv"
fi

echoInfo "Running test..."
# shellcheck disable=SC2086
python -m pytest -sv ${_coverage_param} ${_logging_param} ${_verbose_param} || exit 2
echoOk "Done."
}

main "${@:-}"
## --- Main --- ##