diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..096a39f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,72 @@ +name: CI Pipeline + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build-test-lint: + runs-on: ubuntu-latest + + services: + postgres: + image: postgres:16 + env: + POSTGRES_DB: taskflow + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + ports: + - 5432:5432 + options: >- + --health-cmd="pg_isready" + --health-interval=10s + --health-timeout=5s + --health-retries=5 + + rabbitmq: + image: rabbitmq:3.12-management + ports: + - 5672:5672 + - 15672:15672 + + env: + DEBUG: False + SECRET_KEY: dummy-key + DJANGO_ALLOWED_HOSTS: localhost + POSTGRES_DB: taskflow + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_HOST: localhost + POSTGRES_PORT: 5432 + CELERY_BROKER_URL: amqp://guest:guest@localhost:5672// + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Install dependencies + run: | + python -m venv venv + source venv/bin/activate + pip install -r requirements.txt + + - name: Run migrations + run: | + source venv/bin/activate + python manage.py migrate + + - name: Run tests + run: | + source venv/bin/activate + pytest --disable-warnings + + - name: Run Ruff Linter + run: | + source venv/bin/activate + ruff check .