diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c7d212b..f7f86f3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,8 +13,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - with: - ref: main - name: Add environment variables to .env run: | echo "DATABASE_URL=postgresql+asyncpg://postgres:postgres@db:5432/starter_db_dev" >> .env diff --git a/Dockerfile b/Dockerfile index ef5c00f..9aab59a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.10-slim +FROM python:3.11-slim WORKDIR /usr/src/app ENV PYTHONDONTWRITEBYTECODE 1 diff --git a/Dockerfile.test b/Dockerfile.test index 583e284..e9ca71a 100644 --- a/Dockerfile.test +++ b/Dockerfile.test @@ -1,5 +1,5 @@ # pull official base image -FROM python:3.10-slim +FROM python:3.11-slim # set work directory WORKDIR /usr/src/app diff --git a/Makefile b/Makefile index 0fef8c7..6ba9cef 100644 --- a/Makefile +++ b/Makefile @@ -27,3 +27,7 @@ rebuild: rebuild-d: docker-compose down -v --remove-orphans && sudo rm -rf postgres-data; docker-compose up --build -d; + +d-test: + # Rebuilds container and runs docker test + docker-compose build web-test && docker-compose run web-test pytest tests -x -o log_cli=true diff --git a/README.md b/README.md index 5dfa6c8..af8aff5 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,36 @@ # starter-api + ![Continuous Integration](https://github.com/jonwhittlestone/starter-api/workflows/Continuous%20Integration/badge.svg) ## Usage + ```bash make up-build ``` -Run the command above and then visit: http://127.0.0.1:8004 +Run the command above and then visit: http://127.0.0.1:8004 +### Run the tests: -> See [snippets-resources.md](snippets-resources.md) for handy snippets and resources. +```bash +make d-test +``` +> See [snippets-resources.md](snippets-resources.md) for handy snippets and resources. ## Debug FastAPI using VSCode 1. Run this: - ```bash - make up-build - ``` + + ```bash + make up-build + ``` 2. In vscode add a breakpoint 3. Run the debugger (F5) -4. Visit: http://127.0.0.1:8004 +4. Visit: http://127.0.0.1:8004 5. The vscode debugger will pause execution at your breakpoint. @@ -35,13 +42,13 @@ Run the command above and then visit: http://127.0.0.1:8004 - [x] Poetry, Dynaconf - [x] Containerised tests - [x] Github Action to run tests -- [ ] FastAPI repositories, schemas / logging / cleanup and mocked tests +- [ ] FastAPI config, routers, user model, auth, repositories, schemas, logging, cleanup and mocked tests. - [ ] Production deployment - [ ] Pre-commit / manage.py / migrations - [ ] Tag this repo and release ``` -