Skip to content

[codex] Add lifecycle hooks #293

[codex] Add lifecycle hooks

[codex] Add lifecycle hooks #293

name: Integration Test
on: [push, workflow_call, pull_request]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
app_type: ["Blank", "SyncORM", "AsyncORM"]
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Set up Python
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: uv sync --no-dev --group test
- name: Start Application
run: |
if [ "${{ matrix.app_type }}" == "Blank" ]; then
app_name="NestApp"
is_async=""
elif [ "${{ matrix.app_type }}" == "SyncORM" ]; then
app_name="ORMNestApp"
is_async=""
elif [ "${{ matrix.app_type }}" == "AsyncORM" ]; then
app_name="AsyncORMNestApp"
is_async="--is-async"
fi
if [ "${{ matrix.app_type }}" == "Blank" ]; then
uv run pynest generate application -n "$app_name"
else
uv run pynest generate application -n "$app_name" -db sqlite $is_async
fi
cd "$app_name"
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
- name: Test the application
run: |
curl -f http://localhost:8000/docs
curl -f -X 'POST' \
"http://localhost:8000/user/" \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{"name": "Example Name"}'
curl -f http://localhost:8000/user/
- name: Kill the server
run: kill $(jobs -p) || true