Skip to content

Commit

Permalink
Refactoring (#30)
Browse files Browse the repository at this point in the history
* refactoring

* fix CI
  • Loading branch information
davorrunje authored Nov 8, 2024
1 parent f1fb07b commit 5a4f849
Show file tree
Hide file tree
Showing 13 changed files with 9 additions and 115 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
matrix:
python-version: ["3.12", "3.11", "3.10"]
app-type: ["fastapi+mesop", "mesop", "nats+fastapi+mesop"]
authentication: ["google", "none"]
fail-fast: false
runs-on: ubuntu-latest
timeout-minutes: 15
Expand All @@ -30,7 +31,7 @@ jobs:
run: pip install cookiecutter

- name: Test Cookiecutter
run: ./scripts/test_cookiecutter.sh ${{ matrix.app-type }} ${{ matrix.python-version }}
run: ./scripts/test_cookiecutter.sh ${{ matrix.app-type }} ${{ matrix.python-version }} ${{ matrix.authentication }}

# https://github.com/marketplace/actions/alls-green#why
check: # This job does nothing and is only used for the branch protection
Expand Down
8 changes: 0 additions & 8 deletions cookiecutter_replay/fastapi+mesop_3.10.json

This file was deleted.

8 changes: 0 additions & 8 deletions cookiecutter_replay/fastapi+mesop_3.11.json

This file was deleted.

8 changes: 0 additions & 8 deletions cookiecutter_replay/fastapi+mesop_3.12.json

This file was deleted.

8 changes: 0 additions & 8 deletions cookiecutter_replay/mesop_3.10.json

This file was deleted.

8 changes: 0 additions & 8 deletions cookiecutter_replay/mesop_3.11.json

This file was deleted.

8 changes: 0 additions & 8 deletions cookiecutter_replay/mesop_3.12.json

This file was deleted.

8 changes: 0 additions & 8 deletions cookiecutter_replay/nats+fastapi+mesop_3.10.json

This file was deleted.

8 changes: 0 additions & 8 deletions cookiecutter_replay/nats+fastapi+mesop_3.11.json

This file was deleted.

8 changes: 0 additions & 8 deletions cookiecutter_replay/nats+fastapi+mesop_3.12.json

This file was deleted.

33 changes: 0 additions & 33 deletions scripts/generate_cookiecutter_replay.py

This file was deleted.

3 changes: 0 additions & 3 deletions scripts/generate_cookiecutter_replay.sh

This file was deleted.

13 changes: 7 additions & 6 deletions scripts/test_cookiecutter.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
#!/bin/bash

# This script is used to test the cookiecutter template
# It will create a new project using the cookiecutter template under the generated/ directory
# It will create a new project using the cookiecutter template under the generated/$1-$2-$3/ directory
# The script accepts two positional arguments: app-type and python-version
# The cookiecutter replay file is used to provide the default values for the cookiecutter template

# Accept two arguments: app-type and python-version
echo -e "\033[32mGenerating project using cookiecutter template with app-type: $1 and python-version: $2\033[0m"
cookiecutter -f --replay-file ./cookiecutter_replay/$1_$2.json --output-dir generated/ ./
echo -e "\033[32mGenerating project using cookiecutter template with app-type: $1, python-version: $2 and authentication: $3\033[0m"
rm -rf generated/$1-$2-$3
cookiecutter -f --no-input --output-dir generated/$1-$2-$3/ ./ app_type=$1 python_version=$2 authentication=$3

# Install generated project's dependencies
echo -e "\033[32mInstalling dependencies for the generated project\033[0m"
cd generated/my_fastagency_app && pip install -e .[dev] && cd ../../
cd generated/$1-$2-$3/my_fastagency_app && pip install -e .[dev] && cd ../../..

# Initialize git in the generated project(needed for pre-commit)
echo -e "\033[32mInitializing git in the generated project\033[0m"
cd generated/my_fastagency_app && git init && git add . && cd ../../
cd generated/$1-$2-$3/my_fastagency_app && git init && git add . && cd ../../..

# Run pre-commit
echo -e "\033[32mRunning pre-commit\033[0m"
cd generated/my_fastagency_app && pre-commit run --show-diff-on-failure --color=always --all-files && cd ../../
cd generated/$1-$2-$3/my_fastagency_app && pre-commit run --show-diff-on-failure --color=always --all-files && cd ../../..

0 comments on commit 5a4f849

Please sign in to comment.