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
46 changes: 23 additions & 23 deletions .github/workflows/cli_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,50 +12,54 @@ jobs:

steps:
- name: Check out repository code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.9'
python-version: "3.9"

- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: "0.9.7"
enable-cache: true

- name: Install dependencies
run: |
pip install poetry
poetry install
run: uv sync --no-dev --group test

- 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"
uv run pynest generate application -n "$app_name"
;;
"SyncORM")
poetry run pynest generate application -n "$app_name" -db sqlite
uv run pynest generate application -n "$app_name" -db sqlite
;;
"AsyncORM")
poetry run pynest generate application -n "$app_name" -db sqlite --is-async
uv run pynest generate application -n "$app_name" -db sqlite --is-async
;;
"MongoDB")
poetry run pynest generate application -n "$app_name" -db mongodb
uv run pynest generate application -n "$app_name" -db mongodb
;;
"PostgresSync")
poetry run pynest generate application -n "$app_name" -db postgresql
uv run pynest generate application -n "$app_name" -db postgresql
;;
"PostgresAsync")
poetry run pynest generate application -n "$app_name" -db postgresql --is-async
uv run pynest generate application -n "$app_name" -db postgresql --is-async
;;
"MySQLSync")
poetry run pynest generate application -n "$app_name" -db mysql
uv run pynest generate application -n "$app_name" -db mysql
;;
"MySQLAsync")
poetry run pynest generate application -n "$app_name" -db mysql --is-async
uv run pynest generate application -n "$app_name" -db mysql --is-async
;;
esac

cd "$app_name"
poetry run pynest generate resource -n user
uv run pynest generate resource -n user

- name: Verify Boilerplate
run: |
Expand All @@ -66,20 +70,18 @@ jobs:
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."
Expand All @@ -88,8 +90,7 @@ jobs:
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."
Expand All @@ -99,7 +100,6 @@ jobs:
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."
Expand All @@ -109,4 +109,4 @@ jobs:
fi
done

echo "Boilerplate for ${{ matrix.app_type }} generated successfully."
echo "Boilerplate for ${{ matrix.app_type }} generated successfully."
24 changes: 14 additions & 10 deletions .github/workflows/deploy_docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,36 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Copy License File
run: cp LICENSE docs/license.md

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.9"

- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: "0.9.7"
enable-cache: true

- name: Install dependencies
run: |
pip install poetry
poetry install --with docs
run: uv sync --no-dev --group docs

- name: Build docs
run: poetry run mkdocs build --clean
run: uv run mkdocs build --clean

- name: Setup Pages
uses: actions/configure-pages@v3
uses: actions/configure-pages@v4

- name: Upload artifact
uses: actions/upload-pages-artifact@v1
uses: actions/upload-pages-artifact@v3
with:
path: 'site'
path: "site"

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
uses: actions/deploy-pages@v4
27 changes: 15 additions & 12 deletions .github/workflows/integration_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,21 @@ jobs:

steps:
- name: Check out repository code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.9'
python-version: "3.9"

- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: "0.9.7"
enable-cache: true

- name: Install dependencies
run: |
pip install poetry
poetry install
run: uv sync --no-dev --group test

- name: Start Application
run: |
Expand All @@ -38,15 +42,14 @@ jobs:
fi

if [ "${{ matrix.app_type }}" == "Blank" ]; then
poetry run pynest generate application -n "$app_name"
uv run pynest generate application -n "$app_name"
else
poetry run pynest generate application -n "$app_name" -db sqlite $is_async
poetry add aiosqlite
uv run pynest generate application -n "$app_name" -db sqlite $is_async
fi

cd "$app_name"
poetry run pynest generate resource -n user
poetry run uvicorn "src.app_module:http_server" --host "0.0.0.0" --port 8000 --reload &
uv run pynest generate resource -n user
uv run uvicorn "src.app_module:http_server" --host "0.0.0.0" --port 8000 --reload &

- name: Wait for the server to start
run: sleep 10
Expand All @@ -62,4 +65,4 @@ jobs:
curl -f http://localhost:8000/user/

