Skip to content

Commit de3f4ea

Browse files
committed
add Test Scripts' Help script and workflow
1 parent 6482d63 commit de3f4ea

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Test scripts' help
2+
3+
on:
4+
push:
5+
workflow_dispatch:
6+
7+
jobs:
8+
job:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
13+
# https://github.com/actions/setup-python
14+
- name: Install Python 3.11
15+
uses: actions/setup-python@v5
16+
with:
17+
python-version: '3.11'
18+
19+
- name: Install pipenv
20+
run: |
21+
pip install --upgrade pip
22+
pip install pipenv
23+
24+
# https://github.com/actions/checkout
25+
- name: Checkout quantifying
26+
uses: actions/checkout@v4
27+
28+
- name: Install Python dependencies
29+
run: |
30+
pipenv sync --system
31+
32+
- name: test scripts' help
33+
run: |
34+
./dev/test_sripts_help.sh

dev/test_scripts_help.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Ensure each script can display help message to ensure basic execution.
4+
#
5+
# This script must be run from within the pipenv shell or a properly configured
6+
# environment.
7+
#
8+
#### SETUP ####################################################################
9+
10+
set -o errexit
11+
set -o errtrace
12+
set -o nounset
13+
14+
# shellcheck disable=SC2154
15+
trap '_es=${?};
16+
printf "${0}: line ${LINENO}: \"${BASH_COMMAND}\"";
17+
printf " exited with a status of ${_es}\n";
18+
exit ${_es}' ERR
19+
20+
DIR_REPO="$(cd -P -- "${0%/*}/.." && pwd -P)"
21+
EXIT_STATUS=0
22+
23+
#### FUNCTIONS ################################################################
24+
25+
test_help() {
26+
local _es _script
27+
for _script in $(find scripts/?-* -type f -name '*.py' | sort)
28+
do
29+
_es=0
30+
./"${_script}" --help &>/dev/null || _es=${?}
31+
if (( _es == 0 ))
32+
then
33+
echo "${_script}"
34+
else
35+
echo "${_script}"
36+
EXIT_STATUS=${_es}
37+
fi
38+
done
39+
}
40+
41+
#### MAIN #####################################################################
42+
43+
cd "${DIR_REPO}"
44+
test_help
45+
exit ${EXIT_STATUS}

0 commit comments

Comments
 (0)