diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..21eab57 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,60 @@ +name: Backend CI + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + ci: + name: Django CI + runs-on: ubuntu-latest + + env: + SECRET_KEY: ci-test-secret-key + DB_NAME: task_manager + DB_USER: task_manager_user + DB_PASSWORD: ci-test-db-password + DB_HOST: 127.0.0.1 + DB_PORT: 3306 + + services: + mysql: + image: mysql:8.0 + env: + MYSQL_DATABASE: task_manager + MYSQL_USER: task_manager_user + MYSQL_PASSWORD: ci-test-db-password + MYSQL_ROOT_PASSWORD: ci-test-root-password + ports: + - 3306:3306 + options: >- + --health-cmd="mysqladmin ping -h 127.0.0.1 -uroot -pci-test-root-password" + --health-interval=10s + --health-timeout=5s + --health-retries=5 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + cache: pip + + - name: Install dependencies + run: pip install -r requirements.txt + + - name: Check Django configuration + run: python manage.py check + + - name: Check migrations + run: python manage.py makemigrations --check --dry-run + + - name: Run tests + run: python manage.py test \ No newline at end of file diff --git a/.gitignore b/.gitignore index 063967c..ec190e8 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ __pycache__/ # Virtual environments .venv/ +.env/ venv/ env/ ENV/ diff --git a/requirements.txt b/requirements.txt index 5932357..08a9ab8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,11 +2,10 @@ asgiref==3.10.0 Django==5.2.7 django-cors-headers==4.9.0 djangorestframework==3.16.1 -djangorestframework_simplejwt==5.5.1 -dotenv==0.9.9 +djangorestframework-simplejwt==5.5.1 gunicorn==23.0.0 -packaging==25.0 PyJWT==2.10.1 PyMySQL==1.1.2 +cryptography==3.4.8 python-dotenv==1.1.1 -sqlparse==0.5.3 +sqlparse==0.5.3 \ No newline at end of file