- name: Kill the server
run: kill $(jobs -p) || true
run: kill $(jobs -p) || true
99 changes: 55 additions & 44 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,18 @@ name: Release Package

on:
workflow_dispatch:
permissions:
users:
- ItayTheDar
inputs:
increment_version:
description: 'Increment version by major, minor, or patch'
description: "Increment version by major, minor, or patch"
required: true
default: 'patch'
default: "patch"
type: choice
options:
- major
- minor
- patch

env:
VERSION_FILE_PATH: pyproject.toml
CHANGELOG_FILE_PATH: CHANGELOG.md

jobs:
Expand All @@ -32,69 +28,84 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
token: ${{ secrets.RELEASE_GIT_TOKEN }}

- name: Install Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install Poetry
run: |
pip install poetry
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: "0.9.7"
enable-cache: true

- name: Set version using Poetry
- name: Set version
run: |
# Extract the current version
CURRENT_VERSION=$(poetry version -s)
CURRENT_VERSION=$(uv version --short)
echo "Current version: $CURRENT_VERSION"

# Increment version
case ${{ inputs.increment_version }} in
major)
NEW_VERSION=$(poetry version major | awk '{print $NF}')
;;
minor)
NEW_VERSION=$(poetry version minor | awk '{print $NF}')
;;
patch)
NEW_VERSION=$(poetry version patch | awk '{print $NF}')
;;
*)
echo "Invalid input for increment_version"
exit 1
;;
esac

uv version --bump "${{ inputs.increment_version }}" --frozen
NEW_VERSION=$(uv version --short)
echo "New version: $NEW_VERSION"
echo "RELEASE_VERSION=$NEW_VERSION" >> $GITHUB_ENV
echo "RELEASE_VERSION=$NEW_VERSION" >> "$GITHUB_ENV"

NEW_VERSION="$NEW_VERSION" python - <<'PY'
import os
import re
from pathlib import Path

version = os.environ["NEW_VERSION"]
path = Path("nest/__init__.py")
text = path.read_text()
updated = re.sub(
r'^__version__ = "[^"]+"$',
f'__version__ = "{version}"',
text,
flags=re.MULTILINE,
)
if updated == text:
raise SystemExit("Could not update nest/__init__.py version")
path.write_text(updated)
PY

- name: Install build dependencies
run: |
poetry install --with build

run: uv sync --no-dev --group build

- name: Update CHANGELOG.md
run: poetry run git-changelog . -o $CHANGELOG_FILE_PATH
run: uv run git-changelog . -o "$CHANGELOG_FILE_PATH"

- name: Build package with Poetry
run: |
poetry build
- name: Build package
run: uv build --sdist --wheel

- name: Check package metadata
run: uv run twine check dist/*

- name: Smoke test wheel
run: uv run --isolated --no-project --with dist/*.whl python -c "import nest; from nest.cli.cli import nest_cli; print(nest.__version__)"

- name: Smoke test source distribution
run: uv run --isolated --no-project --with dist/*.tar.gz python -c "import nest; from nest.cli.cli import nest_cli; print(nest.__version__)"

- name: Commit and push changes
run: |
git config --global user.name "github-actions"
git config --global user.email "github@actions.com"
git add $CHANGELOG_FILE_PATH pyproject.toml
git commit -m "Increment version to $NEW_VERSION"
git add "$CHANGELOG_FILE_PATH" pyproject.toml nest/__init__.py
git commit -m "Increment version to $RELEASE_VERSION"
git push

- name: Publish package to PyPI
run: |
poetry publish --username ${{ secrets.PYPI_API_USER }} --password ${{ secrets.PYPI_API_TOKEN }}
env:
UV_PUBLISH_USERNAME: ${{ secrets.PYPI_API_USER }}
UV_PUBLISH_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: uv publish

- name: Create GitHub release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
name: v${{ env.RELEASE_VERSION }}
tag_name: v${{ env.RELEASE_VERSION }}
Expand Down
Loading
Loading