Skip to content
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
34 changes: 34 additions & 0 deletions .github/workflows/test_scripts_help.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Test scripts' help

on:
push:
workflow_dispatch:

jobs:
job:
runs-on: ubuntu-latest

steps:

# https://github.com/actions/setup-python
- name: Install Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install pipenv
run: |
pip install --upgrade pip
pip install pipenv

# https://github.com/actions/checkout
- name: Checkout quantifying
uses: actions/checkout@v4

- name: Install Python dependencies
run: |
pipenv sync --system

- name: Test scripts' help
run: |
./dev/test_scripts_help.sh
56 changes: 56 additions & 0 deletions dev/test_scripts_help.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/usr/bin/env bash
#
# Ensure each script can display help message to ensure basic execution.
#
# This script must be run from within the pipenv shell or a properly configured
# environment. For example:
#
# 1. Using pipenv run
# pipenv run ./dev/test_scripts_help.sh
#
# 2. Using pipenv shell
# pipenv shell
# ./dev/test_scripts_help.sh
#
# 3. A properly configured environment
# (see .github/workflows/test_scripts_help.yml)
#
#### SETUP ####################################################################

set -o errexit
set -o errtrace
set -o nounset

# shellcheck disable=SC2154
trap '_es=${?};
printf "${0}: line ${LINENO}: \"${BASH_COMMAND}\"";
printf " exited with a status of ${_es}\n";
exit ${_es}' ERR

DIR_REPO="$(cd -P -- "${0%/*}/.." && pwd -P)"
EXIT_STATUS=0

#### FUNCTIONS ################################################################

test_help() {
local _es _script
for _script in $(find scripts/?-* -type f -name '*.py' | sort)
do
_es=0
./"${_script}" --help &>/dev/null || _es=${?}
if (( _es == 0 ))
then
echo "✅ ${_script}"
else
echo "❌ ${_script}"
EXIT_STATUS=${_es}
fi
done
}

#### MAIN #####################################################################

cd "${DIR_REPO}"
test_help
echo "exit status: ${EXIT_STATUS}"
exit ${EXIT_STATUS}