Add Stable UI #27
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Django CI Pipeline | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| services: | |
| mysql: | |
| image: mysql:8.0 | |
| env: | |
| MYSQL_ROOT_PASSWORD: root | |
| MYSQL_DATABASE: test_db | |
| ports: | |
| - 3306:3306 | |
| options: >- | |
| --health-cmd="mysqladmin ping -h 127.0.0.1 -u root -proot --silent" | |
| --health-interval=10s | |
| --health-timeout=5s | |
| --health-retries=5 | |
| env: | |
| DJANGO_SECRET_KEY: dummykey | |
| DJANGO_DEBUG: true | |
| DB_NAME: test_db | |
| DB_USER: root | |
| DB_PASSWORD: root | |
| DB_HOST: 127.0.0.1 | |
| DB_PORT: 3306 | |
| DJANGO_SETTINGS_MODULE: task_manager.settings | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Cache pip dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Install Dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Wait for MySQL to be Ready | |
| run: | | |
| until mysql -h 127.0.0.1 -u root -proot -e "SELECT 1" > /dev/null 2>&1; do | |
| echo "⏳ Waiting for MySQL to start..."; | |
| sleep 3; | |
| done | |
| echo "✅ MySQL is ready!" | |
| - name: Run Migrations | |
| run: | | |
| python manage.py migrate --noinput | |
| - name: Run Tests | |
| run: | | |
| python manage.py test |