Develop Decouple Issue #99 #149
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CLI Test | |
on: [push, workflow_call, pull_request] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
app_type: ["Blank", "SyncORM", "AsyncORM", "MongoDB", "PostgresSync", "PostgresAsync", "MySQLSync", "MySQLAsync"] | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- name: Install dependencies | |
run: | | |
pip install poetry | |
poetry install | |
- name: Test CLI Commands | |
run: | | |
app_name="${{ matrix.app_type }}App" | |
case "${{ matrix.app_type }}" in | |
"Blank") | |
poetry run pynest generate application -n "$app_name" | |
;; | |
"SyncORM") | |
poetry run pynest generate application -n "$app_name" -db sqlite | |
;; | |
"AsyncORM") | |
poetry run pynest generate application -n "$app_name" -db sqlite --is-async | |
;; | |
"MongoDB") | |
poetry run pynest generate application -n "$app_name" -db mongodb | |
;; | |
"PostgresSync") | |
poetry run pynest generate application -n "$app_name" -db postgresql | |
;; | |
"PostgresAsync") | |
poetry run pynest generate application -n "$app_name" -db postgresql --is-async | |
;; | |
"MySQLSync") | |
poetry run pynest generate application -n "$app_name" -db mysql | |
;; | |
"MySQLAsync") | |
poetry run pynest generate application -n "$app_name" -db mysql --is-async | |
;; | |
esac | |
cd "$app_name" | |
poetry run pynest generate resource -n user | |
- name: Verify Boilerplate | |
run: | | |
app_name="${{ matrix.app_type }}App" | |
if [ -d "$app_name" ]; then | |
echo "Directory $app_name exists." | |
else | |
echo "Directory $app_name does not exist." | |
exit 1 | |
fi | |
if [ -d "$app_name/src/user" ]; then | |
echo "Directory $app_name/src/user exists." | |
else | |
echo "Directory $app_name does not exist." | |
exit 1 | |
fi | |
# List of expected files | |
declare -a files=("main.py" "requirements.txt" "README.md") | |
declare -a src_level_files=("app_module.py" "app_service.py" "app_controller.py") | |
declare -a module_files=("user_controller.py" "user_service.py" "user_module.py" "user_model.py") | |
# Check each file in the list of files | |
for file in "${files[@]}"; do | |
if [ -f "$app_name/$file" ]; then | |
echo "$file exists in $app_name." | |
else | |
echo "$file does not exist in $app_name." | |
exit 1 | |
fi | |
done | |
# Check each file in the list of files | |
for file in "${src_level_files[@]}"; do | |
if [ -f "$app_name/src/$file" ]; then | |
echo "$file exists in $app_name." | |
else | |
echo "$file does not exist in $app_name." | |
exit 1 | |
fi | |
done | |
# Check each file in the list of module_files | |
for file in "${module_files[@]}"; do | |
if [ -f "$app_name/src/user/$file" ]; then | |
echo "$file exists in $app_name." | |
else | |
echo "$file does not exist in $app_name." | |
exit 1 | |
fi | |
done | |
echo "Boilerplate for ${{ matrix.app_type }} generated successfully." |